More typings to classes, commands, events, funcs

This commit is contained in:
Christer Warén
2023-06-06 08:05:54 +03:00
parent 227e0bcaaa
commit 40cd3a9ec5
14 changed files with 84 additions and 39 deletions

View File

@ -1,5 +1,6 @@
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
import RadioClient from "../../Client";
import { command } from "../commands";
export default {
name: 'help',
@ -12,13 +13,13 @@ export default {
ephemeral: true
});
const categories : any= [];
const categories: string[] = [];
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]).map((x: { name: any; }) => `\`${x.name}\``).join(', ')}\n`;
commands += `**» ${categories[i].toUpperCase()}**\n${client.commands.filter(x => x.category === categories[i]).map((x: command) => `\`${x.name}\``).join(', ')}\n`;
}
const embed = new EmbedBuilder()

View File

@ -1,11 +1,12 @@
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
import { command } from "../commands";
export default {
name: 'nowplaying',
description: 'Current Radio Station',
category: 'radio',
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: any) {
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: command) {
if(client.funcs.check(client, interaction, command)) {
const radio = client.radio?.get(interaction.guild?.id);

View File

@ -1,6 +1,7 @@
import { ApplicationCommandOptionType, ChatInputCommandInteraction, GuildMember, PermissionFlagsBits, StringSelectMenuInteraction } from "discord.js";
import { getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
import RadioClient from "../../Client";
import { radio } from "../classes/Radio"
export default {
name: "play",
@ -116,7 +117,7 @@ export default {
}
let date = new Date();
const construct: any = {
const construct: radio = {
textChannel: interaction.channel,
voiceChannel: voiceChannel,
connection: null,

View File

@ -1,11 +1,11 @@
import { ColorResolvable, EmbedBuilder } from "discord.js";
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'status',
description: 'Bot Status',
category: 'info',
async execute(interaction: any, client: RadioClient) {
async execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
if(!client.user) return interaction.reply({
content: client.messages.emojis["error"] + client.messages.maintenance,

View File

@ -1,11 +1,12 @@
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
import { command } from "../commands";
export default {
name: 'stop',
description: 'Stop radio',
category: 'radio',
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: any) {
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: command) {
if (client.funcs.check(client, interaction, command)) {
const radio = client.radio?.get(interaction.guild?.id);
client.statistics?.update(client, interaction.guild, radio);