Merge branch 'master' into fix-33

This commit is contained in:
Christer Warén
2021-09-03 05:27:59 +03:00
17 changed files with 136 additions and 110 deletions

View File

@ -16,6 +16,7 @@ module.exports = {
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription(message.bugDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -25,6 +25,7 @@ module.exports = {
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription(message.helpDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -12,6 +12,7 @@ module.exports = {
.setTitle(message.inviteTitle)
.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
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -70,6 +70,7 @@ module.exports = {
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription(stations)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -41,6 +41,7 @@ module.exports = {
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -25,9 +25,10 @@ module.exports = {
const embed = new Discord.MessageEmbed()
.setTitle(client.messages.nowplayingTitle)
.setThumbnail("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)
.setDescription(message.nowplayingDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -222,9 +222,10 @@ async function play(interaction, guild, client, url, Discord) {
const embed = new Discord.MessageEmbed()
.setTitle(client.user.username)
.setThumbnail("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)
.addField(client.messages.nowplayingTitle, message.nowplayingDescription, true)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
const buttons = new Discord.MessageActionRow()

View File

@ -33,6 +33,7 @@ module.exports = {
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription(statistics)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -20,6 +20,7 @@ module.exports = {
.addField(client.messages.statusField3, uptime, true)
.addField(client.messages.statusField4, client.config.version, true)
.addField(client.messages.statusField5, client.config.hostedBy, true)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
interaction.reply({

View File

@ -18,6 +18,7 @@ module.exports = {
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.addField(client.messages.nowplayingTitle, "-", true)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
if(!radio.message){

View File

@ -1,8 +1,16 @@
import Discord from "discord.js";
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token, version } = require('../../config.js');
module.exports = {
name: 'SIGINT',
async execute(client) {
client.user.setStatus('dnd');
console.log("\n");
client.funcs.logger("Bot", "Closing");
console.log("\n");
setTimeout(async function () {
let message = {};
@ -16,8 +24,8 @@ module.exports = {
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
if (currentRadio) {
client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio);
client.funcs.saveState(client, currentRadio.guild, currentRadio);
await client.funcs.statisticsUpdate(client, currentRadio.guild, currentRadio);
await client.funcs.saveState(client, currentRadio.guild, currentRadio);
currentRadio.connection?.destroy();
currentRadio.audioPlayer?.stop();
currentRadio.message?.delete();
@ -27,11 +35,25 @@ module.exports = {
radio = currentRadios.next();
}
console.log("\n");
client.funcs.logger("Bot", "Closing");
console.log("\n");
const rest = new REST({ version: '9' }).setToken(token);
if(version.includes("-dev")){
await rest.put(
Routes.applicationCommands(client.user.id),
{ body: [] },
);
client.user.setStatus('dnd');
let guilds = await client.guilds.fetch();
guilds.forEach(async guild => {
try {
await rest.put(
Routes.applicationGuildCommands(client.user.id, guild.id),
{ body: [] },
);
} catch (DiscordAPIError) {
}
});
}
setInterval(() => {
if(radio.done){

View File

@ -1,9 +1,9 @@
import Discord from "discord.js";
module.exports = {
name: 'messageCreate',
async execute(client, msg) {
async execute(client, message) {
if (msg.author.bot || !msg.guild) return;
if (message.author.bot || !message.guild) return;
let prefix = "rx$";
if(client.user.username == "RadioX"){
prefix = "rx>";
@ -11,40 +11,41 @@ module.exports = {
prefix = "rx-";
} else if (client.user.username == "RadioX Dev"){
prefix = "rx$";
} else if(msg.mentions.members.first() && msg.mentions.members.first().user.id === client.user.id){
} else if(message.mentions.members.first() && message.mentions.members.first().user.id === client.user.id){
prefix = "<@!" + client.user.id + "> ";
} else {
return;
}
const args = msg.content.slice(prefix.length).split(' ');
if (!msg.content.startsWith(prefix)) return;
const args = message.content.slice(prefix.length).split(' ');
if (!message.content.startsWith(prefix)) return;
if (!args[0]) return;
const commandName = args[0].toLowerCase();
if (commandName === 'none') return;
const command = client.commands.get(commandName) || client.commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName)) || client.commandAliases.get(commandName);
if (!command && msg.content !== `${prefix}`) return;
const permissions = msg.channel.permissionsFor(msg.client.user);
if (!permissions.has('EMBED_LINKS')) return msg.channel.send(client.messages.noPermsEmbed);
if (!command && message.content !== `${prefix}`) return;
const permissions = message.channel.permissionsFor(message.client.user);
if (!permissions.has('EMBED_LINKS')) return message.channel.send(client.messages.noPermsEmbed);
try {
let message = {};
let newMessage = {};
message.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()
.setTitle(message.messageCommandsDeprecatedTitle)
.setTitle(newMessage.messageCommandsDeprecatedTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setDescription(client.messages.messageCommandsDeprecatedDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
msg.channel.send({ embeds: [embed] });
let msg = await message.channel.send({ embeds: [embed] });
setTimeout(function() {
msg.delete();
}, 30000);
} catch (error) {
msg.reply({
message.reply({
content: client.messages.runningCommandFailed,
ephemeral: true
});

View File

@ -11,6 +11,14 @@ module.exports = {
client.funcs.logger('Datastore', 'Initialize');
client.datastore = new Datastore();
client.funcs.logger('Datastore');
client.datastore.map.forEach(datastore => {
console.log("- " + datastore.guild.id + " / " + datastore.guild.name);
});
console.log("\n");
client.funcs.logger('Datastore', 'Ready');
/*DEVELOPERS*/
client.funcs.logger('Developers');
@ -70,7 +78,7 @@ module.exports = {
client.funcs.logger('Guilds');
let guilds = await client.guilds.fetch();
guilds.forEach(guild => {
console.log("- " + guild.id + ": " + guild.name);
console.log("- " + guild.id + " / " + guild.name);
});
console.log("\n");

View File

@ -5,13 +5,13 @@ module.exports = {
runningCommandFailed: "Running this command failed!",
noPermsEmbed: "I cannot send embeds (Embed links).",
bugTitle: "Found a bug with %client.user.username%?",
bugDescription: "Join the support server \n %client.config.supportGuild%",
bugDescription: "Join the support server" + "\n" + "%client.config.supportGuild%",
helpTitle: "%client.user.username% help:",
helpDescription: "%commands%",
inviteTitle: "Invite %client.user.username% to your Discord server!",
listTitle: "Radio Stations",
nowplayingTitle: "Now Playing",
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %client.funcs.msToTime(completed)%",
nowplayingDescription: "**%radio.station.name%**" + "\n" + "Owner: %radio.station.owner%" + "\n" + "%client.funcs.msToTime(completed)%",
noVoiceChannel: "You need to be in a voice channel to play radio!",
noQuery: "You need to use a number or search for a supported station!",
noPermsConnect: "I cannot connect to your voice channel.",
@ -36,5 +36,5 @@ module.exports = {
statusField5: "Hosted by",
errorStationURL: "Station can't be URL",
messageCommandsDeprecatedTitle: "%client.user.username%",
messageCommandsDeprecatedDescription: "We recommend you to reauthorize our bot by clicking the invite link down below, because Discord is planning to remove message content from verified bots [Read More](https://support-dev.discord.com/hc/en-us/articles/4404772028055) \n\n **Invite Bot** \n https://wgi.fi/radiox_invite \n\n This bot now supports slash commands, you should start using them instead. Type / into the message box and select the bot you wish to use. Remember to be careful as there are a few bugs here and there on Discord. \n\n We will remove this deprecation message in March of 2022 when RadioX 1.0.0 is released."
messageCommandsDeprecatedDescription: "We recommend you to reauthorize our bot by clicking the invite link down below, because Discord is planning to remove message content from verified bots [Read More](https://support-dev.discord.com/hc/en-us/articles/4404772028055)" + "\n\n" + "**Invite Bot**" + "\n" + "https://wgi.fi/radiox_invite" + "\n\n" + "This bot now supports slash commands, you should start using them instead. Type / into the message box and select the bot you wish to use. Remember to be careful as there are a few bugs here and there on Discord." + "\n\n" + "We will remove this deprecation message in March of 2022 when RadioX 1.0.0 is released."
};

View File

@ -8,6 +8,8 @@ const {
module.exports = {
async execute(client, guilds) {
if(!client.stations) return;
guilds.forEach(async guild => {
let state = client.funcs.loadState(client, guild);
if(!state) return;
@ -94,9 +96,10 @@ async function play(interaction, guild, client, url, Discord) {
const embed = new Discord.MessageEmbed()
.setTitle(client.user.username)
.setThumbnail("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)
.addField(client.messages.nowplayingTitle, message.nowplayingDescription, true)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
const buttons = new Discord.MessageActionRow()