mirror of
				https://github.com/warengroup/eximiabots-radiox.git
				synced 2025-11-04 11:29:33 +00:00 
			
		
		
		
	Export modules in typescript
This commit is contained in:
		@@ -3,7 +3,7 @@ import Datastore from "./client/classes/Datastore";
 | 
			
		||||
import Radio from "./client/classes/Radio";
 | 
			
		||||
import Stations from "./client/classes/Stations";
 | 
			
		||||
import Streamer from "./client/classes/Streamer";
 | 
			
		||||
import Statistics from "./client/classes/Statistics;
 | 
			
		||||
import Statistics from "./client/classes/Statistics";
 | 
			
		||||
import fs from "fs";
 | 
			
		||||
import { command, radio } from "./client/utils/typings";
 | 
			
		||||
import config from "./config";
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
const fs = require('fs');
 | 
			
		||||
const path = require('path');
 | 
			
		||||
 | 
			
		||||
module.exports = class {
 | 
			
		||||
export default class {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        this.map = new Map();
 | 
			
		||||
        this.loadData();
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ const {
 | 
			
		||||
    joinVoiceChannel
 | 
			
		||||
} = require("@discordjs/voice");
 | 
			
		||||
 | 
			
		||||
module.exports = class Radio extends Map {
 | 
			
		||||
export default class Radio extends Map {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        super();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
 | 
			
		||||
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
 | 
			
		||||
 | 
			
		||||
module.exports = class Stations extends Array {
 | 
			
		||||
export default class Stations extends Array {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        super();
 | 
			
		||||
        this.logger = require("../funcs/logger.js");
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = class {
 | 
			
		||||
export default class Statistics {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        this.map = new Map();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,7 @@ const {
 | 
			
		||||
    NoSubscriberBehavior
 | 
			
		||||
} = require("@discordjs/voice");
 | 
			
		||||
 | 
			
		||||
module.exports = class {
 | 
			
		||||
export default class Streamer {
 | 
			
		||||
    constructor() {
 | 
			
		||||
        this.map = new Map();
 | 
			
		||||
        this.mode = null;
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ const { Routes } = require('discord-api-types/v9');
 | 
			
		||||
const fs = require('fs');
 | 
			
		||||
const path = require ('path');
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    async execute(client) {
 | 
			
		||||
 | 
			
		||||
        const commands = [];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'bug',
 | 
			
		||||
    description: 'Report a bug',
 | 
			
		||||
    category: 'info',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'help',
 | 
			
		||||
    description: 'Get help using bot',
 | 
			
		||||
    category: 'info',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'invite',
 | 
			
		||||
    description: 'Invite Bot',
 | 
			
		||||
    category: 'info',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'list',
 | 
			
		||||
    description: 'List radio stations',
 | 
			
		||||
    category: 'radio',
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ import Streamer from "../classes/Streamer";
 | 
			
		||||
const _importDynamic = new Function('modulePath', 'return import(modulePath)');
 | 
			
		||||
const fetch = (...args) => _importDynamic('node-fetch').then(({default: fetch}) => fetch(...args));
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'maintenance',
 | 
			
		||||
    description: 'Bot Maintenance',
 | 
			
		||||
    category: 'info',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'next',
 | 
			
		||||
    description: 'Next Station',
 | 
			
		||||
    category: 'radio',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'nowplaying',
 | 
			
		||||
    description: 'Current Radio Station',
 | 
			
		||||
    category: 'radio',
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ const {
 | 
			
		||||
    joinVoiceChannel
 | 
			
		||||
} = require("@discordjs/voice");
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: "play",
 | 
			
		||||
    usage: "<song name>",
 | 
			
		||||
    description: "Play radio",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'prev',
 | 
			
		||||
    description: 'Previous Station',
 | 
			
		||||
    category: 'radio',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'statistics',
 | 
			
		||||
    description: 'Show statistics',
 | 
			
		||||
    category: 'info',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'status',
 | 
			
		||||
    description: 'Bot Status',
 | 
			
		||||
    category: 'info',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'stop',
 | 
			
		||||
    description: 'Stop radio',
 | 
			
		||||
    category: 'radio',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'emojis',
 | 
			
		||||
    async execute(client) {
 | 
			
		||||
        let customEmojis = {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'SIGINT',
 | 
			
		||||
    execute(client) {
 | 
			
		||||
        client.user.setStatus('dnd');
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'SIGTERM',
 | 
			
		||||
    execute(client) {
 | 
			
		||||
        process.emit('SIGINT');
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { PermissionFlagsBits } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'interactionCreate',
 | 
			
		||||
    async execute(client, interaction) {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'messageDelete',
 | 
			
		||||
    async execute(client, msg) {
 | 
			
		||||
        if(!msg.author.bot || !msg.guild) return;
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import Stations from "../classes/Stations";
 | 
			
		||||
import Streamer from "../classes/Streamer";
 | 
			
		||||
import Statistics from "../classes/Statistics";
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'ready',
 | 
			
		||||
    async execute(client) {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'uncaughtException',
 | 
			
		||||
    execute(client, error) {
 | 
			
		||||
        client.funcs.logger("Error");
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ const {
 | 
			
		||||
    joinVoiceChannel
 | 
			
		||||
} = require("@discordjs/voice");
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: "voiceStateUpdate",
 | 
			
		||||
    async execute(client, oldState, newState) {
 | 
			
		||||
        if (oldState.channel === null) return;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    name: 'warning',
 | 
			
		||||
    execute(client, warning) {
 | 
			
		||||
        if(warning.name == "ExperimentalWarning" && warning.message.startsWith("stream/web")) return;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = function check(client, interaction, command) {
 | 
			
		||||
export default function check(client, interaction, command) {
 | 
			
		||||
    let message = {};
 | 
			
		||||
    const radio = client.radio.get(interaction.guild.id);
 | 
			
		||||
    if(client.config.maintenanceMode){
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = function isDev(devList, authorID){
 | 
			
		||||
export default function isDev(devList, authorID){
 | 
			
		||||
    let response = false;
 | 
			
		||||
    Object.keys(devList).forEach(function(oneDev) {
 | 
			
		||||
        let devID = devList[oneDev];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { ActionRowBuilder, StringSelectMenuBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = function listStations(client, interaction){
 | 
			
		||||
export default function listStations(client, interaction){
 | 
			
		||||
    let stations = new Array();
 | 
			
		||||
    let options = new Array();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = function loadState(client, guild){
 | 
			
		||||
export default function loadState(client, guild){
 | 
			
		||||
    let data = client.datastore.getEntry(guild.id);
 | 
			
		||||
    if(!data) return;
 | 
			
		||||
    let state;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = function logger(area, text){
 | 
			
		||||
export default function logger(area, text){
 | 
			
		||||
    let date = new Date();
 | 
			
		||||
    console.log('[' + area + '] – ' + date.toISOString());
 | 
			
		||||
    if(text)  console.log(text + '\n');
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = function msToTime(duration) {
 | 
			
		||||
export default function msToTime(duration) {
 | 
			
		||||
    let seconds = Math.floor((duration / 1000) % 60),
 | 
			
		||||
        minutes = Math.floor((duration / (1000 * 60)) % 60),
 | 
			
		||||
        hours = Math.floor((duration / (1000 * 60 * 60)) % 24),
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from "discord.js";
 | 
			
		||||
 | 
			
		||||
module.exports = async function play(client, interaction, guild, station) {
 | 
			
		||||
export default async function play(client, interaction, guild, station) {
 | 
			
		||||
    let message = {};
 | 
			
		||||
    const radio = client.radio.get(guild.id);
 | 
			
		||||
    const audioPlayer = client.streamer.listen(station);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = function saveState(client, guild, radio){
 | 
			
		||||
export default function saveState(client, guild, radio){
 | 
			
		||||
    client.datastore.checkEntry(guild.id);
 | 
			
		||||
 | 
			
		||||
    let date = new Date();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
    wrongVoiceChannel: "You need to be in the same voice channel as RadioX to use this command!",
 | 
			
		||||
    noPerms: "You need the %command.permission% permission to use this command!",
 | 
			
		||||
    notPlaying: "There is nothing playing!",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
require('dotenv/config');
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
export default {
 | 
			
		||||
 | 
			
		||||
    //credentials
 | 
			
		||||
    token: process.env.DISCORD_TOKEN,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user