mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-11-10 05:40:24 +00:00
Typescript Continuum
This commit is contained in:
parent
0e62861e33
commit
c584e3632e
@ -4,7 +4,7 @@ import Radio from "./client/classes/Radio";
|
|||||||
import Stations from "./client/classes/Stations";
|
import Stations from "./client/classes/Stations";
|
||||||
import Streamer from "./client/classes/Streamer";
|
import Streamer from "./client/classes/Streamer";
|
||||||
import Statistics from "./client/classes/Statistics";
|
import Statistics from "./client/classes/Statistics";
|
||||||
import { command } from "./client/utils/typings";
|
import { command } from "./client/commands";
|
||||||
import config from "./config";
|
import config from "./config";
|
||||||
import messages from "./client/messages";
|
import messages from "./client/messages";
|
||||||
import events from "./client/events"
|
import events from "./client/events"
|
||||||
@ -28,6 +28,8 @@ export default class RadioClient extends Client {
|
|||||||
public streamer: Streamer | null;
|
public streamer: Streamer | null;
|
||||||
public statistics: Statistics | null;
|
public statistics: Statistics | null;
|
||||||
public radio: Radio | null;
|
public radio: Radio | null;
|
||||||
|
public messageEmojis: any | null;
|
||||||
|
public developers: string | undefined;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super({
|
super({
|
||||||
@ -39,6 +41,7 @@ export default class RadioClient extends Client {
|
|||||||
this.streamer = null;
|
this.streamer = null;
|
||||||
this.statistics = null;
|
this.statistics = null;
|
||||||
this.radio = null;
|
this.radio = null;
|
||||||
|
this.messageEmojis = null;
|
||||||
|
|
||||||
this.events = events;
|
this.events = events;
|
||||||
this.funcs = funcs;
|
this.funcs = funcs;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
|
import { getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
|
||||||
|
import { VoiceChannel } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default class Radio extends Map {
|
export default class Radio extends Map {
|
||||||
|
|
||||||
@ -6,7 +8,7 @@ export default class Radio extends Map {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
save(client: any) {
|
save(client: RadioClient) {
|
||||||
let currentRadios = this.keys();
|
let currentRadios = this.keys();
|
||||||
let radio = currentRadios.next();
|
let radio = currentRadios.next();
|
||||||
|
|
||||||
@ -14,9 +16,9 @@ export default class Radio extends Map {
|
|||||||
let currentRadio = this.get(radio.value);
|
let currentRadio = this.get(radio.value);
|
||||||
|
|
||||||
if (currentRadio) {
|
if (currentRadio) {
|
||||||
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
currentRadio.guild = client.datastore?.getEntry(radio.value).guild;
|
||||||
|
|
||||||
client.statistics.update(client, currentRadio.guild, currentRadio);
|
client.statistics?.update(client, currentRadio.guild, currentRadio);
|
||||||
client.funcs.saveState(client, currentRadio.guild, currentRadio);
|
client.funcs.saveState(client, currentRadio.guild, currentRadio);
|
||||||
currentRadio.connection?.destroy();
|
currentRadio.connection?.destroy();
|
||||||
currentRadio.message?.delete();
|
currentRadio.message?.delete();
|
||||||
@ -27,7 +29,7 @@ export default class Radio extends Map {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
restore(client: any, guilds: any) {
|
restore(client: RadioClient, guilds: any) {
|
||||||
if(!client.stations) return;
|
if(!client.stations) return;
|
||||||
|
|
||||||
guilds.forEach(async (guild: { id: any; }) => {
|
guilds.forEach(async (guild: { id: any; }) => {
|
||||||
@ -39,7 +41,7 @@ export default class Radio extends Map {
|
|||||||
if(voiceChannel.members.filter((member: { user: { bot: any; }; }) => !member.user.bot).size === 0) return;
|
if(voiceChannel.members.filter((member: { user: { bot: any; }; }) => !member.user.bot).size === 0) return;
|
||||||
|
|
||||||
|
|
||||||
const sstation = await client.stations.search(state.station.name, "direct");
|
const sstation = await client.stations?.search(state.station.name, "direct");
|
||||||
let station = sstation;
|
let station = sstation;
|
||||||
|
|
||||||
if(!station) return;
|
if(!station) return;
|
||||||
@ -65,7 +67,7 @@ export default class Radio extends Map {
|
|||||||
construct.connection = connection;
|
construct.connection = connection;
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
construct.startTime = date.getTime();
|
construct.startTime = date.getTime();
|
||||||
client.datastore.checkEntry(guild.id);
|
client.datastore?.checkEntry(guild.id);
|
||||||
client.funcs.play(client, null, guild, station);
|
client.funcs.play(client, null, guild, station);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Guild } from "discord.js";
|
import { Guild } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default class Statistics {
|
export default class Statistics {
|
||||||
map: any;
|
map: any;
|
||||||
@ -7,17 +8,17 @@ export default class Statistics {
|
|||||||
this.map = new Map();
|
this.map = new Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
update(client: any, guild: Guild, radio: any) {
|
update(client: RadioClient, guild: Guild, radio: any) {
|
||||||
|
|
||||||
client.datastore.checkEntry(guild.id);
|
client.datastore?.checkEntry(guild.id);
|
||||||
|
|
||||||
radio.datastore = client.datastore.getEntry(guild.id);
|
radio.datastore = client.datastore?.getEntry(guild.id);
|
||||||
|
|
||||||
if(!radio.datastore.statistics[radio.station.name]){
|
if(!radio.datastore.statistics[radio.station.name]){
|
||||||
radio.datastore.statistics[radio.station.name] = {};
|
radio.datastore.statistics[radio.station.name] = {};
|
||||||
radio.datastore.statistics[radio.station.name].time = 0;
|
radio.datastore.statistics[radio.station.name].time = 0;
|
||||||
radio.datastore.statistics[radio.station.name].used = 0;
|
radio.datastore.statistics[radio.station.name].used = 0;
|
||||||
client.datastore.updateEntry(guild, radio.datastore);
|
client.datastore?.updateEntry(guild, radio.datastore);
|
||||||
}
|
}
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
@ -26,13 +27,13 @@ export default class Statistics {
|
|||||||
radio.datastore.statistics[radio.station.name].time = parseInt(radio.datastore.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
radio.datastore.statistics[radio.station.name].time = parseInt(radio.datastore.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||||
|
|
||||||
radio.datastore.statistics[radio.station.name].used = parseInt(radio.datastore.statistics[radio.station.name].used)+1;
|
radio.datastore.statistics[radio.station.name].used = parseInt(radio.datastore.statistics[radio.station.name].used)+1;
|
||||||
client.datastore.updateEntry(guild, radio.datastore);
|
client.datastore?.updateEntry(guild, radio.datastore);
|
||||||
this.calculateGlobal(client);
|
this.calculateGlobal(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateGlobal(client: any){
|
calculateGlobal(client: RadioClient){
|
||||||
if(!client.stations) return;
|
if(!client.stations) return;
|
||||||
if(!client.datastore.map) return;
|
if(!client.datastore?.map) return;
|
||||||
|
|
||||||
let guilds = client.datastore.map.keys();
|
let guilds = client.datastore.map.keys();
|
||||||
let stations = client.stations;
|
let stations = client.stations;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import logger from "../funcs/logger";
|
import logger from "../funcs/logger";
|
||||||
import { createAudioPlayer, createAudioResource, NoSubscriberBehavior } from "@discordjs/voice";
|
import { createAudioPlayer, createAudioResource, NoSubscriberBehavior } from "@discordjs/voice";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default class Streamer {
|
export default class Streamer {
|
||||||
map: any;
|
map: any;
|
||||||
@ -12,7 +13,7 @@ export default class Streamer {
|
|||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
init(client: any){
|
init(client: RadioClient){
|
||||||
if(!client.config.streamerMode) return;
|
if(!client.config.streamerMode) return;
|
||||||
|
|
||||||
switch(client.config.streamerMode){
|
switch(client.config.streamerMode){
|
||||||
@ -35,12 +36,12 @@ export default class Streamer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(client: any){
|
refresh(client: RadioClient){
|
||||||
this.init(client);
|
this.init(client);
|
||||||
|
|
||||||
let streamers = this.map.keys();
|
let streamers = this.map.keys();
|
||||||
streamers.forEach((streamer: any) => {
|
streamers.forEach((streamer: any) => {
|
||||||
if(client.stations.findIndex((station: { name: any; }) => station.name == streamer) == -1){
|
if(client.stations?.findIndex((station: { name: any; }) => station.name == streamer) == -1){
|
||||||
this.stop(streamer);
|
this.stop(streamer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -111,7 +112,7 @@ export default class Streamer {
|
|||||||
return audioPlayer;
|
return audioPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
leave(client: any) {
|
leave(client: RadioClient) {
|
||||||
if(!client.stations) return;
|
if(!client.stations) return;
|
||||||
client.stations.forEach((station: any) => {
|
client.stations.forEach((station: any) => {
|
||||||
this.stop(station);
|
this.stop(station);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Snowflake } from "discord.js";
|
import { Snowflake } from "discord.js";
|
||||||
|
import RadioClient from "../Client";
|
||||||
import bug from "./commands/bug";
|
import bug from "./commands/bug";
|
||||||
import help from "./commands/help";
|
import help from "./commands/help";
|
||||||
import invite from "./commands/invite";
|
import invite from "./commands/invite";
|
||||||
@ -12,20 +13,30 @@ import statistics from "./commands/statistics";
|
|||||||
import status from "./commands/status";
|
import status from "./commands/status";
|
||||||
import stop from "./commands/stop";
|
import stop from "./commands/stop";
|
||||||
|
|
||||||
|
export interface command {
|
||||||
|
name: string,
|
||||||
|
description: string,
|
||||||
|
category: string,
|
||||||
|
options?: [],
|
||||||
|
execute: any
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
async execute(client: any) {
|
async execute(client: RadioClient) {
|
||||||
const commands : any = [ bug, help, invite, list, maintenance, next, nowplaying, play, prev, statistics, status, stop ];
|
const commands : command[] = [ bug, help, invite, list, maintenance, next, nowplaying, play, prev, statistics, status, stop ];
|
||||||
|
|
||||||
for(const command of commands){
|
for(const command of commands){
|
||||||
client.commands.set(command.name, command);
|
client.commands.set(command.name, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!client.application) return;
|
||||||
client.funcs.logger('Application Commands', 'Started refreshing application (/) commands.');
|
client.funcs.logger('Application Commands', 'Started refreshing application (/) commands.');
|
||||||
if(client.config.devMode){
|
if(client.config.devMode){
|
||||||
client.application.commands.set([]);
|
client.application.commands.set([]);
|
||||||
for(const command of commands){
|
for(const command of commands){
|
||||||
let guilds = await client.guilds.fetch();
|
let guilds = await client.guilds.fetch();
|
||||||
guilds.forEach(async (guild: { id: Snowflake; name: string; }) => {
|
guilds.forEach(async (guild: { id: Snowflake; name: string; }) => {
|
||||||
|
if(!client.application) return;
|
||||||
client.application.commands.create({
|
client.application.commands.create({
|
||||||
name: command.name,
|
name: command.name,
|
||||||
description: command.description,
|
description: command.description,
|
||||||
@ -47,6 +58,7 @@ export default {
|
|||||||
|
|
||||||
let guilds = await client.guilds.fetch();
|
let guilds = await client.guilds.fetch();
|
||||||
guilds.forEach(async (guild: { id: Snowflake; }) => {
|
guilds.forEach(async (guild: { id: Snowflake; }) => {
|
||||||
|
if(!client.application) return;
|
||||||
client.application.commands.set([], guild.id);
|
client.application.commands.set([], guild.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'bug',
|
name: 'bug',
|
||||||
description: 'Report a bug',
|
description: 'Report a bug',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
async execute(interaction: any, client: any) {
|
async execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
|
||||||
let message : any = {};
|
let message : any = {};
|
||||||
|
|
||||||
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
|
message.bugTitle = client.messages.bugTitle.replace("%client.user.username%", client.user.username);
|
||||||
@ -13,7 +14,7 @@ export default {
|
|||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(message.bugTitle)
|
.setTitle(message.bugTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
.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)
|
.setDescription(message.bugDescription)
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter({
|
.setFooter({
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'help',
|
name: 'help',
|
||||||
description: 'Get help using bot',
|
description: 'Get help using bot',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(interaction: any, client: any) {
|
execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
|
|
||||||
const categories : any= [];
|
const categories : any= [];
|
||||||
@ -22,7 +23,7 @@ export default {
|
|||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(message.helpTitle)
|
.setTitle(message.helpTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
.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)
|
.setDescription(message.helpDescription)
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter({
|
.setFooter({
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ChatInputCommandInteraction, ColorResolvable, EmbedBuilder } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'invite',
|
name: 'invite',
|
||||||
description: 'Invite Bot',
|
description: 'Invite Bot',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(interaction: any, client: any) {
|
execute(interaction: ChatInputCommandInteraction, client: RadioClient) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
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 EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(message.inviteTitle)
|
.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
|
.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')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter({
|
.setFooter({
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'list',
|
name: 'list',
|
||||||
description: 'List radio stations',
|
description: 'List radio stations',
|
||||||
category: 'radio',
|
category: 'radio',
|
||||||
execute(interaction: any, client: any) {
|
execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
|
|
||||||
if(!client.stations) {
|
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){
|
if(radio && !client.config.maintenanceMode){
|
||||||
client.funcs.listStations(client, interaction);
|
client.funcs.listStations(client, interaction);
|
||||||
@ -29,7 +30,7 @@ export default {
|
|||||||
let embed = new EmbedBuilder()
|
let embed = new EmbedBuilder()
|
||||||
.setTitle(client.messages.listTitle)
|
.setTitle(client.messages.listTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["list"].replace(/[^0-9]+/g, ''))
|
.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)
|
.setDescription(stations)
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter({
|
.setFooter({
|
||||||
|
@ -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 Streamer from "../classes/Streamer";
|
||||||
import commands from "../commands";
|
import commands from "../commands";
|
||||||
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
|
||||||
@ -9,7 +10,7 @@ export default {
|
|||||||
name: 'maintenance',
|
name: 'maintenance',
|
||||||
description: 'Bot Maintenance',
|
description: 'Bot Maintenance',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
async execute(interaction: any, client: any) {
|
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
|
|
||||||
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply({
|
if(!client.funcs.isDev(client.config.devId, interaction.user.id)) return interaction.reply({
|
||||||
@ -55,12 +56,12 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
emoji: "💤",
|
emoji: "💤",
|
||||||
label: "Streamer Mode – Manual",
|
label: "Streamer Mode - Manual",
|
||||||
value: "10"
|
value: "10"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
emoji: "📡",
|
emoji: "📡",
|
||||||
label: "Streamer Mode – Auto",
|
label: "Streamer Mode - Auto",
|
||||||
value: "11"
|
value: "11"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -85,7 +86,7 @@ export default {
|
|||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(client.messages.maintenanceTitle)
|
.setTitle(client.messages.maintenanceTitle)
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor as ColorResolvable)
|
||||||
.setDescription(options.find((option: { value: any; }) => option.value == action).label)
|
.setDescription(options.find((option: { value: any; }) => option.value == action).label)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: client.messages.footerText,
|
text: client.messages.footerText,
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
|
import { ButtonInteraction, ChatInputCommandInteraction, StringSelectMenuInteraction } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'next',
|
name: 'next',
|
||||||
description: 'Next Station',
|
description: 'Next Station',
|
||||||
category: '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)) {
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'nowplaying',
|
name: 'nowplaying',
|
||||||
description: 'Current Radio Station',
|
description: 'Current Radio Station',
|
||||||
category: '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)) {
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio?.get(interaction.guild.id);
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
radio.currentTime = date.getTime();
|
radio.currentTime = date.getTime();
|
||||||
@ -21,7 +22,7 @@ export default {
|
|||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(client.messages.nowplayingTitle)
|
.setTitle(client.messages.nowplayingTitle)
|
||||||
.setThumbnail((radio.station.logo || "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)
|
.setColor(client.config.embedColor as ColorResolvable)
|
||||||
.setDescription(message.nowplayingDescription)
|
.setDescription(message.nowplayingDescription)
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter({
|
.setFooter({
|
||||||
|
@ -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 { getVoiceConnection, joinVoiceChannel } from "@discordjs/voice";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "play",
|
name: "play",
|
||||||
@ -9,7 +10,7 @@ export default {
|
|||||||
{ type: ApplicationCommandOptionType.String, name: "query", description: "Select station", required: false}
|
{ type: ApplicationCommandOptionType.String, name: "query", description: "Select station", required: false}
|
||||||
],
|
],
|
||||||
category: "radio",
|
category: "radio",
|
||||||
async execute(interaction: any, client: any) {
|
async execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
|
|
||||||
if(client.config.maintenanceMode){
|
if(client.config.maintenanceMode){
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
import { ButtonInteraction, ChatInputCommandInteraction, StringSelectMenuInteraction } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
import { command } from "../commands";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'prev',
|
name: 'prev',
|
||||||
description: 'Previous Station',
|
description: 'Previous Station',
|
||||||
category: 'radio',
|
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)) {
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio.get(interaction.guild.id);
|
||||||
|
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'statistics',
|
name: 'statistics',
|
||||||
description: 'Show statistics',
|
description: 'Show statistics',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
execute(interaction: any, client: any) {
|
execute(interaction: ButtonInteraction | ChatInputCommandInteraction | StringSelectMenuInteraction, client: RadioClient) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
let stations = client.stations;
|
let stations = client.stations;
|
||||||
let currentGuild = client.datastore.getEntry(interaction.guild.id);
|
let currentGuild = client.datastore?.getEntry(interaction.guild.id);
|
||||||
let global = client.datastore.getEntry("global");
|
let global = client.datastore?.getEntry("global");
|
||||||
let statistics = "";
|
let statistics = "";
|
||||||
|
|
||||||
if(!client.stations) {
|
if(!client.stations) {
|
||||||
@ -29,7 +30,7 @@ export default {
|
|||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(client.messages.statisticsTitle)
|
.setTitle(client.messages.statisticsTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
|
.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)
|
.setDescription(statistics)
|
||||||
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
.setImage('https://waren.io/berriabot-temp-sa7a36a9xm6837br/images/empty-3.png')
|
||||||
.setFooter({
|
.setFooter({
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ColorResolvable, EmbedBuilder } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'status',
|
name: 'status',
|
||||||
description: 'Bot Status',
|
description: 'Bot Status',
|
||||||
category: 'info',
|
category: 'info',
|
||||||
async execute(interaction: any, client: any) {
|
async execute(interaction: any, client: RadioClient) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
|
|
||||||
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
|
message.statusTitle = client.messages.statusTitle.replace("%client.user.username%", client.user.username);
|
||||||
@ -13,7 +14,7 @@ export default {
|
|||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(message.statusTitle)
|
.setTitle(message.statusTitle)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["logo"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor as ColorResolvable)
|
||||||
.addFields(
|
.addFields(
|
||||||
{ name: client.messages.statusField1, value: uptime },
|
{ name: client.messages.statusField1, value: uptime },
|
||||||
{ name: client.messages.statusField2, value: client.config.version },
|
{ name: client.messages.statusField2, value: client.config.version },
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
import { EmbedBuilder } from "discord.js";
|
import { ButtonInteraction, ChatInputCommandInteraction, ColorResolvable, EmbedBuilder, StringSelectMenuInteraction } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'stop',
|
name: 'stop',
|
||||||
description: 'Stop radio',
|
description: 'Stop radio',
|
||||||
category: '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)) {
|
if (client.funcs.check(client, interaction, command)) {
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio?.get(interaction.guild.id);
|
||||||
client.statistics.update(client, interaction.guild, radio);
|
client.statistics?.update(client, interaction.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
client.funcs.logger('Radio', interaction.guild.id + " / " + 'Stop');
|
client.funcs.logger('Radio', interaction.guild.id + " / " + 'Stop');
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(client.user.username)
|
.setTitle(client.user.username)
|
||||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
|
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["stop"].replace(/[^0-9]+/g, ''))
|
||||||
.setColor(client.config.embedColor)
|
.setColor(client.config.embedColor as ColorResolvable)
|
||||||
.addFields({
|
.addFields({
|
||||||
name: client.messages.nowplayingTitle,
|
name: client.messages.nowplayingTitle,
|
||||||
value: "-"
|
value: "-"
|
||||||
@ -39,7 +40,7 @@ export default {
|
|||||||
await radio.message?.delete();
|
await radio.message?.delete();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
client.radio.delete(interaction.guild.id);
|
client.radio?.delete(interaction.guild.id);
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messageEmojis["stop"] + client.messages.stop,
|
content: client.messageEmojis["stop"] + client.messages.stop,
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import RadioClient from "../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'emojis',
|
name: 'emojis',
|
||||||
async execute(client: any): Promise<any> {
|
async execute(client: RadioClient): Promise<any> {
|
||||||
let customEmojis: any = {
|
let customEmojis: any = {
|
||||||
logo: "<:RadioX:688765708808487072>",
|
logo: "<:RadioX:688765708808487072>",
|
||||||
eximiabots: "<:EximiaBots:693277919929303132>",
|
eximiabots: "<:EximiaBots:693277919929303132>",
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SIGINT',
|
name: 'SIGINT',
|
||||||
execute(client: any) {
|
execute(client: RadioClient) {
|
||||||
client.user.setStatus('dnd');
|
client.user.setStatus('dnd');
|
||||||
|
|
||||||
client.streamer.leave(client);
|
client.streamer?.leave(client);
|
||||||
client.radio.save(client);
|
client.radio?.save(client);
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if(client.radio.size == 0){
|
if(client.radio?.size == 0){
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SIGTERM',
|
name: 'SIGTERM',
|
||||||
execute(client: any) {
|
execute(client: RadioClient) {
|
||||||
process.emit('SIGINT');
|
process.emit('SIGINT');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { PermissionFlagsBits } from "discord.js";
|
import { PermissionFlagsBits } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'interactionCreate',
|
name: 'interactionCreate',
|
||||||
async execute(client: any, interaction: any) {
|
async execute(client: RadioClient, interaction: any) {
|
||||||
|
|
||||||
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
const permissions = interaction.channel.permissionsFor(interaction.client.user);
|
||||||
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
|
if (!permissions.has(PermissionFlagsBits.ViewChannel)) return;
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { Message } from "discord.js";
|
import { Message } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'messageDelete',
|
name: 'messageDelete',
|
||||||
async execute(client: any, msg: Message) {
|
async execute(client: RadioClient, msg: Message) {
|
||||||
if(!msg.author.bot || !msg.guild) return;
|
if(!msg.author.bot || !msg.guild) return;
|
||||||
const radio = client.radio.get(msg.guild.id);
|
const radio = client.radio?.get(msg.guild.id);
|
||||||
if(!radio) return;
|
if(!radio) return;
|
||||||
if(!radio.message) return;
|
if(!radio.message) return;
|
||||||
if(msg.id != radio.message.id) return;
|
if(msg.id != radio.message.id) return;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import RadioClient from "../../Client";
|
||||||
import Datastore from "../classes/Datastore";
|
import Datastore from "../classes/Datastore";
|
||||||
import Radio from "../classes/Radio";
|
import Radio from "../classes/Radio";
|
||||||
import Stations from "../classes/Stations";
|
import Stations from "../classes/Stations";
|
||||||
@ -8,7 +9,7 @@ import commands from "../commands";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ready',
|
name: 'ready',
|
||||||
async execute(client: any) {
|
async execute(client: RadioClient) {
|
||||||
|
|
||||||
client.funcs.logger("Bot", "Ready");
|
client.funcs.logger("Bot", "Ready");
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'uncaughtException',
|
name: 'uncaughtException',
|
||||||
execute(client: any, error: any) {
|
execute(client: RadioClient, error: any) {
|
||||||
client.funcs.logger("Error");
|
client.funcs.logger("Error");
|
||||||
console.log(error.stack);
|
console.log(error.stack);
|
||||||
console.log('');
|
console.log('');
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { PermissionFlagsBits, VoiceState } from "discord.js";
|
import { PermissionFlagsBits, VoiceState } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
const {
|
const {
|
||||||
getVoiceConnection,
|
getVoiceConnection,
|
||||||
joinVoiceChannel
|
joinVoiceChannel
|
||||||
@ -6,7 +7,7 @@ const {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "voiceStateUpdate",
|
name: "voiceStateUpdate",
|
||||||
async execute(client: any, oldState: VoiceState, newState: VoiceState) {
|
async execute(client: RadioClient, oldState: VoiceState, newState: VoiceState) {
|
||||||
if (oldState.channel === null) return;
|
if (oldState.channel === null) return;
|
||||||
let change = false;
|
let change = false;
|
||||||
const radio = client.radio?.get(newState.guild.id);
|
const radio = client.radio?.get(newState.guild.id);
|
||||||
@ -15,11 +16,11 @@ export default {
|
|||||||
if (newState.member?.id === client.user.id && oldState.member?.id === client.user.id) {
|
if (newState.member?.id === client.user.id && oldState.member?.id === client.user.id) {
|
||||||
|
|
||||||
if (newState.channel === null) {
|
if (newState.channel === null) {
|
||||||
client.statistics.update(client, newState.guild, radio);
|
client.statistics?.update(client, newState.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
radio.message?.delete();
|
radio.message?.delete();
|
||||||
client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop');
|
client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop');
|
||||||
return client.radio.delete(newState.guild.id);
|
return client.radio?.delete(newState.guild.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
const newPermissions = newState.channel.permissionsFor(newState.client.user);
|
const newPermissions = newState.channel.permissionsFor(newState.client.user);
|
||||||
@ -37,11 +38,11 @@ export default {
|
|||||||
1000
|
1000
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
client.statistics.update(client, newState.guild, radio);
|
client.statistics?.update(client, newState.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
radio.message?.delete();
|
radio.message?.delete();
|
||||||
client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop');
|
client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop');
|
||||||
client.radio.delete(oldState.guild.id);
|
client.radio?.delete(oldState.guild.id);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -56,11 +57,11 @@ export default {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!radio || !radio.connection || !radio.connection === null) return;
|
if (!radio || !radio.connection || !radio.connection === null) return;
|
||||||
if (radio.voiceChannel.members.filter((member: { user: { bot: any; }; }) => !member.user.bot).size === 0) {
|
if (radio.voiceChannel.members.filter((member: { user: { bot: any; }; }) => !member.user.bot).size === 0) {
|
||||||
client.statistics.update(client, newState.guild, radio);
|
client.statistics?.update(client, newState.guild, radio);
|
||||||
radio.connection?.destroy();
|
radio.connection?.destroy();
|
||||||
radio.message?.delete();
|
radio.message?.delete();
|
||||||
client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop');
|
client.funcs.logger('Radio', newState.guild.id + " / " + 'Stop');
|
||||||
client.radio.delete(newState.guild.id);
|
client.radio?.delete(newState.guild.id);
|
||||||
}
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'warning',
|
name: 'warning',
|
||||||
execute(client: any, warning: any) {
|
execute(client: RadioClient, warning: Error) {
|
||||||
if(warning.name == "ExperimentalWarning" && warning.message.startsWith("stream/web")) return;
|
if(warning.name == "ExperimentalWarning" && warning.message.startsWith("stream/web")) return;
|
||||||
|
|
||||||
client.funcs.logger("Warning");
|
client.funcs.logger("Warning");
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
export default function check(client: any, interaction: any, command: any) {
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
|
export default function check(client: RadioClient, interaction: any, command: any) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
const radio = client.radio.get(interaction.guild.id);
|
const radio = client.radio?.get(interaction.guild.id);
|
||||||
if(client.config.maintenanceMode){
|
if(client.config.maintenanceMode){
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
content: client.messageEmojis["error"] + client.messages.maintenance,
|
content: client.messageEmojis["error"] + client.messages.maintenance,
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import { ActionRowBuilder, StringSelectMenuBuilder } from "discord.js";
|
import { ActionRowBuilder, StringSelectMenuBuilder } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default function listStations(client: any, interaction: any){
|
export default function listStations(client: RadioClient, interaction: any){
|
||||||
let stations: any = new Array();
|
let stations: any = new Array();
|
||||||
let options: any = new Array();
|
let options: any = new Array();
|
||||||
|
|
||||||
|
if(!client.stations) return;
|
||||||
|
|
||||||
stations = client.stations.forEach((station: { name?: any; owner?: any; label?: any; description?: any; value?: any; }) => {
|
stations = client.stations.forEach((station: { name?: any; owner?: any; label?: any; description?: any; value?: any; }) => {
|
||||||
if(station.name == "GrooveFM") return;
|
if(station.name == "GrooveFM") return;
|
||||||
station = {
|
station = {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { Guild } from "discord.js";
|
import { Guild } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default function loadState(client: any, guild: Guild){
|
export default function loadState(client: RadioClient, guild: Guild){
|
||||||
|
if(!client.datastore) return;
|
||||||
let data = client.datastore.getEntry(guild.id);
|
let data = client.datastore.getEntry(guild.id);
|
||||||
if(!data) return;
|
if(!data) return;
|
||||||
let state;
|
let state;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export default function logger(area : string, text: string){
|
export default function logger(area : string, text: string){
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
console.log('[' + area + '] – ' + date.toISOString());
|
console.log('[' + area + '] - ' + date.toISOString());
|
||||||
if(text) console.log(text + '\n');
|
if(text) console.log(text + '\n');
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
|
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, ColorResolvable, EmbedBuilder } from "discord.js";
|
||||||
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
export default async function play(client: any, interaction: any, guild: any, station: any) {
|
export default async function play(client: RadioClient, interaction: any, guild: any, station: any) {
|
||||||
let message: any = {};
|
let message: any = {};
|
||||||
const radio = client.radio.get(guild.id);
|
const radio = client.radio?.get(guild.id);
|
||||||
const audioPlayer = client.streamer.listen(station);
|
const audioPlayer = client.streamer?.listen(station);
|
||||||
radio.connection.subscribe(audioPlayer);
|
radio.connection.subscribe(audioPlayer);
|
||||||
client.funcs.logger('Radio', guild.id + " / " + "Play" + " / " + radio.station.name);
|
client.funcs.logger('Radio', guild.id + " / " + "Play" + " / " + radio.station.name);
|
||||||
|
|
||||||
@ -16,7 +17,7 @@ export default async function play(client: any, interaction: any, guild: any, st
|
|||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setTitle(client.user.username)
|
.setTitle(client.user.username)
|
||||||
.setThumbnail((radio.station.logo || "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)
|
.setColor(client.config.embedColor as ColorResolvable)
|
||||||
.addFields({
|
.addFields({
|
||||||
name: client.messages.nowplayingTitle,
|
name: client.messages.nowplayingTitle,
|
||||||
value: message.nowplayingDescription
|
value: message.nowplayingDescription
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
export default function saveState(client: any, guild: any, radio: any){
|
import RadioClient from "../../Client";
|
||||||
|
|
||||||
|
export default function saveState(client: RadioClient, guild: any, radio: any){
|
||||||
|
if(!client.datastore) return;
|
||||||
client.datastore.checkEntry(guild.id);
|
client.datastore.checkEntry(guild.id);
|
||||||
|
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
export interface command { }
|
|
||||||
|
|
||||||
export interface radio {}
|
|
Loading…
Reference in New Issue
Block a user