Merge pull request #288 from warengroup/develop

Version 0.4.0
This commit is contained in:
Christer Warén 2022-07-19 01:01:44 +03:00 committed by GitHub
commit 3e6f387f91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 905 additions and 2680 deletions

View File

@ -43,7 +43,7 @@ jobs:
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v1 uses: github/codeql-action/init@v2
with: with:
languages: ${{ matrix.language }} languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file. # If you wish to specify custom queries, you can do so here or in a config file.
@ -54,7 +54,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v1 uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 https://git.io/JvXDl
@ -68,4 +68,4 @@ jobs:
# make release # make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1 uses: github/codeql-action/analyze@v2

View File

@ -12,7 +12,7 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1.6.0 uses: docker/setup-buildx-action@v2.0.0
id: buildx id: buildx
with: with:
install: true install: true

View File

@ -10,34 +10,34 @@ This bot is using Gitea repo to get radio stations from [playlist.json](https://
**Production** **Production**
``` ```
docker build -t warengroup/eximiabots-radiox:0.3.20 . --pull docker build -t warengroup/eximiabots-radiox:latest . --pull
``` ```
**Beta** **Beta**
``` ```
docker build -t warengroup/eximiabots-radiox:0.3.20-beta . --pull docker build -t warengroup/eximiabots-radiox:latest-beta . --pull
``` ```
**Dev** **Dev**
``` ```
docker build -t warengroup/eximiabots-radiox:0.3.20-dev . --pull docker build -t warengroup/eximiabots-radiox:latest-dev . --pull
``` ```
### 2. Run Container ### 2. Run Container
**Production** **Production**
``` ```
docker run --name radiox --net host -d -e DISCORD_TOKEN= -e STREAMER_MODE=auto -v "$PWD/datastore":/usr/src/app/datastore/ warengroup/eximiabots-radiox:0.3.20 docker run --name radiox --net host -d -e DISCORD_TOKEN= -e STREAMER_MODE=auto -v "$PWD/datastore":/usr/src/app/datastore/ warengroup/eximiabots-radiox:latest
``` ```
**Beta** **Beta**
``` ```
docker run --name radiox --net host -d -e DISCORD_TOKEN= -e STREAMER_MODE=auto -v "$PWD/datastore":/usr/src/app/datastore/ warengroup/eximiabots-radiox:0.3.20-beta docker run --name radiox --net host -d -e DISCORD_TOKEN= -e STREAMER_MODE=auto -v "$PWD/datastore":/usr/src/app/datastore/ warengroup/eximiabots-radiox:latest-beta
``` ```
**Dev** **Dev**
``` ```
docker run --rm --name radiox-dev --net host -e DISCORD_TOKEN= -e DEV_MODE=true -v "$PWD":/usr/src/app/ warengroup/eximiabots-radiox:0.3.20-dev docker run --rm --name radiox-dev --net host -e DISCORD_TOKEN= -e DEV_MODE=true -v "$PWD":/usr/src/app/ warengroup/eximiabots-radiox:latest-dev
``` ```

3387
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
{ {
"name": "eximiabots-radiox", "name": "eximiabots-radiox",
"version": "0.3.20", "version": "0.4.0",
"description": "Internet Radio to your Discord guild", "description": "Internet Radio to your Discord guild",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "rimraf ./build && tsc", "build": "rimraf ./build && tsc",
"start": "node --no-warnings build/index.js", "start": "node --no-warnings build/index.js",
"start:dev": "npm run build && node --no-warnings build/index.js" "start:dev": "rimraf ./build && tsc && node --no-warnings build/index.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -18,31 +18,30 @@
"url": "https://github.com/warengroup/eximiabots-radiox/issues" "url": "https://github.com/warengroup/eximiabots-radiox/issues"
}, },
"dependencies": { "dependencies": {
"@discordjs/builders": "^0.12.0", "@discordjs/builders": "^1.0.0",
"@discordjs/opus": "^0.7.0", "@discordjs/opus": "^0.8.0",
"@discordjs/rest": "^0.3.0", "@discordjs/rest": "^1.0.0",
"@discordjs/voice": "^0.8.0", "@discordjs/voice": "^0.11.0",
"discord-api-types": "^0.31.0", "discord-api-types": "^0.36.2",
"discord.js": "^13.6.0", "discord.js": "^14.0.2",
"dotenv": "^16.0.0", "dotenv": "^16.0.1",
"libsodium-wrappers": "^0.7.10", "libsodium-wrappers": "^0.7.10",
"node-fetch": "^3.2.3", "node-fetch": "^3.2.9",
"path": "^0.12.7" "path": "^0.12.7"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^17.0.23", "@types/node": "^18.0.6",
"@types/ws": "^8.5.3", "@types/ws": "^8.5.3",
"@typescript-eslint/eslint-plugin": "^5.18.0", "@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.18.0", "@typescript-eslint/parser": "^5.30.7",
"eslint": "^8.12.0", "eslint": "^8.20.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0", "eslint-plugin-prettier": "^4.2.1",
"nodemon": "^2.0.15", "prettier": "^2.7.1",
"prettier": "^2.6.2",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"ts-node": "^10.7.0", "ts-node": "^10.9.1",
"tsc-watch": "^5.0.2", "tsc-watch": "^5.0.3",
"typescript": "^4.6.3" "typescript": "^4.7.4"
}, },
"engines": { "engines": {
"node": ">=16.9.1", "node": ">=16.9.1",

View File

@ -1,4 +1,4 @@
import Discord, { Client, Collection } from "discord.js"; import { Client, Collection, IntentsBitField } from "discord.js";
import Datastore from "./client/classes/Datastore.js"; import Datastore from "./client/classes/Datastore.js";
import Radio from "./client/classes/Radio.js"; import Radio from "./client/classes/Radio.js";
import Stations from "./client/classes/Stations.js"; import Stations from "./client/classes/Stations.js";
@ -12,7 +12,7 @@ import path from "path";
const events = "./client/events/"; const events = "./client/events/";
const GatewayIntents = new Discord.Intents(); const GatewayIntents = new IntentsBitField();
GatewayIntents.add( GatewayIntents.add(
1 << 0, // GUILDS 1 << 0, // GUILDS
1 << 7, // GUILD_VOICE_STATES 1 << 7, // GUILD_VOICE_STATES

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
name: 'bug', name: 'bug',
@ -10,7 +10,7 @@ module.exports = {
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username); message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
message.bugDescription = client.messages.bugDescription.replace("%client.config.supportGuild%", client.config.supportGuild); message.bugDescription = client.messages.bugDescription.replace("%client.config.supportGuild%", client.config.supportGuild);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(message.bugTitle) .setTitle(message.bugTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
name: 'help', name: 'help',
@ -19,7 +19,7 @@ module.exports = {
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username); message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
message.helpDescription = client.messages.helpDescription.replace("%commands%", commands); message.helpDescription = client.messages.helpDescription.replace("%commands%", commands);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(message.helpTitle) .setTitle(message.helpTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
name: 'invite', name: 'invite',
@ -7,7 +7,7 @@ module.exports = {
execute(interaction, client) { execute(interaction, client) {
let message = {}; let message = {};
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username); message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(message.inviteTitle) .setTitle(message.inviteTitle)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setURL("https://discord.com/api/oauth2/authorize?client_id=" + client.user.id + "&permissions=2184465408&scope=applications.commands%20bot") //View Channels, Send Messages, Embed Links, Use External Emojis, Use Slash Commands, Connect, Speak, Use Voice Activity .setURL("https://discord.com/api/oauth2/authorize?client_id=" + client.user.id + "&permissions=2184465408&scope=applications.commands%20bot") //View Channels, Send Messages, Embed Links, Use External Emojis, Use Slash Commands, Connect, Speak, Use Voice Activity

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
name: 'list', name: 'list',
@ -26,7 +26,7 @@ module.exports = {
stations = stations.replace('**#**', `**${i + 1}.**`); stations = stations.replace('**#**', `**${i + 1}.**`);
} }
let embed = new Discord.MessageEmbed() let embed = new EmbedBuilder()
.setTitle(client.messages.listTitle) .setTitle(client.messages.listTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { ActionRowBuilder, EmbedBuilder, SelectMenuBuilder } from "discord.js";
import Streamer from "../classes/Streamer.js"; import Streamer from "../classes/Streamer.js";
const _importDynamic = new Function('modulePath', 'return import(modulePath)'); const _importDynamic = new Function('modulePath', 'return import(modulePath)');
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args)); const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
@ -19,62 +19,53 @@ module.exports = {
{ {
emoji: "🌀", emoji: "🌀",
label: "Restart Bot", label: "Restart Bot",
description: "",
value: "0" value: "0"
}, },
{ {
emoji: "<:RadioXStop:688541155377414168>", emoji: "<:RadioXStop:688541155377414168>",
label: "Save Radios", label: "Save Radios",
description: "",
value: "4" value: "4"
}, },
{ {
emoji: "<:RadioXPlay:688541155712827458>", emoji: "<:RadioXPlay:688541155712827458>",
label: "Restore Radios", label: "Restore Radios",
description: "",
value: "5" value: "5"
}, },
{ {
emoji: "#️⃣", emoji: "#️⃣",
label: "Reload Commands", label: "Reload Commands",
description: "",
value: "6" value: "6"
}, },
{ {
emoji: "<:RadioXList:688541155519889482>", emoji: "<:RadioXList:688541155519889482>",
label: "Reload Stations", label: "Reload Stations",
description: "",
value: "7" value: "7"
}, },
{ {
emoji: "<:dnd:746069698139127831>", emoji: "<:dnd:746069698139127831>",
label: "Enable Maintenance Mode", label: "Enable Maintenance Mode",
description: "",
value: "8" value: "8"
}, },
{ {
emoji: "<:online:746069731836035098>", emoji: "<:online:746069731836035098>",
label: "Disable Maintenance Mode", label: "Disable Maintenance Mode",
description: "",
value: "9" value: "9"
}, },
{ {
emoji: "💤", emoji: "💤",
label: "Streamer Mode Manual", label: "Streamer Mode Manual",
description: "",
value: "10" value: "10"
}, },
{ {
emoji: "📡", emoji: "📡",
label: "Streamer Mode Auto", label: "Streamer Mode Auto",
description: "",
value: "11" value: "11"
} }
); );
const menu = new Discord.MessageActionRow() const menu = new ActionRowBuilder()
.addComponents( .addComponents(
new Discord.MessageSelectMenu() new SelectMenuBuilder()
.setCustomId('maintenance') .setCustomId('maintenance')
.setPlaceholder('Select action') .setPlaceholder('Select action')
.addOptions(options) .addOptions(options)
@ -90,7 +81,7 @@ module.exports = {
client.funcs.logger('Maintenance', options.find(option => option.value == action).label); client.funcs.logger('Maintenance', options.find(option => option.value == action).label);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.maintenanceTitle) .setTitle(client.messages.maintenanceTitle)
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.setDescription(options.find(option => option.value == action).label) .setDescription(options.find(option => option.value == action).label)

View File

@ -23,7 +23,7 @@ module.exports = {
radio.textChannel = interaction.channel; radio.textChannel = interaction.channel;
radio.startTime = date.getTime(); radio.startTime = date.getTime();
if(interaction.isCommand()) { if(interaction.isChatInputCommand()) {
client.funcs.play(client, interaction, interaction.guild, station); client.funcs.play(client, interaction, interaction.guild, station);
} }
if(interaction.isButton()) { if(interaction.isButton()) {

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
name: 'nowplaying', name: 'nowplaying',
@ -18,7 +18,7 @@ module.exports = {
message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%" + "\n", radio.station.name != radio.station.owner ? radio.station.owner + "\n" : ""); message.nowplayingDescription = message.nowplayingDescription.replace("%radio.station.owner%" + "\n", radio.station.name != radio.station.owner ? radio.station.owner + "\n" : "");
message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed)%", client.funcs.msToTime(completed)); message.nowplayingDescription = message.nowplayingDescription.replace("%client.funcs.msToTime(completed)%", client.funcs.msToTime(completed));
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.nowplayingTitle) .setTitle(client.messages.nowplayingTitle)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))) .setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)

View File

@ -1,3 +1,4 @@
import { PermissionFlagsBits } from "discord.js";
const { const {
getVoiceConnection, getVoiceConnection,
joinVoiceChannel joinVoiceChannel
@ -51,13 +52,13 @@ module.exports = {
ephemeral: true ephemeral: true
}); });
const permissions = voiceChannel.permissionsFor(interaction.client.user); const permissions = voiceChannel.permissionsFor(interaction.client.user);
if (!permissions.has("CONNECT")) { if (!permissions.has(PermissionFlagsBits.Connect)) {
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noPermsConnect, content: client.messageEmojis["error"] + client.messages.noPermsConnect,
ephemeral: true ephemeral: true
}); });
} }
if (!permissions.has("SPEAK")) { if (!permissions.has(PermissionFlagsBits.Speak)) {
return interaction.reply({ return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noPermsSpeak, content: client.messageEmojis["error"] + client.messages.noPermsSpeak,
ephemeral: true ephemeral: true

View File

@ -23,7 +23,7 @@ module.exports = {
radio.textChannel = interaction.channel; radio.textChannel = interaction.channel;
radio.startTime = date.getTime(); radio.startTime = date.getTime();
if(interaction.isCommand()) { if(interaction.isChatInputCommand()) {
client.funcs.play(client, interaction, interaction.guild, station); client.funcs.play(client, interaction, interaction.guild, station);
} }
if(interaction.isButton()) { if(interaction.isButton()) {

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
@ -26,7 +26,7 @@ module.exports = {
statistics = "[Open Dashboard](https://eximiabots.waren.io/radiox/" + interaction.guild.id + "/stats?info=" + Buffer.from(JSON.stringify(currentGuild), 'utf8').toString('base64') + "&globalInfo=" + Buffer.from(JSON.stringify(global), 'utf8').toString('base64') + ")" + "\n"; statistics = "[Open Dashboard](https://eximiabots.waren.io/radiox/" + interaction.guild.id + "/stats?info=" + Buffer.from(JSON.stringify(currentGuild), 'utf8').toString('base64') + "&globalInfo=" + Buffer.from(JSON.stringify(global), 'utf8').toString('base64') + ")" + "\n";
} }
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.messages.statisticsTitle) .setTitle(client.messages.statisticsTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
name: 'status', name: 'status',
@ -10,15 +10,17 @@ module.exports = {
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username); message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
let uptime = client.funcs.msToTime(client.uptime); let uptime = client.funcs.msToTime(client.uptime);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(message.statusTitle) .setTitle(message.statusTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.addField(client.messages.statusField1, uptime, false) .addFields([
.addField(client.messages.statusField2, client.config.version, false) { name: client.messages.statusField1, value: uptime },
.addField(client.messages.statusField3, Date.now() - interaction.createdTimestamp + "ms", false) { name: client.messages.statusField2, value: client.config.version },
.addField(client.messages.statusField4, client.ws.ping + "ms", false) { name: client.messages.statusField3, value: Date.now() - interaction.createdTimestamp + "ms" },
.addField(client.messages.statusField5, client.config.hostedBy, false) { name: client.messages.statusField4, value: client.ws.ping },
{ name: client.messages.statusField5, value: client.config.hostedBy }
])
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { EmbedBuilder } from "discord.js";
module.exports = { module.exports = {
name: 'stop', name: 'stop',
@ -11,11 +11,14 @@ module.exports = {
radio.connection?.destroy(); radio.connection?.destroy();
client.funcs.logger('Radio', interaction.guild.id + " / " + 'Stop'); client.funcs.logger('Radio', interaction.guild.id + " / " + 'Stop');
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.user.username) .setTitle(client.user.username)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.addField(client.messages.nowplayingTitle, "-", true) .addFields({
name: client.messages.nowplayingTitle,
value: "-"
})
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,

View File

@ -1,16 +1,18 @@
import { PermissionFlagsBits } from "discord.js";
module.exports = { module.exports = {
name: 'interactionCreate', name: 'interactionCreate',
async execute(client, interaction) { async execute(client, interaction) {
const permissions = interaction.channel.permissionsFor(interaction.client.user); const permissions = interaction.channel.permissionsFor(interaction.client.user);
if (!permissions.has('VIEW_CHANNEL')) return; if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
if (!permissions.has('EMBED_LINKS')) return interaction.reply({ if (!permissions.has(PermissionFlagsBits.EmbedLinks)) return interaction.reply({
content: client.messageEmojis["error"] + client.messages.noPermsEmbed, content: client.messageEmojis["error"] + client.messages.noPermsEmbed,
ephemeral: true ephemeral: true
}); });
if(interaction.isCommand()){ if(interaction.isChatInputCommand()){
const commandName = interaction.commandName; const commandName = interaction.commandName;
const command = client.commands.get(commandName); const command = client.commands.get(commandName);
if (!command) return; if (!command) return;

View File

@ -1,4 +1,5 @@
import Discord from "discord.js"; import { EmbedBuilder, PermissionFlagsBits } from "discord.js";
module.exports = { module.exports = {
name: 'messageCreate', name: 'messageCreate',
async execute(client, message) { async execute(client, message) {
@ -25,13 +26,13 @@ module.exports = {
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)); const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
if (!command && message.content !== `${prefix}`) return; if (!command && message.content !== `${prefix}`) return;
const permissions = message.channel.permissionsFor(message.client.user); const permissions = message.channel.permissionsFor(message.client.user);
if (!permissions.has('EMBED_LINKS')) return message.channel.send(client.messages.noPermsEmbed); if (!permissions.has(PermissionFlagsBits.EmbedLinks)) return message.channel.send(client.messages.noPermsEmbed);
try { try {
let newMessage = {}; let newMessage = {};
newMessage.messageCommandsDeprecatedTitle = client.messages.messageCommandsDeprecatedTitle.replace("%client.user.username%", client.user.username); newMessage.messageCommandsDeprecatedTitle = client.messages.messageCommandsDeprecatedTitle.replace("%client.user.username%", client.user.username);
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(newMessage.messageCommandsDeprecatedTitle) .setTitle(newMessage.messageCommandsDeprecatedTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, '')) .setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)

View File

@ -14,11 +14,9 @@ module.exports = {
client.funcs.logger('Datastore', 'Initialize'); client.funcs.logger('Datastore', 'Initialize');
client.datastore = new Datastore(); client.datastore = new Datastore();
client.funcs.logger('Datastore');
client.datastore.map.forEach(datastore => { client.datastore.map.forEach(datastore => {
console.log("- " + datastore.guild.id + " / " + datastore.guild.name); client.funcs.logger('Datastore', datastore.guild.id + " / " + datastore.guild.name);
}); });
console.log("\n");
client.funcs.logger('Datastore', 'Ready'); client.funcs.logger('Datastore', 'Ready');

View File

@ -1,3 +1,4 @@
import { PermissionFlagsBits } from "discord.js";
const { const {
getVoiceConnection, getVoiceConnection,
joinVoiceChannel joinVoiceChannel
@ -22,7 +23,7 @@ module.exports = {
} }
const newPermissions = newState.channel.permissionsFor(newState.client.user); const newPermissions = newState.channel.permissionsFor(newState.client.user);
if (!newPermissions.has("CONNECT") || !newPermissions.has("SPEAK") || !newPermissions.has("VIEW_CHANNEL")) { if (!newPermissions.has(PermissionFlagsBits.Connect) || !newPermissions.has(PermissionFlagsBits.Speak) || !newPermissions.has(PermissionFlagsBits.ViewChannel)) {
try { try {
setTimeout( setTimeout(
async () => ( async () => (

View File

@ -1,7 +1,6 @@
module.exports = function check(client, interaction, command) { module.exports = function check(client, interaction, command) {
let message = {}; let message = {};
const radio = client.radio.get(interaction.guild.id); const radio = client.radio.get(interaction.guild.id);
const permissions = interaction.channel.permissionsFor(interaction.user);
if(client.config.maintenanceMode){ if(client.config.maintenanceMode){
interaction.reply({ interaction.reply({
content: client.messageEmojis["error"] + client.messages.maintenance, content: client.messageEmojis["error"] + client.messages.maintenance,

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { ActionRowBuilder, SelectMenuBuilder } from "discord.js";
module.exports = function listStations(client, interaction){ module.exports = function listStations(client, interaction){
let stations = new Array(); let stations = new Array();
@ -14,9 +14,9 @@ module.exports = function listStations(client, interaction){
options.push(station); options.push(station);
}); });
const menu = new Discord.MessageActionRow() const menu = new ActionRowBuilder()
.addComponents( .addComponents(
new Discord.MessageSelectMenu() new SelectMenuBuilder()
.setCustomId('play') .setCustomId('play')
.setPlaceholder('Nothing selected') .setPlaceholder('Nothing selected')
.addOptions(options) .addOptions(options)

View File

@ -1,4 +1,4 @@
import Discord from "discord.js"; import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
module.exports = async function play(client, interaction, guild, station) { module.exports = async function play(client, interaction, guild, station) {
let message = {}; let message = {};
@ -13,47 +13,50 @@ module.exports = async function play(client, interaction, guild, station) {
message.nowplayingDescription = message.nowplayingDescription.replace("**", ""); message.nowplayingDescription = message.nowplayingDescription.replace("**", "");
message.nowplayingDescription = message.nowplayingDescription.replace("**", ""); message.nowplayingDescription = message.nowplayingDescription.replace("**", "");
const embed = new Discord.MessageEmbed() const embed = new EmbedBuilder()
.setTitle(client.user.username) .setTitle(client.user.username)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, ''))) .setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor) .setColor(client.config.embedColor)
.addField(client.messages.nowplayingTitle, message.nowplayingDescription, true) .addFields({
name: client.messages.nowplayingTitle,
value: message.nowplayingDescription
})
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png') .setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({ .setFooter({
text: client.messages.footerText, text: client.messages.footerText,
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '') iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')
}); });
const buttons = new Discord.MessageActionRow() const buttons = new ActionRowBuilder()
.addComponents( .addComponents(
new Discord.MessageButton() new ButtonBuilder()
.setCustomId('list') .setCustomId('list')
.setEmoji(client.messageEmojis["list"]) .setEmoji(client.messageEmojis["list"])
.setStyle('SECONDARY') .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new Discord.MessageButton() new ButtonBuilder()
.setCustomId('prev') .setCustomId('prev')
.setEmoji(client.messageEmojis["prev"]) .setEmoji(client.messageEmojis["prev"])
.setStyle('SECONDARY') .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new Discord.MessageButton() new ButtonBuilder()
.setCustomId('stop') .setCustomId('stop')
.setEmoji(client.messageEmojis["stop"]) .setEmoji(client.messageEmojis["stop"])
.setStyle('SECONDARY') .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new Discord.MessageButton() new ButtonBuilder()
.setCustomId('next') .setCustomId('next')
.setEmoji(client.messageEmojis["next"]) .setEmoji(client.messageEmojis["next"])
.setStyle('SECONDARY') .setStyle(ButtonStyle.Secondary)
) )
.addComponents( .addComponents(
new Discord.MessageButton() new ButtonBuilder()
.setCustomId('statistics') .setCustomId('statistics')
.setEmoji(client.messageEmojis["statistics"]) .setEmoji(client.messageEmojis["statistics"])
.setStyle('SECONDARY') .setStyle(ButtonStyle.Secondary)
); );
if(!radio.message){ if(!radio.message){