Skip to content

Commit

Permalink
Moved to discord-bot-quickstart on the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Malexion committed Jul 20, 2020
1 parent 7bade5f commit b53c059
Show file tree
Hide file tree
Showing 29 changed files with 339 additions and 955 deletions.
51 changes: 51 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@types/winston": "^2.4.4",
"@types/yt-search": "^2.0.0",
"bufferutil": "^4.0.1",
"discord-bot-quickstart": "0.0.12",
"discord-command-parser": "^1.4.3",
"discord.js": "^12.2.0",
"erlpack": "^0.1.3",
Expand Down
24 changes: 12 additions & 12 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import * as fs from 'fs';
import { requireFile, writeJson, logger, BotConfig, Bot } from './resources';
import { requireFile, projectDir, writeJson } from 'discord-bot-quickstart';
import { IRhythmBotConfig, RhythmBot } from './bot';

process.on('unhandledRejection', error => logger.error('Uncaught Promise Rejection', error));

if (!fs.existsSync('./bot-config.json')) {
writeJson({ discord: { token: '<BOT-TOKEN>' } }, './bot-config.json');
const configPath = projectDir('../bot-config.json');
if (!fs.existsSync(configPath)) {
writeJson({ discord: { token: '<BOT-TOKEN>' } }, configPath);
}
let config: BotConfig = requireFile('./bot-config.json');

let config: IRhythmBotConfig = requireFile('../bot-config.json');

const bot = new RhythmBot(config);

if (!!config && config.discord.token === '<BOT-TOKEN>') {
logger.debug('Invalid Token - Create valid token in the Discord Developer Portal');
bot.logger.debug('Invalid Token - Create valid token in the Discord Developer Portal');
console.log('Invalid Token - Create valid token in the Discord Developer Portal');
process.exit(0);
}

let bot = new Bot(config);

bot.connect()
.then(() => {
logger.debug('Bot Ready');
console.log('Bot Online');
bot.logger.debug('Rhythm Bot Online');
bot.listen();
})
.catch(err => logger.error(err));
.catch(err => bot.logger.error(err));
28 changes: 28 additions & 0 deletions src/bot/bot-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { IBotConfig } from 'discord-bot-quickstart';

export interface IRhythmBotConfig extends IBotConfig {
auto?: {
deafen?: boolean,
pause?: boolean,
play?: boolean,
reconnect?: boolean
},
queue?: {
announce?: boolean;
repeat?: boolean;
},
stream?: {
seek?: number;
packetLossPercentage?: number;
forwardErrorCorrection?: boolean;
volume?: number;
bitrate?: number | 'auto';
},
emojis?: {
addSong?: string;
stopSong?: string;
playSong?: string;
pauseSong?: string;
skipSong?: string;
}
}
23 changes: 0 additions & 23 deletions src/bot/bot-interface.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/bot/bot-status.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, PresenceStatus, PresenceStatusData } from "discord.js";
import { Client, PresenceStatusData } from 'discord.js';

export class BotStatus {
client: Client;
Expand Down
Loading

0 comments on commit b53c059

Please sign in to comment.