mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 17:03:38 +00:00
TypeScript types
This commit is contained in:
@ -4,8 +4,8 @@ export default {
|
||||
name: 'bug',
|
||||
description: 'Report a bug',
|
||||
category: 'info',
|
||||
async execute(interaction, client) {
|
||||
let message = {};
|
||||
async execute(interaction: any, client: any) {
|
||||
let message : any = {};
|
||||
|
||||
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
|
||||
message.bugDescription = client.messages.bugDescription.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
|
@ -4,16 +4,16 @@ export default {
|
||||
name: 'help',
|
||||
description: 'Get help using bot',
|
||||
category: 'info',
|
||||
execute(interaction, client) {
|
||||
let message = {};
|
||||
execute(interaction: any, client: any) {
|
||||
let message: any = {};
|
||||
|
||||
const categories = [];
|
||||
const categories : any= [];
|
||||
for (let i = 0; i < client.commands.size; i++) {
|
||||
if (!categories.includes([...client.commands.values()][i].category)) categories.push([...client.commands.values()][i].category);
|
||||
}
|
||||
let commands = '';
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map(x => `\`${x.name}\``).join(', ')}\n`;
|
||||
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i] && !x.omitFromHelp).map((x: { name: any; }) => `\`${x.name}\``).join(', ')}\n`;
|
||||
}
|
||||
|
||||
message.helpTitle = client.messages.helpTitle.replace("%client.user.username%", client.user.username);
|
||||
|
@ -4,8 +4,8 @@ export default {
|
||||
name: 'invite',
|
||||
description: 'Invite Bot',
|
||||
category: 'info',
|
||||
execute(interaction, client) {
|
||||
let message = {};
|
||||
execute(interaction: any, client: any) {
|
||||
let message: any = {};
|
||||
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(message.inviteTitle)
|
||||
|
@ -4,8 +4,8 @@ export default {
|
||||
name: 'list',
|
||||
description: 'List radio stations',
|
||||
category: 'radio',
|
||||
execute(interaction, client) {
|
||||
let message = {};
|
||||
execute(interaction: any, client: any) {
|
||||
let message: any = {};
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
@ -20,7 +20,7 @@ export default {
|
||||
if(radio && !client.config.maintenanceMode){
|
||||
client.funcs.listStations(client, interaction);
|
||||
} else {
|
||||
let stations = `${client.stations.map(s => `**#** ${s.name}`).join('\n')}`
|
||||
let stations = `${client.stations.map((s: { name: any; }) => `**#** ${s.name}`).join('\n')}`
|
||||
const hashs = stations.split('**#**').length;
|
||||
for (let i = 0; i < hashs; i++) {
|
||||
stations = stations.replace('**#**', `**${i + 1}.**`);
|
||||
|
@ -1,21 +1,21 @@
|
||||
import { ActionRowBuilder, EmbedBuilder, StringSelectMenuBuilder } from "discord.js";
|
||||
import Streamer from "../classes/Streamer";
|
||||
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
||||
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
const fetch = (...args: any) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
|
||||
|
||||
export default {
|
||||
name: 'maintenance',
|
||||
description: 'Bot Maintenance',
|
||||
category: 'info',
|
||||
async execute(interaction, client) {
|
||||
let message = {};
|
||||
async execute(interaction: any, client: any) {
|
||||
let message: any = {};
|
||||
|
||||
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply({
|
||||
content: client.messageEmojis["error"] + client.messages.notAllowed,
|
||||
ephemeral: true
|
||||
});
|
||||
let action = interaction.options?.getNumber("action") ?? interaction.values?.[0];
|
||||
const options = new Array(
|
||||
const options: any = new Array(
|
||||
{
|
||||
emoji: "🌀",
|
||||
label: "Restart Bot",
|
||||
@ -79,12 +79,12 @@ export default {
|
||||
});
|
||||
}
|
||||
|
||||
client.funcs.logger('Maintenance', options.find(option => option.value == action).label);
|
||||
client.funcs.logger('Maintenance', options.find((option: { value: any; }) => option.value == action).label);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(options.find(option => option.value == action).label)
|
||||
.setDescription(options.find((option: { value: any; }) => option.value == action).label)
|
||||
.setFooter({
|
||||
text: client.messages.footerText,
|
||||
iconURL: "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, '')
|
||||
@ -163,7 +163,7 @@ export default {
|
||||
}
|
||||
|
||||
if(!client.config.maintenanceMode){
|
||||
clearInterval();
|
||||
clearInterval(undefined);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
@ -187,7 +187,7 @@ export default {
|
||||
}
|
||||
|
||||
if(!client.config.maintenanceMode){
|
||||
clearInterval();
|
||||
clearInterval(undefined);
|
||||
}
|
||||
}, 500);
|
||||
|
||||
|
@ -2,11 +2,11 @@ export default {
|
||||
name: 'next',
|
||||
description: 'Next Station',
|
||||
category: 'radio',
|
||||
async execute(interaction, client, command) {
|
||||
async execute(interaction: any, client: any, command: any) {
|
||||
if (client.funcs.check(client, interaction, command)) {
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
|
||||
let index = client.stations.findIndex(station => station.name == radio.station.name) + 1;
|
||||
let index = client.stations.findIndex((station: { name: any; }) => station.name == radio.station.name) + 1;
|
||||
if(index == client.stations.length) index = 0;
|
||||
|
||||
let station = client.stations[index];
|
||||
|
@ -4,9 +4,9 @@ export default {
|
||||
name: 'nowplaying',
|
||||
description: 'Current Radio Station',
|
||||
category: 'radio',
|
||||
async execute(interaction, client, command) {
|
||||
async execute(interaction: any, client: any, command: any) {
|
||||
if (client.funcs.check(client, interaction, command)) {
|
||||
let message = {};
|
||||
let message: any = {};
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
|
||||
let date = new Date();
|
||||
|
@ -12,8 +12,8 @@ export default {
|
||||
{ type: "STRING", name: "query", description: "Select station", required: false}
|
||||
],
|
||||
category: "radio",
|
||||
async execute(interaction, client) {
|
||||
let message = {};
|
||||
async execute(interaction: any, client: any) {
|
||||
let message: any = {};
|
||||
|
||||
if(client.config.maintenanceMode){
|
||||
return interaction.reply({
|
||||
@ -119,7 +119,8 @@ export default {
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
message: null,
|
||||
station: station
|
||||
station: station,
|
||||
startTime: number
|
||||
};
|
||||
client.radio.set(interaction.guild.id, construct);
|
||||
|
||||
|
@ -2,11 +2,11 @@ export default {
|
||||
name: 'prev',
|
||||
description: 'Previous Station',
|
||||
category: 'radio',
|
||||
async execute(interaction, client, command) {
|
||||
async execute(interaction: any, client: any, command: any) {
|
||||
if (client.funcs.check(client, interaction, command)) {
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
|
||||
let index = client.stations.findIndex(station => station.name == radio.station.name) - 1;
|
||||
let index = client.stations.findIndex((station: { name: any; }) => station.name == radio.station.name) - 1;
|
||||
if(index == -1) index = client.stations.length - 1;
|
||||
|
||||
let station = client.stations[index];
|
||||
|
@ -5,8 +5,8 @@ export default {
|
||||
name: 'statistics',
|
||||
description: 'Show statistics',
|
||||
category: 'info',
|
||||
execute(interaction, client) {
|
||||
let message = {};
|
||||
execute(interaction: any, client: any) {
|
||||
let message: any = {};
|
||||
let stations = client.stations;
|
||||
let currentGuild = client.datastore.getEntry(interaction.guild.id);
|
||||
let global = client.datastore.getEntry("global");
|
||||
|
@ -4,8 +4,8 @@ export default {
|
||||
name: 'status',
|
||||
description: 'Bot Status',
|
||||
category: 'info',
|
||||
async execute(interaction, client) {
|
||||
let message = {};
|
||||
async execute(interaction: any, client: any) {
|
||||
let message: any = {};
|
||||
|
||||
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
|
||||
let uptime = client.funcs.msToTime(client.uptime);
|
||||
|
@ -4,7 +4,7 @@ export default {
|
||||
name: 'stop',
|
||||
description: 'Stop radio',
|
||||
category: 'radio',
|
||||
async execute(interaction, client, command) {
|
||||
async execute(interaction: any, client: any, command: any) {
|
||||
if (client.funcs.check(client, interaction, command)) {
|
||||
const radio = client.radio.get(interaction.guild.id);
|
||||
client.statistics.update(client, interaction.guild, radio);
|
||||
|
Reference in New Issue
Block a user