mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2025-07-01 15:03:37 +00:00
Compare commits
63 Commits
Author | SHA1 | Date | |
---|---|---|---|
34b7bf8f19 | |||
18a03d50ee | |||
6c89770d16 | |||
dc5a9d4e71 | |||
e479e5a82a | |||
6afe6c30f9 | |||
17161b72b9 | |||
3cb54c9470 | |||
751f9989eb | |||
6c860b6b23 | |||
0bfb34c1dd | |||
9a84a3c938 | |||
510f2c5b50 | |||
e571194eac | |||
ca02f95500 | |||
28e7476f70 | |||
95e8b17ddd | |||
6a11482110 | |||
202674cb53 | |||
64f97b990a | |||
7dc0a6d3b9 | |||
8f685a0676 | |||
ce7d3d633b | |||
177a405f08 | |||
40490d80dc | |||
ef18a08cc6 | |||
378fe97ea3 | |||
39d7acaa9e | |||
0ef9cad101 | |||
07e45ae54d | |||
f437797bed | |||
e267b06cf1 | |||
a5ffaadf31 | |||
251eb7f5a1 | |||
b2ae9ef6f0 | |||
db409ac6d2 | |||
fb2c18b9b0 | |||
5efb68b717 | |||
f543cd3267 | |||
0515f0f5e3 | |||
59796ff002 | |||
bf70276d7f | |||
7db92969af | |||
3520e86f0b | |||
bb07884ab4 | |||
2de365770d | |||
0c5fdcd651 | |||
b01ee3b380 | |||
308afd9f96 | |||
31baeeab45 | |||
c17900b618 | |||
10c6a8c589 | |||
284f0e9f0c | |||
1f259d95ac | |||
9b67506558 | |||
f9ba5a3117 | |||
f1f16c4f9a | |||
5147c6455f | |||
3b8ae4fd4b | |||
471f345026 | |||
0d63c1920e | |||
3cb07107d5 | |||
acef9404b2 |
3
.env_example
Normal file
3
.env_example
Normal file
@ -0,0 +1,3 @@
|
||||
DISCORD_TOKEN=
|
||||
RADIOX_STATIONSLISTURL=https://gitea.cwinfo.org/cwchristerw/radio/raw/branch/master/playlist.json
|
||||
RADIOX_PREFIX=rx-
|
13
.eslintrc
Normal file
13
.eslintrc
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"extends": [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier/@typescript-eslint",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2019,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {}
|
||||
}
|
19
.github/workflows/docker-build.yml
vendored
Normal file
19
.github/workflows/docker-build.yml
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
name: Docker Build
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
name: Docker Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1.5.1
|
||||
id: buildx
|
||||
with:
|
||||
install: true
|
||||
- name: Build
|
||||
run: docker build . # will run buildx
|
22
.github/workflows/typescript-build.yml
vendored
Normal file
22
.github/workflows/typescript-build.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
name: TypeScript Build
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
tsc:
|
||||
name: TypeScript Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install node v16
|
||||
uses: actions/setup-node@v2.3.1
|
||||
with:
|
||||
node-version: 16
|
||||
- name: npm install -g npm
|
||||
run: npm install -g npm
|
||||
- name: npm install
|
||||
run: npm install
|
||||
- name: tsc
|
||||
uses: icrawl/action-tsc@v1
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,4 +2,5 @@ datastore/
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
.vscode/
|
||||
.env
|
||||
.env
|
||||
build/
|
5
.prettierrc
Normal file
5
.prettierrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"tabWidth": 4,
|
||||
"semi": true
|
||||
}
|
14
Dockerfile
14
Dockerfile
@ -1,15 +1,19 @@
|
||||
FROM node:14.15.4-alpine
|
||||
FROM node:16-alpine
|
||||
|
||||
#Dependencies
|
||||
RUN apk add --virtual .build-deps python make g++ gcc
|
||||
RUN apk add --virtual .build-deps python3 make g++ gcc git
|
||||
|
||||
#Dependencies for RadioX Bot
|
||||
RUN apk add --virtual .radiox-deps ffmpeg
|
||||
#Code Dependencies
|
||||
RUN apk add --virtual .code-deps ffmpeg
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY / /usr/src/app/
|
||||
|
||||
RUN npm install -g npm
|
||||
|
||||
RUN npm install
|
||||
|
||||
CMD [ "npm", "start" ]
|
||||
RUN npm run build
|
||||
|
||||
CMD [ "npm", "start" ]
|
@ -1,62 +0,0 @@
|
||||
const { Client, Collection } = require('discord.js');
|
||||
const Discord = require('discord.js');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const events = './events/';
|
||||
const Datastore = require('./datastore.js');
|
||||
|
||||
const GatewayIntents = new Discord.Intents();
|
||||
GatewayIntents.add(
|
||||
1 << 0, // GUILDS
|
||||
1 << 7, // GUILD_VOICE_STATES
|
||||
1 << 9 // GUILD_MESSAGES
|
||||
);
|
||||
|
||||
module.exports = class extends Client {
|
||||
constructor() {
|
||||
super({
|
||||
disableEveryone: true,
|
||||
disabledEvents: ['TYPING_START'],
|
||||
ws: {
|
||||
intents: GatewayIntents
|
||||
}
|
||||
});
|
||||
this.commands = new Collection();
|
||||
this.commandAliases = new Collection();
|
||||
this.radio = new Map();
|
||||
|
||||
this.funcs = {};
|
||||
this.funcs.check = require('./funcs/check.js');
|
||||
this.funcs.checkFetchStatus = require('./funcs/checkFetchStatus.js');
|
||||
this.funcs.isDev = require('./funcs/isDev.js');
|
||||
this.funcs.msToTime = require('./funcs/msToTime.js');
|
||||
this.funcs.statisticsUpdate = require('./funcs/statisticsUpdate.js');
|
||||
|
||||
this.config = require('../config.js');
|
||||
this.messages = require('./messages.js');
|
||||
|
||||
const commandFiles = fs.readdirSync('./client/commands/').filter(f => f.endsWith('.js'));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./commands/${file}`);
|
||||
command.uses = 0;
|
||||
this.commands.set(command.name, command);
|
||||
this.commandAliases.set(command.alias, command);
|
||||
}
|
||||
|
||||
this.on('ready', () => {
|
||||
require(`${events}ready`).execute(this, Discord);
|
||||
this.datastore = new Datastore();
|
||||
});
|
||||
this.on('message', (msg) => {
|
||||
require(`${events}msg`).execute(this, msg, Discord);
|
||||
});
|
||||
this.on('voiceStateUpdate', (oldState, newState) => {
|
||||
require(`${events}voiceStateUpdate`).execute(this, oldState, newState);
|
||||
});
|
||||
this.on('error', (error) => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
this.login(this.config.token).catch(err => console.log('Failed to login: ' + err));
|
||||
}
|
||||
};
|
@ -1,158 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'play',
|
||||
alias: 'p',
|
||||
usage: '<song name>',
|
||||
description: 'Play some music.',
|
||||
permission: 'none',
|
||||
category: 'radio',
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
let url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
if (!radio) {
|
||||
if (!msg.member.voice.channel) return msg.channel.send(client.messageEmojis["error"] + client.messages.noVoiceChannel);
|
||||
} else {
|
||||
if (voiceChannel !== radio.voiceChannel) return msg.channel.send(client.messageEmojis["error"] + client.messages.wrongVoiceChannel);
|
||||
}
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
if (!args[1]) return msg.channel.send(client.messages.noQuery);
|
||||
const permissions = voiceChannel.permissionsFor(msg.client.user);
|
||||
if (!permissions.has('CONNECT')) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsConnect);
|
||||
}
|
||||
if (!permissions.has('SPEAK')) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsSpeak);
|
||||
}
|
||||
let station;
|
||||
const number = parseInt(args[1] - 1);
|
||||
if (url.startsWith('http')) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.errorStationURL);
|
||||
} else if (!isNaN(number)) {
|
||||
if (number > client.stations.length - 1) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.wrongStationNumber);
|
||||
} else {
|
||||
url = client.stations[number].stream[client.stations[number].stream.default];
|
||||
station = client.stations[number];
|
||||
}
|
||||
} else {
|
||||
if (args[1].length < 3) return msg.channel.send(client.messageEmojis["error"] + client.messages.tooShortSearch);
|
||||
const sstation = await searchStation(args.slice(1).join(' '), client);
|
||||
if (!sstation) return msg.channel.send(client.messageEmojis["error"] + client.messages.noSearchResults);
|
||||
url = sstation.stream[sstation.stream.default];
|
||||
station = sstation;
|
||||
}
|
||||
|
||||
if (radio) {
|
||||
|
||||
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.station = station;
|
||||
radio.textChannel = msg.channel;
|
||||
play(msg.guild, client, url);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const construct = {
|
||||
textChannel: msg.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
station: station,
|
||||
volume: 5,
|
||||
};
|
||||
client.radio.set(msg.guild.id, construct);
|
||||
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
construct.connection = connection;
|
||||
let date = new Date();
|
||||
construct.startTime = date.getTime();
|
||||
play(msg.guild, client, url);
|
||||
|
||||
client.datastore.checkEntry(msg.guild.id);
|
||||
construct.currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
|
||||
if(!construct.currentGuild.statistics[construct.station.name]){
|
||||
construct.currentGuild.statistics[construct.station.name] = {};
|
||||
construct.currentGuild.statistics[construct.station.name].time = 0;
|
||||
construct.currentGuild.statistics[construct.station.name].used = 0;
|
||||
client.datastore.updateEntry(msg.guild, construct.currentGuild);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
client.radio.delete(msg.guild.id);
|
||||
return msg.channel.send(client.messageEmojis["error"] + `An error occured: ${error}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
function play(guild, client, url) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(guild.id);
|
||||
|
||||
const dispatcher = radio.connection
|
||||
.play(url, { bitrate: "auto", volume: 1 })
|
||||
.on("finish", () => {
|
||||
console.log("Stream finished");
|
||||
client.funcs.statisticsUpdate(client, guild, radio);
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(guild.id);
|
||||
return;
|
||||
});
|
||||
|
||||
dispatcher.on('error', error => {
|
||||
console.error(error);
|
||||
radio.voiceChannel.leave();
|
||||
client.radio.delete(guild.id);
|
||||
return radio.textChannel.send(client.messages.errorPlaying);
|
||||
});
|
||||
|
||||
dispatcher.setVolume(radio.volume / 10);
|
||||
|
||||
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
|
||||
radio.textChannel.send(client.messageEmojis["play"] + message.play);
|
||||
};
|
||||
|
||||
function searchStation(key, client) {
|
||||
if (client.stations === null) return false;
|
||||
let foundStations = [];
|
||||
if (!key) return false;
|
||||
if (key == 'radio') return false;
|
||||
if (key.startsWith("radio ")) key = key.slice(6);
|
||||
const probabilityIncrement = 100 / key.split(' ').length / 2;
|
||||
for (let i = 0; i < key.split(' ').length; i++) {
|
||||
client.stations.filter(x => x.name.toUpperCase().includes(key.split(' ')[i].toUpperCase()) || x === key).forEach(x => foundStations.push({ station: x, name: x.name, probability: probabilityIncrement }));
|
||||
}
|
||||
if (foundStations.length === 0) return false;
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
for (let j = 0; j < foundStations.length; j++) {
|
||||
if (foundStations[i] === foundStations[j] && i !== j) foundStations.splice(i, 1);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
if (foundStations[i].name.length > key.length) {
|
||||
foundStations[i].probability -= (foundStations[i].name.split(' ').length - key.split(' ').length) * (probabilityIncrement * 0.5);
|
||||
} else if (foundStations[i].name.length === key.length) {
|
||||
foundStations[i].probability += (probabilityIncrement * 0.9);
|
||||
}
|
||||
|
||||
for (let j = 0; j < key.split(' ').length; j++) {
|
||||
if (!foundStations[i].name.toUpperCase().includes(key.toUpperCase().split(' ')[j])) {
|
||||
foundStations[i].probability -= (probabilityIncrement * 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
let highestProbabilityStation;
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
if (!highestProbabilityStation || highestProbabilityStation.probability < foundStations[i].probability) highestProbabilityStation = foundStations[i];
|
||||
if (highestProbabilityStation && highestProbabilityStation.probability === foundStations[i].probability) {
|
||||
highestProbabilityStation = foundStations[i].station;
|
||||
}
|
||||
}
|
||||
return highestProbabilityStation;
|
||||
};
|
@ -1,27 +0,0 @@
|
||||
module.exports = {
|
||||
name: 'volume',
|
||||
description: 'Volume command.',
|
||||
alias: 'none',
|
||||
usage: '<volume>',
|
||||
permission: 'MANAGE_MESSAGES',
|
||||
category: 'radio',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
|
||||
if (!args[1] && radio) {
|
||||
message.currentVolume = client.messages.currentVolume.replace("%radio.volume%", radio.volume)
|
||||
return msg.channel.send(message.currentVolume);
|
||||
}
|
||||
const volume = parseFloat(args[1]);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
if (isNaN(volume)) return msg.channel.send(client.messages.invalidVolume);
|
||||
if (volume > 100) return msg.channel.send(client.messages.maxVolume);
|
||||
if (volume < 0) return msg.channel.send(client.messages.negativeVolume);
|
||||
radio.volume = volume;
|
||||
radio.connection.dispatcher.setVolume(volume / 5);
|
||||
message.newVolume = client.messages.newVolume.replace("%volume%", volume);
|
||||
return msg.channel.send(message.newVolume);
|
||||
}
|
||||
}
|
||||
};
|
2
index.js
2
index.js
@ -1,2 +0,0 @@
|
||||
const radioClient = require("./client/class.js");
|
||||
const client = new radioClient();
|
6495
package-lock.json
generated
6495
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
@ -1,10 +1,12 @@
|
||||
{
|
||||
"name": "eximiabots-radiox",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.4",
|
||||
"description": "Internet Radio to your Discord guild",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node ."
|
||||
"build": "rimraf ./build && tsc",
|
||||
"start": "node build/index.js",
|
||||
"start:dev": "npm run build && node build/index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -16,10 +18,32 @@
|
||||
"url": "https://github.com/warengroup/eximiabots-radiox/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.3.3",
|
||||
"discord.js": "^12.5.3",
|
||||
"dotenv": "^8.2.0",
|
||||
"@discordjs/opus": "^0.6.0",
|
||||
"@discordjs/voice": "^0.6.0",
|
||||
"discord-api-types": "^0.22.0",
|
||||
"discord.js": "^13.1.0",
|
||||
"dotenv": "^10.0.0",
|
||||
"libsodium-wrappers": "^0.7.9",
|
||||
"node-fetch": "^2.6.1",
|
||||
"path": "^0.12.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.6.1",
|
||||
"@types/ws": "^7.4.7",
|
||||
"@typescript-eslint/eslint-plugin": "^4.29.2",
|
||||
"@typescript-eslint/parser": "^4.29.2",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^3.4.1",
|
||||
"nodemon": "^2.0.12",
|
||||
"prettier": "^2.3.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-node": "^10.2.1",
|
||||
"tsc-watch": "^4.5.0",
|
||||
"typescript": "^4.3.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.6.0",
|
||||
"npm": ">=7.0.0"
|
||||
}
|
||||
}
|
||||
}
|
67
src/Client.ts
Normal file
67
src/Client.ts
Normal file
@ -0,0 +1,67 @@
|
||||
import Discord, { Client, Collection } from "discord.js";
|
||||
import fs from "fs";
|
||||
const events = "./client/events/";
|
||||
import Datastore from "./client/datastore.js";
|
||||
import { command, radio } from "./client/utils/typings.js";
|
||||
import config from "./config.js";
|
||||
import messages from "./client/messages.js";
|
||||
import path from "path"
|
||||
|
||||
const GatewayIntents = new Discord.Intents();
|
||||
GatewayIntents.add(
|
||||
1 << 0, // GUILDS
|
||||
1 << 7, // GUILD_VOICE_STATES
|
||||
1 << 9 // GUILD_MESSAGES
|
||||
);
|
||||
|
||||
class RadioClient extends Client {
|
||||
readonly commands: Collection<string, command>;
|
||||
readonly commandAliases: Collection<string, command>;
|
||||
readonly radio: Map<string, radio>;
|
||||
public funcs: any;
|
||||
readonly config = config;
|
||||
readonly messages = messages;
|
||||
public datastore: Datastore | null;
|
||||
constructor() {
|
||||
super({
|
||||
intents: GatewayIntents
|
||||
});
|
||||
this.commands = new Collection();
|
||||
this.commandAliases = new Collection();
|
||||
this.radio = new Map();
|
||||
this.datastore = null;
|
||||
|
||||
this.funcs = {};
|
||||
this.funcs.check = require("./client/funcs/check.js");
|
||||
this.funcs.checkFetchStatus = require("./client/funcs/checkFetchStatus.js");
|
||||
this.funcs.isDev = require("./client/funcs/isDev.js");
|
||||
this.funcs.msToTime = require("./client/funcs/msToTime.js");
|
||||
this.funcs.statisticsUpdate = require("./client/funcs/statisticsUpdate.js");
|
||||
|
||||
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js"));
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`./client/commands/${file}`);
|
||||
command.uses = 0;
|
||||
this.commands.set(command.name, command);
|
||||
this.commandAliases.set(command.alias, command);
|
||||
}
|
||||
|
||||
this.on("ready", () => {
|
||||
require(`${events}ready`).execute(this, Discord);
|
||||
this.datastore = new Datastore();
|
||||
});
|
||||
this.on("messageCreate", msg => {
|
||||
require(`${events}msg`).execute(this, msg, Discord);
|
||||
});
|
||||
this.on("voiceStateUpdate", (oldState, newState) => {
|
||||
require(`${events}voiceStateUpdate`).execute(this, oldState, newState);
|
||||
});
|
||||
this.on("error", error => {
|
||||
console.error(error);
|
||||
});
|
||||
|
||||
this.login(this.config.token).catch(err => console.log("Failed to login: " + err));
|
||||
}
|
||||
}
|
||||
|
||||
export default RadioClient
|
@ -17,7 +17,7 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.bugDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
|
||||
},
|
||||
}
|
||||
};
|
@ -24,11 +24,12 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.helpCommandDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
} else {
|
||||
const categories = [];
|
||||
let commandsToArray = Array.from(client.commands.values());
|
||||
for (let i = 0; i < client.commands.size; i++) {
|
||||
if (!categories.includes(client.commands.array()[i].category)) categories.push(client.commands.array()[i].category);
|
||||
if (!categories.includes(commandsToArray[i].category)) categories.push(commandsToArray[i].category);
|
||||
}
|
||||
let commands = '';
|
||||
for (let i = 0; i < categories.length; i++) {
|
||||
@ -45,7 +46,7 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.helpDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
}
|
||||
}
|
||||
};
|
@ -11,8 +11,8 @@ module.exports = {
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(message.inviteTitle)
|
||||
.setColor(client.config.embedColor)
|
||||
.setURL(client.config.invite)
|
||||
.setURL("https://discordapp.com/api/oauth2/authorize?client_id=" + client.user.id + "&permissions=3427328&scope=bot")
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
}
|
||||
};
|
@ -23,6 +23,6 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(stations)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
}
|
||||
};
|
@ -1,53 +1,53 @@
|
||||
module.exports = {
|
||||
name: 'maintenance',
|
||||
alias: 'm',
|
||||
usage: '',
|
||||
description: 'Bot Maintenance',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
if(!client.funcs.isDev(client.config.devId, msg.author.id)) return msg.channel.send(client.messageEmojis["error"] + client.messages.notAllowed);
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
let currentRadios = client.radio.keys();
|
||||
let radio = currentRadios.next();
|
||||
let stoppedRadios = "";
|
||||
|
||||
client.user.setStatus('dnd');
|
||||
|
||||
while (!radio.done) {
|
||||
let currentRadio = client.radio.get(radio.value);
|
||||
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
||||
|
||||
if(currentRadio){
|
||||
client.funcs.statisticsUpdate(client, currentRadio.currentGuild.guild, currentRadio);
|
||||
currentRadio.connection.dispatcher?.destroy();
|
||||
currentRadio.voiceChannel.leave();
|
||||
const cembed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(client.messages.sendedMaintenanceMessage)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
currentRadio.textChannel.send(cembed);
|
||||
client.radio.delete(radio.value);
|
||||
stoppedRadios += "-" + radio.value + ": " + currentRadio.currentGuild.guild.name + "\n";
|
||||
}
|
||||
radio = currentRadios.next();
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
module.exports = {
|
||||
name: 'maintenance',
|
||||
alias: 'm',
|
||||
usage: '',
|
||||
description: 'Bot Maintenance',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
|
||||
if(!client.funcs.isDev(client.config.devId, msg.author.id)) return msg.channel.send(client.messageEmojis["error"] + client.messages.notAllowed);
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
let currentRadios = client.radio.keys();
|
||||
let radio = currentRadios.next();
|
||||
let stoppedRadios = "";
|
||||
|
||||
client.user.setStatus('dnd');
|
||||
|
||||
while (!radio.done) {
|
||||
let currentRadio = client.radio.get(radio.value);
|
||||
currentRadio.guild = client.datastore.getEntry(radio.value).guild;
|
||||
|
||||
if(currentRadio){
|
||||
client.funcs.statisticsUpdate(client, currentRadio.currentGuild.guild, currentRadio);
|
||||
currentRadio.connection.destroy();
|
||||
currentRadio.audioPlayer.stop();
|
||||
const cembed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(client.messages.sendedMaintenanceMessage)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
currentRadio.textChannel.send({ embeds: [cembed] });
|
||||
client.radio.delete(radio.value);
|
||||
stoppedRadios += "-" + radio.value + ": " + currentRadio.currentGuild.guild.name + "\n";
|
||||
}
|
||||
radio = currentRadios.next();
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.maintenanceTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["maintenance"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription("Stopped all radios" + "\n" + stoppedRadios)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
}
|
||||
};
|
@ -25,6 +25,6 @@ module.exports = {
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(message.nowplayingDescription)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
}
|
||||
};
|
204
src/client/commands/play.js
Normal file
204
src/client/commands/play.js
Normal file
@ -0,0 +1,204 @@
|
||||
const {
|
||||
createAudioPlayer,
|
||||
createAudioResource,
|
||||
getVoiceConnection,
|
||||
joinVoiceChannel
|
||||
} = require("@discordjs/voice");
|
||||
|
||||
module.exports = {
|
||||
name: "play",
|
||||
alias: "p",
|
||||
usage: "<song name>",
|
||||
description: "Play some music.",
|
||||
permission: "none",
|
||||
category: "radio",
|
||||
async execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
let url = args[1] ? args[1].replace(/<(.+)>/g, "$1") : "";
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
const voiceChannel = msg.member.voice.channel;
|
||||
if (!radio) {
|
||||
if (!msg.member.voice.channel)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.noVoiceChannel
|
||||
);
|
||||
} else {
|
||||
if (voiceChannel !== radio.voiceChannel)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.wrongVoiceChannel
|
||||
);
|
||||
}
|
||||
if (!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace(
|
||||
"%client.config.supportGuild%",
|
||||
client.config.supportGuild
|
||||
);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
if (!args[1]) return msg.channel.send(client.messages.noQuery);
|
||||
const permissions = voiceChannel.permissionsFor(msg.client.user);
|
||||
if (!permissions.has("CONNECT")) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsConnect);
|
||||
}
|
||||
if (!permissions.has("SPEAK")) {
|
||||
return msg.channel.send(client.messageEmojis["error"] + client.messages.noPermsSpeak);
|
||||
}
|
||||
let station;
|
||||
const number = parseInt(args[1] - 1);
|
||||
if (url.startsWith("http")) {
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.errorStationURL
|
||||
);
|
||||
} else if (!isNaN(number)) {
|
||||
if (number > client.stations.length - 1) {
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.wrongStationNumber
|
||||
);
|
||||
} else {
|
||||
url = client.stations[number].stream[client.stations[number].stream.default];
|
||||
station = client.stations[number];
|
||||
}
|
||||
} else {
|
||||
if (args[1].length < 3)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.tooShortSearch
|
||||
);
|
||||
const sstation = await searchStation(args.slice(1).join(" "), client);
|
||||
if (!sstation)
|
||||
return msg.channel.send(
|
||||
client.messageEmojis["error"] + client.messages.noSearchResults
|
||||
);
|
||||
url = sstation.stream[sstation.stream.default];
|
||||
station = sstation;
|
||||
}
|
||||
|
||||
if (radio) {
|
||||
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||
radio.audioPlayer.stop();
|
||||
|
||||
radio.station = station;
|
||||
radio.textChannel = msg.channel;
|
||||
play(msg.guild, client, url);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const construct = {
|
||||
textChannel: msg.channel,
|
||||
voiceChannel: voiceChannel,
|
||||
connection: null,
|
||||
audioPlayer: createAudioPlayer(),
|
||||
station: station
|
||||
};
|
||||
client.radio.set(msg.guild.id, construct);
|
||||
|
||||
try {
|
||||
const connection =
|
||||
getVoiceConnection(voiceChannel.guild.id) ??
|
||||
joinVoiceChannel({
|
||||
channelId: voiceChannel.id,
|
||||
guildId: voiceChannel.guild.id,
|
||||
adapterCreator: voiceChannel.guild.voiceAdapterCreator
|
||||
});
|
||||
construct.connection = connection;
|
||||
let date = new Date();
|
||||
construct.startTime = date.getTime();
|
||||
play(msg.guild, client, url);
|
||||
|
||||
client.datastore.checkEntry(msg.guild.id);
|
||||
construct.currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
|
||||
if (!construct.currentGuild.statistics[construct.station.name]) {
|
||||
construct.currentGuild.statistics[construct.station.name] = {};
|
||||
construct.currentGuild.statistics[construct.station.name].time = 0;
|
||||
construct.currentGuild.statistics[construct.station.name].used = 0;
|
||||
client.datastore.updateEntry(msg.guild, construct.currentGuild);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
client.radio.delete(msg.guild.id);
|
||||
return msg.channel.send(client.messageEmojis["error"] + `An error occured: ${error}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
function play(guild, client, url) {
|
||||
let message = {};
|
||||
const radio = client.radio.get(guild.id);
|
||||
const resource = createAudioResource(url);
|
||||
radio.connection.subscribe(radio.audioPlayer);
|
||||
radio.audioPlayer.play(resource);
|
||||
resource.playStream
|
||||
.on("readable", () => {
|
||||
console.log("Stream started");
|
||||
})
|
||||
.on("finish", () => {
|
||||
console.log("Stream finished");
|
||||
client.funcs.statisticsUpdate(client, guild, radio);
|
||||
radio.connection.destroy();
|
||||
client.radio.delete(guild.id);
|
||||
return;
|
||||
})
|
||||
.on("error", error => {
|
||||
console.error(error);
|
||||
radio.connection.destroy();
|
||||
client.radio.delete(guild.id);
|
||||
return radio.textChannel.send(client.messages.errorPlaying);
|
||||
});
|
||||
|
||||
message.play = client.messages.play.replace("%radio.station.name%", radio.station.name);
|
||||
radio.textChannel.send(client.messageEmojis["play"] + message.play);
|
||||
}
|
||||
|
||||
function searchStation(key, client) {
|
||||
if (client.stations === null) return false;
|
||||
let foundStations = [];
|
||||
if (!key) return false;
|
||||
if (key == "radio") return false;
|
||||
if (key.startsWith("radio ")) key = key.slice(6);
|
||||
const probabilityIncrement = 100 / key.split(" ").length / 2;
|
||||
for (let i = 0; i < key.split(" ").length; i++) {
|
||||
client.stations
|
||||
.filter(
|
||||
x => x.name.toUpperCase().includes(key.split(" ")[i].toUpperCase()) || x === key
|
||||
)
|
||||
.forEach(x =>
|
||||
foundStations.push({ station: x, name: x.name, probability: probabilityIncrement })
|
||||
);
|
||||
}
|
||||
if (foundStations.length === 0) return false;
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
for (let j = 0; j < foundStations.length; j++) {
|
||||
if (foundStations[i] === foundStations[j] && i !== j) foundStations.splice(i, 1);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
if (foundStations[i].name.length > key.length) {
|
||||
foundStations[i].probability -=
|
||||
(foundStations[i].name.split(" ").length - key.split(" ").length) *
|
||||
(probabilityIncrement * 0.5);
|
||||
} else if (foundStations[i].name.length === key.length) {
|
||||
foundStations[i].probability += probabilityIncrement * 0.9;
|
||||
}
|
||||
|
||||
for (let j = 0; j < key.split(" ").length; j++) {
|
||||
if (!foundStations[i].name.toUpperCase().includes(key.toUpperCase().split(" ")[j])) {
|
||||
foundStations[i].probability -= probabilityIncrement * 0.5;
|
||||
}
|
||||
}
|
||||
}
|
||||
let highestProbabilityStation;
|
||||
for (let i = 0; i < foundStations.length; i++) {
|
||||
if (
|
||||
!highestProbabilityStation ||
|
||||
highestProbabilityStation.probability < foundStations[i].probability
|
||||
)
|
||||
highestProbabilityStation = foundStations[i];
|
||||
if (
|
||||
highestProbabilityStation &&
|
||||
highestProbabilityStation.probability === foundStations[i].probability
|
||||
) {
|
||||
highestProbabilityStation = foundStations[i].station;
|
||||
}
|
||||
}
|
||||
return highestProbabilityStation;
|
||||
}
|
@ -1,39 +1,39 @@
|
||||
module.exports = {
|
||||
name: 'statistics',
|
||||
alias: 'stats',
|
||||
usage: '',
|
||||
description: 'Show usage statistics.',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
let stations = client.stations;
|
||||
let currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
let statistics = "";
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
||||
statistics = "You have not listened any radio station";
|
||||
} else {
|
||||
Object.keys(stations).forEach(function(station) {
|
||||
if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) > 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) > 0){
|
||||
statistics += `**${parseInt(station) + 1}** ` + stations[station].name + " \n";
|
||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "dd:hh:mm:ss") + "\n";
|
||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.statisticsTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(statistics)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send(embed);
|
||||
}
|
||||
module.exports = {
|
||||
name: 'statistics',
|
||||
alias: 'stats',
|
||||
usage: '',
|
||||
description: 'Show usage statistics.',
|
||||
permission: 'none',
|
||||
category: 'info',
|
||||
execute(msg, args, client, Discord, command) {
|
||||
let message = {};
|
||||
let stations = client.stations;
|
||||
let currentGuild = client.datastore.getEntry(msg.guild.id);
|
||||
let statistics = "";
|
||||
|
||||
if(!client.stations) {
|
||||
message.errorToGetPlaylist = client.messages.errorToGetPlaylist.replace("%client.config.supportGuild%", client.config.supportGuild);
|
||||
return msg.channel.send(client.messageEmojis["error"] + message.errorToGetPlaylist);
|
||||
}
|
||||
|
||||
if(!currentGuild || currentGuild && !currentGuild.statistics){
|
||||
statistics = "You have not listened any radio station";
|
||||
} else {
|
||||
Object.keys(stations).forEach(function(station) {
|
||||
if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) > 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) > 0){
|
||||
statistics += `**${parseInt(station) + 1}** ` + stations[station].name + " \n";
|
||||
statistics += "Time: " + client.funcs.msToTime(currentGuild.statistics[stations[station].name].time, "dd:hh:mm:ss") + "\n";
|
||||
statistics += "Used: " + currentGuild.statistics[stations[station].name].used + "\n";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const embed = new Discord.MessageEmbed()
|
||||
.setTitle(client.messages.statisticsTitle)
|
||||
.setThumbnail("https://cdn.discordapp.com/emojis/" + client.messageEmojis["statistics"].replace(/[^0-9]+/g, ''))
|
||||
.setColor(client.config.embedColor)
|
||||
.setDescription(statistics)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
return msg.channel.send({ embeds: [embed] });
|
||||
}
|
||||
};
|
@ -21,7 +21,7 @@ module.exports = {
|
||||
.addField(client.messages.statusField4, client.config.version, true)
|
||||
.addField(client.messages.statusField5, client.config.hostedBy, true)
|
||||
.setFooter(client.messages.footerText, "https://cdn.discordapp.com/emojis/" + client.messageEmojis["eximiabots"].replace(/[^0-9]+/g, ''));
|
||||
msg.channel.send(embed);
|
||||
msg.channel.send({ embeds: [embed] });
|
||||
|
||||
}
|
||||
};
|
@ -9,8 +9,8 @@ module.exports = {
|
||||
const radio = client.radio.get(msg.guild.id);
|
||||
if (client.funcs.check(client, msg, command)) {
|
||||
client.funcs.statisticsUpdate(client, msg.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.radio.delete(msg.guild.id);
|
||||
msg.channel.send(client.messageEmojis["stop"] + client.messages.stop);
|
||||
}
|
@ -1,124 +1,128 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class {
|
||||
constructor() {
|
||||
this.map = new Map();
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
loadData() {
|
||||
//console.log("");
|
||||
const dataFiles = fs.readdirSync(path.join(path.dirname(__dirname), 'datastore')).filter(f => f.endsWith('.json'));
|
||||
for (const file of dataFiles) {
|
||||
try {
|
||||
const json = require(`../datastore/${file}`);
|
||||
this.map.set(json.guild.id, json);
|
||||
//console.log('[LOADED] ' + file + " (" + json.guild.id + ")");
|
||||
//console.log(JSON.stringify(json, null, 4));
|
||||
} catch (error) {
|
||||
//console.log('[ERROR] Loading ' + file + ' failed');
|
||||
}
|
||||
}
|
||||
//console.log("");
|
||||
}
|
||||
|
||||
calculateGlobal(client){
|
||||
let guilds = this.map.keys();
|
||||
let stations = client.stations;
|
||||
var statistics = {};
|
||||
|
||||
if(!client.stations) return;
|
||||
|
||||
let calculation = guilds.next();
|
||||
|
||||
while (!calculation.done) {
|
||||
let currentGuild = this.getEntry(calculation.value);
|
||||
if(calculation.value != 'global'){
|
||||
if(stations){
|
||||
Object.keys(stations).forEach(function(station) {
|
||||
if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) != 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) != 0){
|
||||
if(!statistics[stations[station].name]){
|
||||
statistics[stations[station].name] = {};
|
||||
statistics[stations[station].name].time = 0;
|
||||
statistics[stations[station].name].used = 0;
|
||||
}
|
||||
|
||||
statistics[stations[station].name].time = parseInt(statistics[stations[station].name].time)+parseInt(currentGuild.statistics[stations[station].name].time);
|
||||
statistics[stations[station].name].used = parseInt(statistics[stations[station].name].used)+parseInt(currentGuild.statistics[stations[station].name].used);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
calculation = guilds.next();
|
||||
}
|
||||
|
||||
let newData = {};
|
||||
newData.guild = {};
|
||||
newData.guild.id = "global";
|
||||
newData.guild.name = "global";
|
||||
newData.statistics = statistics;
|
||||
this.updateEntry(newData.guild, newData);
|
||||
}
|
||||
|
||||
|
||||
checkEntry(id){
|
||||
if(!this.map.has(id)){
|
||||
this.createEntry(id);
|
||||
//this.showEntry(this.getEntry(id));
|
||||
} else {
|
||||
//this.showEntry(this.getEntry(id));
|
||||
}
|
||||
}
|
||||
|
||||
createEntry(id){
|
||||
let newData = {};
|
||||
newData.guild = {};
|
||||
newData.guild.id = id;
|
||||
newData.statistics = {};
|
||||
this.map.set(id, newData);
|
||||
this.saveEntry(id, newData);
|
||||
}
|
||||
|
||||
getEntry(id){
|
||||
return this.map.get(id);
|
||||
}
|
||||
|
||||
updateEntry(guild, newData) {
|
||||
newData.guild.name = guild.name;
|
||||
this.map.set(guild.id, newData);
|
||||
this.saveEntry(guild.id, newData);
|
||||
//this.showEntry(this.getEntry(guild.id));
|
||||
}
|
||||
|
||||
showEntry(data){
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
createTestFile () {
|
||||
let newData = {
|
||||
"guild": {
|
||||
"id": "test",
|
||||
"name": "Test"
|
||||
},
|
||||
"statistics": {
|
||||
"test": {
|
||||
"time": 0,
|
||||
"used": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.updateEntry(newData.guild, newData);
|
||||
}
|
||||
|
||||
saveEntry(file, data) {
|
||||
data = JSON.stringify(data, null, 4);
|
||||
|
||||
fs.writeFile(path.join(path.dirname(__dirname), 'datastore') + "/" + file + ".json", data, 'utf8', function(err) {
|
||||
if (err) {
|
||||
//console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = class {
|
||||
constructor() {
|
||||
this.map = new Map();
|
||||
this.loadData();
|
||||
}
|
||||
|
||||
loadData() {
|
||||
const dir = path.join(path.dirname(__dirname), '../datastore');
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir);
|
||||
}
|
||||
//console.log("");
|
||||
const dataFiles = fs.readdirSync(path.join(path.dirname(__dirname), '../datastore')).filter(f => f.endsWith('.json'));
|
||||
for (const file of dataFiles) {
|
||||
try {
|
||||
const json = require(`../../datastore/${file}`);
|
||||
this.map.set(json.guild.id, json);
|
||||
//console.log('[LOADED] ' + file + " (" + json.guild.id + ")");
|
||||
//console.log(JSON.stringify(json, null, 4));
|
||||
} catch (error) {
|
||||
//console.log('[ERROR] Loading ' + file + ' failed');
|
||||
}
|
||||
}
|
||||
//console.log("");
|
||||
}
|
||||
|
||||
calculateGlobal(client){
|
||||
let guilds = this.map.keys();
|
||||
let stations = client.stations;
|
||||
var statistics = {};
|
||||
|
||||
if(!client.stations) return;
|
||||
|
||||
let calculation = guilds.next();
|
||||
|
||||
while (!calculation.done) {
|
||||
let currentGuild = this.getEntry(calculation.value);
|
||||
if(calculation.value != 'global'){
|
||||
if(stations){
|
||||
Object.keys(stations).forEach(function(station) {
|
||||
if(currentGuild.statistics[stations[station].name] && currentGuild.statistics[stations[station].name].time && parseInt(currentGuild.statistics[stations[station].name].time) != 0 && currentGuild.statistics[stations[station].name].used && parseInt(currentGuild.statistics[stations[station].name].used) != 0){
|
||||
if(!statistics[stations[station].name]){
|
||||
statistics[stations[station].name] = {};
|
||||
statistics[stations[station].name].time = 0;
|
||||
statistics[stations[station].name].used = 0;
|
||||
}
|
||||
|
||||
statistics[stations[station].name].time = parseInt(statistics[stations[station].name].time)+parseInt(currentGuild.statistics[stations[station].name].time);
|
||||
statistics[stations[station].name].used = parseInt(statistics[stations[station].name].used)+parseInt(currentGuild.statistics[stations[station].name].used);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
calculation = guilds.next();
|
||||
}
|
||||
|
||||
let newData = {};
|
||||
newData.guild = {};
|
||||
newData.guild.id = "global";
|
||||
newData.guild.name = "global";
|
||||
newData.statistics = statistics;
|
||||
this.updateEntry(newData.guild, newData);
|
||||
}
|
||||
|
||||
|
||||
checkEntry(id){
|
||||
if(!this.map.has(id)){
|
||||
this.createEntry(id);
|
||||
//this.showEntry(this.getEntry(id));
|
||||
} else {
|
||||
//this.showEntry(this.getEntry(id));
|
||||
}
|
||||
}
|
||||
|
||||
createEntry(id){
|
||||
let newData = {};
|
||||
newData.guild = {};
|
||||
newData.guild.id = id;
|
||||
newData.statistics = {};
|
||||
this.map.set(id, newData);
|
||||
this.saveEntry(id, newData);
|
||||
}
|
||||
|
||||
getEntry(id){
|
||||
return this.map.get(id);
|
||||
}
|
||||
|
||||
updateEntry(guild, newData) {
|
||||
newData.guild.name = guild.name;
|
||||
this.map.set(guild.id, newData);
|
||||
this.saveEntry(guild.id, newData);
|
||||
//this.showEntry(this.getEntry(guild.id));
|
||||
}
|
||||
|
||||
showEntry(data){
|
||||
console.log(data);
|
||||
}
|
||||
|
||||
createTestFile () {
|
||||
let newData = {
|
||||
"guild": {
|
||||
"id": "test",
|
||||
"name": "Test"
|
||||
},
|
||||
"statistics": {
|
||||
"test": {
|
||||
"time": 0,
|
||||
"used": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.updateEntry(newData.guild, newData);
|
||||
}
|
||||
|
||||
saveEntry(file, data) {
|
||||
data = JSON.stringify(data, null, 4);
|
||||
|
||||
fs.writeFile(path.join(path.dirname(__dirname), '../datastore') + "/" + file + ".json", data, 'utf8', function(err) {
|
||||
if (err) {
|
||||
//console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
@ -1,38 +1,38 @@
|
||||
module.exports = {
|
||||
name: 'emojis',
|
||||
async execute(client) {
|
||||
let customEmojis = {
|
||||
logo: "<:RadioX:688765708808487072>",
|
||||
eximiabots: "<:EximiaBots:693277919929303132>",
|
||||
list: "<:RadioXList:688541155519889482>",
|
||||
play: "<:RadioXPlay:688541155712827458>",
|
||||
stop: "<:RadioXStop:688541155377414168>",
|
||||
statistics: "<:RadioXStatistics:694954485507686421>",
|
||||
maintenance: "<:RadioXMaintenance:695043843057254493>",
|
||||
error: "<:RadioXError:688541155792781320>"
|
||||
};
|
||||
|
||||
let fallbackEmojis = {
|
||||
logo: "RadioX",
|
||||
eximiabots: "EximiaBots",
|
||||
list: "📜",
|
||||
play: "▶️",
|
||||
stop: "⏹️",
|
||||
statistics: "📊",
|
||||
maintenance: "🛠️",
|
||||
error: "❌"
|
||||
};
|
||||
|
||||
client.messageEmojis = {};
|
||||
|
||||
for (customEmojiName in customEmojis) {
|
||||
customEmojiID = customEmojis[customEmojiName].replace(/[^0-9]+/g, '');
|
||||
customEmoji = client.emojis.cache.get(customEmojiID);
|
||||
if (customEmoji) {
|
||||
client.messageEmojis[customEmojiName] = customEmojis[customEmojiName];
|
||||
} else {
|
||||
client.messageEmojis[customEmojiName] = fallbackEmojis[customEmojiName];
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = {
|
||||
name: 'emojis',
|
||||
async execute(client) {
|
||||
let customEmojis = {
|
||||
logo: "<:RadioX:688765708808487072>",
|
||||
eximiabots: "<:EximiaBots:693277919929303132>",
|
||||
list: "<:RadioXList:688541155519889482>",
|
||||
play: "<:RadioXPlay:688541155712827458>",
|
||||
stop: "<:RadioXStop:688541155377414168>",
|
||||
statistics: "<:RadioXStatistics:694954485507686421>",
|
||||
maintenance: "<:RadioXMaintenance:695043843057254493>",
|
||||
error: "<:RadioXError:688541155792781320>"
|
||||
};
|
||||
|
||||
let fallbackEmojis = {
|
||||
logo: "RadioX",
|
||||
eximiabots: "EximiaBots",
|
||||
list: "📜",
|
||||
play: "▶️",
|
||||
stop: "⏹️",
|
||||
statistics: "📊",
|
||||
maintenance: "🛠️",
|
||||
error: "❌"
|
||||
};
|
||||
|
||||
client.messageEmojis = {};
|
||||
|
||||
for (const customEmojiName in customEmojis) {
|
||||
const customEmojiID = customEmojis[customEmojiName].replace(/[^0-9]+/g, '');
|
||||
const customEmoji = client.emojis.cache.get(customEmojiID);
|
||||
if (customEmoji) {
|
||||
client.messageEmojis[customEmojiName] = customEmojis[customEmojiName];
|
||||
} else {
|
||||
client.messageEmojis[customEmojiName] = fallbackEmojis[customEmojiName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ module.exports = {
|
||||
|
||||
client.developers = "";
|
||||
let user = "";
|
||||
for (i = 0; i < client.config.devId.length; i++) {
|
||||
for (let i = 0; i < client.config.devId.length; i++) {
|
||||
user = await client.users.fetch(client.config.devId[i]);
|
||||
if (i == client.config.devId.length - 1) {
|
||||
client.developers += user.tag;
|
@ -1,3 +1,8 @@
|
||||
const {
|
||||
getVoiceConnection,
|
||||
joinVoiceChannel
|
||||
} = require("@discordjs/voice");
|
||||
|
||||
module.exports = {
|
||||
name: "voiceStateUpdate",
|
||||
async execute(client, oldState, newState) {
|
||||
@ -7,8 +12,11 @@ module.exports = {
|
||||
if (!radio) return;
|
||||
|
||||
if (newState.member.id === client.user.id && oldState.member.id === client.user.id) {
|
||||
|
||||
if (newState.channel === null) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
return client.radio.delete(newState.guild.id);
|
||||
}
|
||||
|
||||
@ -16,13 +24,20 @@ module.exports = {
|
||||
if (!newPermissions.has("CONNECT") || !newPermissions.has("SPEAK") || !newPermissions.has("VIEW_CHANNEL")) {
|
||||
try {
|
||||
setTimeout(
|
||||
async () => (radio.connection = await oldState.channel.join()),
|
||||
async () => (
|
||||
radio.connection = joinVoiceChannel({
|
||||
channelId: oldState.channel.id,
|
||||
guildId: oldState.channel.guild.id,
|
||||
adapterCreator: oldState.channel.guild.voiceAdapterCreator
|
||||
})
|
||||
//radio.connection = await oldState.channel.join()
|
||||
),
|
||||
1000
|
||||
);
|
||||
} catch (error) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.radio.delete(oldState.guild.id);
|
||||
}
|
||||
return;
|
||||
@ -30,16 +45,17 @@ module.exports = {
|
||||
if (newState.channel !== radio.voiceChannel) {
|
||||
change = true;
|
||||
radio.voiceChannel = newState.channel;
|
||||
radio.connection = await newState.channel.join();
|
||||
radio.connection = getVoiceConnection(newState.channel.guild.id);
|
||||
//radio.connection = await newState.channel.join();
|
||||
}
|
||||
}
|
||||
if ((oldState.channel.members.size === 1 && oldState.channel === radio.voiceChannel) || change) {
|
||||
setTimeout(() => {
|
||||
if (!radio || !radio.connection.dispatcher || !radio.connection.dispatcher === null) return;
|
||||
if (!radio || !radio.connection || !radio.connection === null) return;
|
||||
if (radio.voiceChannel.members.size === 1) {
|
||||
client.funcs.statisticsUpdate(client, newState.guild, radio);
|
||||
radio.connection.dispatcher.destroy();
|
||||
radio.voiceChannel.leave();
|
||||
radio.connection?.destroy();
|
||||
radio.audioPlayer?.stop();
|
||||
client.radio.delete(newState.guild.id);
|
||||
}
|
||||
}, 120000);
|
@ -1,7 +1,7 @@
|
||||
module.exports = function (devList, authorID){
|
||||
let response = false;
|
||||
Object.keys(devList).forEach(function(oneDev) {
|
||||
devID = devList[oneDev];
|
||||
let devID = devList[oneDev];
|
||||
if(authorID == devID){
|
||||
response = true;
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
module.exports = function msToTime(duration, format) {
|
||||
var seconds = Math.floor((duration / 1000) % 60),
|
||||
minutes = Math.floor((duration / (1000 * 60)) % 60),
|
||||
hours = Math.floor((duration / (1000 * 60 * 60)) % 24),
|
||||
days = Math.floor((duration / (1000 * 60 * 60 * 24)));
|
||||
|
||||
days = (days < 10) ? "0" + days : days;
|
||||
hours = (hours < 10) ? "0" + hours : hours;
|
||||
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
||||
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
||||
|
||||
if (format === "hh:mm:ss") {
|
||||
return `${hours}:${minutes}:${seconds}`;
|
||||
} else if (format === "dd:hh:mm:ss") {
|
||||
return `${days}:${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
module.exports = function msToTime(duration, format) {
|
||||
var seconds = Math.floor((duration / 1000) % 60),
|
||||
minutes = Math.floor((duration / (1000 * 60)) % 60),
|
||||
hours = Math.floor((duration / (1000 * 60 * 60)) % 24),
|
||||
days = Math.floor((duration / (1000 * 60 * 60 * 24)));
|
||||
|
||||
days = (days < 10) ? "0" + days : days;
|
||||
hours = (hours < 10) ? "0" + hours : hours;
|
||||
minutes = (minutes < 10) ? "0" + minutes : minutes;
|
||||
seconds = (seconds < 10) ? "0" + seconds : seconds;
|
||||
|
||||
if (format === "hh:mm:ss") {
|
||||
return `${hours}:${minutes}:${seconds}`;
|
||||
} else if (format === "dd:hh:mm:ss") {
|
||||
return `${days}:${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
}
|
@ -1,26 +1,22 @@
|
||||
module.exports = function statisticsUpdate(client, guild, radio) {
|
||||
|
||||
client.datastore.checkEntry(guild.id);
|
||||
|
||||
radio.currentGuild = client.datastore.getEntry(guild.id);
|
||||
|
||||
if(!radio.currentGuild.statistics[radio.station.name]){
|
||||
radio.currentGuild.statistics[radio.station.name] = {};
|
||||
radio.currentGuild.statistics[radio.station.name].time = 0;
|
||||
radio.currentGuild.statistics[radio.station.name].used = 0;
|
||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
||||
}
|
||||
|
||||
if(!radio.connection.dispatcher){
|
||||
let date = new Date();
|
||||
radio.currentTime = date.getTime();
|
||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||
} else {
|
||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.connection.dispatcher.streamTime.toFixed(0));
|
||||
}
|
||||
|
||||
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
||||
client.datastore.calculateGlobal(client);
|
||||
module.exports = function statisticsUpdate(client, guild, radio) {
|
||||
|
||||
client.datastore.checkEntry(guild.id);
|
||||
|
||||
radio.currentGuild = client.datastore.getEntry(guild.id);
|
||||
|
||||
if(!radio.currentGuild.statistics[radio.station.name]){
|
||||
radio.currentGuild.statistics[radio.station.name] = {};
|
||||
radio.currentGuild.statistics[radio.station.name].time = 0;
|
||||
radio.currentGuild.statistics[radio.station.name].used = 0;
|
||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
||||
}
|
||||
|
||||
let date = new Date();
|
||||
radio.currentTime = date.getTime();
|
||||
radio.playTime = parseInt(radio.currentTime)-parseInt(radio.startTime);
|
||||
radio.currentGuild.statistics[radio.station.name].time = parseInt(radio.currentGuild.statistics[radio.station.name].time)+parseInt(radio.playTime);
|
||||
|
||||
radio.currentGuild.statistics[radio.station.name].used = parseInt(radio.currentGuild.statistics[radio.station.name].used)+1;
|
||||
client.datastore.updateEntry(guild, radio.currentGuild);
|
||||
client.datastore.calculateGlobal(client);
|
||||
}
|
@ -1,45 +1,40 @@
|
||||
module.exports = {
|
||||
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!",
|
||||
runningCommandFailed: "Running this command failed!",
|
||||
noPermsEmbed: "I cannot send embeds (Embed links).",
|
||||
bugTitle: "Found a bug with %client.user.username%?",
|
||||
bugDescription: "Join the support server \n %client.config.supportGuild%",
|
||||
helpTitle: "%client.user.username% help:",
|
||||
helpDescription: "%commands% \n %client.config.prefix%help <command> to see more information about a command.",
|
||||
helpCommandTitle: "%client.config.prefix%%command.name% %command.usage%",
|
||||
helpCommandDescription: "%command.description% \n Command Alias: %command.alias%",
|
||||
inviteTitle: "Invite %client.user.username% to your Discord server!",
|
||||
listTitle: "Radio Stations",
|
||||
nowplayingTitle: "Now Playing",
|
||||
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %client.funcs.msToTime(completed, \"hh:mm:ss\")%",
|
||||
noVoiceChannel: "You need to be in a voice channel to play radio!",
|
||||
noQuery: "You need to use a number or search for a supported station!",
|
||||
noPermsConnect: "I cannot connect to your voice channel.",
|
||||
noPermsSpeak: "I cannot speak in your voice channel.",
|
||||
wrongStationNumber: "No such station!",
|
||||
tooShortSearch: "Station must be over 2 characters!",
|
||||
noSearchResults: "No stations found!",
|
||||
errorPlaying: "An error has occured while playing radio!",
|
||||
play: "Start playing: %radio.station.name%",
|
||||
stop: "Stopped playback!",
|
||||
currentVolume: "Current volume: **%radio.volume%**",
|
||||
maxVolume: "The max volume is `100`!",
|
||||
invalidVolume: "You need to enter a valid __number__.",
|
||||
negativeVolume: "The volume needs to be a positive number!",
|
||||
newVolume: "Volume is now: **%volume%**",
|
||||
statisticsTitle: "Statistics",
|
||||
maintenanceTitle: "Maintenance",
|
||||
errorToGetPlaylist: "You can't use this bot because it has no playlist available. Check more information in our Discord support server %client.config.supportGuild% !",
|
||||
notAllowed: "You are not allowed to do that!",
|
||||
sendedMaintenanceMessage: "This bot is going to be under maintenance!",
|
||||
footerText: "EximiaBots by Warén Group",
|
||||
statusTitle: "%client.user.username% Status",
|
||||
statusField1: "Bot Latency",
|
||||
statusField2: "API Latency",
|
||||
statusField3: "Uptime",
|
||||
statusField4: "Version",
|
||||
statusField5: "Hosted by",
|
||||
errorStationURL: "Station can't be URL"
|
||||
module.exports = {
|
||||
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!",
|
||||
runningCommandFailed: "Running this command failed!",
|
||||
noPermsEmbed: "I cannot send embeds (Embed links).",
|
||||
bugTitle: "Found a bug with %client.user.username%?",
|
||||
bugDescription: "Join the support server \n %client.config.supportGuild%",
|
||||
helpTitle: "%client.user.username% help:",
|
||||
helpDescription: "%commands%",
|
||||
helpCommandTitle: "%client.config.prefix%%command.name% %command.usage%",
|
||||
helpCommandDescription: "%command.description% \n Command Alias: %command.alias%",
|
||||
inviteTitle: "Invite %client.user.username% to your Discord server!",
|
||||
listTitle: "Radio Stations",
|
||||
nowplayingTitle: "Now Playing",
|
||||
nowplayingDescription: "**%radio.station.name%** \n Owner: %radio.station.owner% \n %client.funcs.msToTime(completed, \"hh:mm:ss\")%",
|
||||
noVoiceChannel: "You need to be in a voice channel to play radio!",
|
||||
noQuery: "You need to use a number or search for a supported station!",
|
||||
noPermsConnect: "I cannot connect to your voice channel.",
|
||||
noPermsSpeak: "I cannot speak in your voice channel.",
|
||||
wrongStationNumber: "No such station!",
|
||||
tooShortSearch: "Station must be over 2 characters!",
|
||||
noSearchResults: "No stations found!",
|
||||
errorPlaying: "An error has occured while playing radio!",
|
||||
play: "Start playing: %radio.station.name%",
|
||||
stop: "Stopped playback!",
|
||||
statisticsTitle: "Statistics",
|
||||
maintenanceTitle: "Maintenance",
|
||||
errorToGetPlaylist: "You can't use this bot because it has no playlist available. Check more information in our Discord support server %client.config.supportGuild% !",
|
||||
notAllowed: "You are not allowed to do that!",
|
||||
sendedMaintenanceMessage: "This bot is going to be under maintenance!",
|
||||
footerText: "EximiaBots by Warén Group",
|
||||
statusTitle: "%client.user.username% Status",
|
||||
statusField1: "Bot Latency",
|
||||
statusField2: "API Latency",
|
||||
statusField3: "Uptime",
|
||||
statusField4: "Version",
|
||||
statusField5: "Hosted by",
|
||||
errorStationURL: "Station can't be URL"
|
||||
};
|
3
src/client/utils/typings.ts
Normal file
3
src/client/utils/typings.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export interface command { }
|
||||
|
||||
export interface radio {}
|
@ -17,7 +17,6 @@ module.exports = {
|
||||
|
||||
//misc
|
||||
embedColor: "#88aa00",
|
||||
invite: "https://discordapp.com/api/oauth2/authorize?client_id=684109535312609409&permissions=3427328&scope=bot",
|
||||
hostedBy: "[Warén Group](https://waren.io)",
|
||||
|
||||
//Settings
|
3
src/index.js
Normal file
3
src/index.js
Normal file
@ -0,0 +1,3 @@
|
||||
const { default: RadioClient } = require("./Client");
|
||||
|
||||
const client = new RadioClient();
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "commonjs",
|
||||
"lib": ["esnext"],
|
||||
"allowJs": true,
|
||||
"outDir": "build",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"exclude": ["build", "node_modules", "datastore"]
|
||||
}
|
Reference in New Issue
Block a user