Typescript Continuum

This commit is contained in:
Christer Warén
2023-06-05 00:13:15 +03:00
parent 0e62861e33
commit c584e3632e
33 changed files with 152 additions and 94 deletions

View File

@ -1,10 +1,11 @@
import { EmbedBuilder } from "discord.js";
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'bug',
description: 'Report a bug',
category: 'info',
async execute(interaction: any, client: any) {
async execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
let message : any = {};
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
@ -13,7 +14,7 @@ export default {
const embed = new EmbedBuilder()
.setTitle(message.bugTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.setDescription(message.bugDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({

View File

@ -1,10 +1,11 @@
import { EmbedBuilder } from "discord.js";
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'help',
description: 'Get help using bot',
category: 'info',
execute(interaction: any, client: any) {
execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
let message: any = {};
const categories : any= [];
@ -22,7 +23,7 @@ export default {
const embed = new EmbedBuilder()
.setTitle(message.helpTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.setDescription(message.helpDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({

View File

@ -1,15 +1,16 @@
import { EmbedBuilder } from "discord.js";
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'invite',
description: 'Invite Bot',
category: 'info',
execute(interaction: any, client: any) {
execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
let message: any = {};
message.inviteTitle = client.messages.inviteTitle.replace("%client.user.username%", client.user.username);
const embed = new EmbedBuilder()
.setTitle(message.inviteTitle)
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.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({

View File

@ -1,10 +1,11 @@
import { EmbedBuilder } from "discord.js";
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'list',
description: 'List radio stations',
category: 'radio',
execute(interaction: any, client: any) {
execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
let message: any = {};
if(!client.stations) {
@ -15,7 +16,7 @@ export default {
});
}
const radio = client.radio.get(interaction.guild.id);
const radio = client.radio?.get(interaction.guild.id);
if(radio && !client.config.maintenanceMode){
client.funcs.listStations(client, interaction);
@ -29,7 +30,7 @@ export default {
let embed = new EmbedBuilder()
.setTitle(client.messages.listTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.setDescription(stations)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({

View File

@ -1,4 +1,5 @@
import { ActionRowBuilder, EmbedBuilder, StringSelectMenuBuilder } from "discord.js";
import { ActionRowBuilder, ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
import Streamer from "../classes/Streamer";
import commands from "../commands";
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
@ -9,7 +10,7 @@ export default {
name: 'maintenance',
description: 'Bot Maintenance',
category: 'info',
async execute(interaction: any, client: any) {
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
let message: any = {};
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply({
@ -55,12 +56,12 @@ export default {
},
{
emoji: "💤",
label: "Streamer Mode Manual",
label: "Streamer Mode - Manual",
value: "10"
},
{
emoji: "📡",
label: "Streamer Mode Auto",
label: "Streamer Mode - Auto",
value: "11"
}
);
@ -85,7 +86,7 @@ export default {
const embed = new EmbedBuilder()
.setTitle(client.messages.maintenanceTitle)
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.setDescription(options.find((option: { value: any; }) => option.value == action).label)
.setFooter({
text: client.messages.footerText,

View File

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

View File

@ -1,13 +1,14 @@
import { EmbedBuilder } from "discord.js";
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'nowplaying',
description: 'Current Radio Station',
category: 'radio',
async execute(interaction: any, client: any, command: any) {
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: any) {
if (client.funcs.check(client, interaction, command)) {
let message: any = {};
const radio = client.radio.get(interaction.guild.id);
const radio = client.radio?.get(interaction.guild.id);
let date = new Date();
radio.currentTime = date.getTime();
@ -21,7 +22,7 @@ export default {
const embed = new EmbedBuilder()
.setTitle(client.messages.nowplayingTitle)
.setThumbnail((radio.station.logo || "https://cdn.discordapp.com/emojis/" + client.messageEmojis["play"].replace(/[^0-9]+/g, '')))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.setDescription(message.nowplayingDescription)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({

View File

@ -1,5 +1,6 @@
import { ApplicationCommandOptionType, PermissionFlagsBits } from "discord.js";
import { ApplicationCommandOptionType, ButtonInteraction, ChatInputCommandInteraction, PermissionFlagsBits, StringSelectMenuInteraction } from "discord.js";
import { getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
import RadioClient from "../../Client";
export default {
name: "play",
@ -9,7 +10,7 @@ export default {
{ type: ApplicationCommandOptionType.String, name: "query", description: "Select station", required: false}
],
category: "radio",
async execute(interaction: any, client: any) {
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
let message: any = {};
if(client.config.maintenanceMode){

View File

@ -1,8 +1,12 @@
import { ButtonInteraction, ChatInputCommandInteraction, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
import { command } from "../commands";
export default {
name: 'prev',
description: 'Previous Station',
category: 'radio',
async execute(interaction: any, client: any, 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,15 +1,16 @@
import { EmbedBuilder } from "discord.js";
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'statistics',
description: 'Show statistics',
category: 'info',
execute(interaction: any, client: any) {
execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
let message: any = {};
let stations = client.stations;
let currentGuild = client.datastore.getEntry(interaction.guild.id);
let global = client.datastore.getEntry("global");
let currentGuild = client.datastore?.getEntry(interaction.guild.id);
let global = client.datastore?.getEntry("global");
let statistics = "";
if(!client.stations) {
@ -29,7 +30,7 @@ export default {
const embed = new EmbedBuilder()
.setTitle(client.messages.statisticsTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.setDescription(statistics)
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
.setFooter({

View File

@ -1,10 +1,11 @@
import { EmbedBuilder } from "discord.js";
import { ColorResolvable, EmbedBuilder } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'status',
description: 'Bot Status',
category: 'info',
async execute(interaction: any, client: any) {
async execute(interaction: any, client: RadioClient) {
let message: any = {};
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
@ -13,7 +14,7 @@ export default {
const embed = new EmbedBuilder()
.setTitle(message.statusTitle)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.addFields(
{ name: client.messages.statusField1, value: uptime },
{ name: client.messages.statusField2, value: client.config.version },

View File

@ -1,20 +1,21 @@
import { EmbedBuilder } from "discord.js";
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
import RadioClient from "../../Client";
export default {
name: 'stop',
description: 'Stop radio',
category: 'radio',
async execute(interaction: any, client: any, command: any) {
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient, command: any) {
if (client.funcs.check(client, interaction, command)) {
const radio = client.radio.get(interaction.guild.id);
client.statistics.update(client, interaction.guild, radio);
const radio = client.radio?.get(interaction.guild.id);
client.statistics?.update(client, interaction.guild, radio);
radio.connection?.destroy();
client.funcs.logger('Radio', interaction.guild.id + " / " + 'Stop');
const embed = new EmbedBuilder()
.setTitle(client.user.username)
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
.setColor(client.config.embedColor)
.setColor(client.config.embedColor as ColorResolvable)
.addFields({
name: client.messages.nowplayingTitle,
value: "-"
@ -39,7 +40,7 @@ export default {
await radio.message?.delete();
}, 5000);
client.radio.delete(interaction.guild.id);
client.radio?.delete(interaction.guild.id);
interaction.reply({
content: client.messageEmojis["stop"] + client.messages.stop,