Updated commands and interactionCreate event

This commit is contained in:
Christer Warén 2021-09-05 03:17:21 +03:00
parent 16bc2aab52
commit 2d41c7a76b
13 changed files with 32 additions and 16 deletions

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'bug', name: 'bug',
description: 'Report a bug', description: 'Report a bug',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
async execute(interaction, client, Discord, command) { async execute(interaction, client) {
let message = {}; let message = {};
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username); message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'help', name: 'help',
description: 'Get help using bot', description: 'Get help using bot',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(interaction, client, Discord, command) { execute(interaction, client) {
let message = {}; let message = {};
const categories = []; const categories = [];

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'invite', name: 'invite',
description: 'Invite Bot', description: 'Invite Bot',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(interaction, client, Discord, command) { 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 Discord.MessageEmbed()

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'list', name: 'list',
description: 'List radio stations', description: 'List radio stations',
permission: 'none', permission: 'none',
category: 'radio', category: 'radio',
execute(interaction, client, Discord) { execute(interaction, client) {
let message = {}; let message = {};
if(!client.stations) { if(!client.stations) {
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild); message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'maintenance', name: 'maintenance',
description: 'Bot Maintenance', description: 'Bot Maintenance',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(interaction, client, Discord, command) { execute(interaction, client) {
let message = {}; let message = {};
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply(client.messageEmojis["error"] + client.messages.notAllowed); if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply(client.messageEmojis["error"] + client.messages.notAllowed);

View File

@ -3,7 +3,7 @@ module.exports = {
description: 'Next Station', description: 'Next Station',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
async execute(interaction, client, Discord) { async execute(interaction, client) {
let message = {}; let message = {};
const radio = client.radio.get(interaction.guild.id); const radio = client.radio.get(interaction.guild.id);
if (!radio) return interaction.reply({ if (!radio) return interaction.reply({

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'nowplaying', name: 'nowplaying',
description: 'Current Radio Station', description: 'Current Radio Station',
permission: 'none', permission: 'none',
category: 'radio', category: 'radio',
async execute(interaction, client, Discord) { async execute(interaction, client) {
let message = {}; let message = {};
const radio = client.radio.get(interaction.guild.id); const radio = client.radio.get(interaction.guild.id);
if (!radio) return interaction.reply({ if (!radio) return interaction.reply({

View File

@ -13,7 +13,7 @@ module.exports = {
], ],
permission: "none", permission: "none",
category: "radio", category: "radio",
async execute(interaction, client, Discord, command) { async execute(interaction, client) {
let message = {}; let message = {};
let query = interaction.options?.getString("query") ?? interaction.values?.[0]; let query = interaction.options?.getString("query") ?? interaction.values?.[0];
if(!query){ if(!query){

View File

@ -3,7 +3,7 @@ module.exports = {
description: 'Previous Station', description: 'Previous Station',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
async execute(interaction, client, Discord) { async execute(interaction, client) {
let message = {}; let message = {};
const radio = client.radio.get(interaction.guild.id); const radio = client.radio.get(interaction.guild.id);
if (!radio) return interaction.reply({ if (!radio) return interaction.reply({

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'statistics', name: 'statistics',
description: 'Show statistics', description: 'Show statistics',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
execute(interaction, client, Discord) { execute(interaction, client) {
let message = {}; let message = {};
let stations = client.stations; let stations = client.stations;
let currentGuild = client.datastore.getEntry(interaction.guild.id); let currentGuild = client.datastore.getEntry(interaction.guild.id);

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'status', name: 'status',
description: 'Bot Status', description: 'Bot Status',
permission: 'none', permission: 'none',
category: 'info', category: 'info',
async execute(interaction, client, Discord) { async execute(interaction, client) {
let message = {}; let message = {};
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username); message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);

View File

@ -1,9 +1,11 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'stop', name: 'stop',
description: 'Stop radio', description: 'Stop radio',
permission: 'none', permission: 'none',
category: 'radio', category: 'radio',
async execute(interaction, client, Discord) { async execute(interaction, client) {
const radio = client.radio.get(interaction.guild.id); const radio = client.radio.get(interaction.guild.id);
if (client.funcs.check(client, interaction, command)) { if (client.funcs.check(client, interaction, command)) {
client.funcs.statisticsUpdate(client, interaction.guild, radio); client.funcs.statisticsUpdate(client, interaction.guild, radio);

View File

@ -1,5 +1,3 @@
import Discord from "discord.js";
module.exports = { module.exports = {
name: 'interactionCreate', name: 'interactionCreate',
async execute(client, interaction) { async execute(client, interaction) {
@ -13,7 +11,7 @@ module.exports = {
if (!command) return; if (!command) return;
try { try {
command.execute(interaction, client, Discord); command.execute(interaction, client);
} catch (error) { } catch (error) {
interaction.reply({ interaction.reply({
content: client.messages.runningCommandFailed, content: client.messages.runningCommandFailed,
@ -27,7 +25,7 @@ module.exports = {
if (!command) return; if (!command) return;
try { try {
command.execute(interaction, client, Discord); command.execute(interaction, client);
} catch (error) { } catch (error) {
interaction.reply({ interaction.reply({
content: client.messages.runningCommandFailed, content: client.messages.runningCommandFailed,