diff --git a/package.json b/package.json index 23c9adec..8cfd3a73 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "discord-soundbot", "version": "1.0.2", - "description": "A Soundboard Bot for Discord Bot", + "description": "A Soundboard for Discord", "repository": { "type": "git", "url": "https://github.com/markokajzer/discord-soundbot" @@ -40,7 +40,7 @@ "clean": "rm -rf dist", "build": "tsc -p tsconfig.json", "lint": "tslint -p tsconfig.json", - "serve": "node dist/bot.js", + "serve": "node dist/main.js", "start": "npm run build && npm run serve", "release": "npm run build && npm run lint" } diff --git a/src/SoundBot.ts b/src/bot/SoundBot.ts similarity index 92% rename from src/SoundBot.ts rename to src/bot/SoundBot.ts index 59aa61cb..a068291d 100644 --- a/src/SoundBot.ts +++ b/src/bot/SoundBot.ts @@ -1,9 +1,9 @@ -import config from '../config/config.json'; +import config from '../../config/config.json'; import Discord from 'discord.js'; -import CommandCollection from './commands/CommandCollection'; -import MessageHandler from './MessageHandler'; +import CommandCollection from '../commands/CommandCollection'; +import MessageHandler from '../message/MessageHandler'; export default class SoundBot extends Discord.Client { private readonly commands: CommandCollection; @@ -22,8 +22,8 @@ export default class SoundBot extends Discord.Client { private addEventListeners() { this.on('ready', this.readyListener); - this.on('guildCreate', this.joinServerListener); this.on('message', this.messageListener); + this.on('guildCreate', this.joinServerListener); } private readyListener() { @@ -35,6 +35,10 @@ export default class SoundBot extends Discord.Client { this.user.setActivity(config.game); } + private messageListener(message: Discord.Message) { + this.messageHandler.handle(message); + } + private joinServerListener(guild: Discord.Guild) { if (!guild.available) return; @@ -58,8 +62,4 @@ export default class SoundBot extends Discord.Client { if (!channels.size) return null; return (channels.first() as Discord.TextChannel); } - - private messageListener(message: Discord.Message) { - this.messageHandler.handle(message); - } } diff --git a/src/bot.ts b/src/main.ts similarity index 89% rename from src/bot.ts rename to src/main.ts index 9eb4cbde..f0f4c22f 100644 --- a/src/bot.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ import config from '../config/config.json'; -import SoundBot from './SoundBot'; +import SoundBot from './bot/SoundBot'; const bot = new SoundBot(); bot.start(); diff --git a/src/MessageHandler.ts b/src/message/MessageHandler.ts similarity index 81% rename from src/MessageHandler.ts rename to src/message/MessageHandler.ts index 12941717..b696e144 100644 --- a/src/MessageHandler.ts +++ b/src/message/MessageHandler.ts @@ -1,10 +1,10 @@ -import config from '../config/config.json'; +import config from '../../config/config.json'; import { Message } from 'discord.js'; -import './discord/Message'; +import '../discord/Message'; -import CommandCollection from './commands/CommandCollection'; -import DatabaseAdapter from './db/DatabaseAdapter'; +import CommandCollection from '../commands/CommandCollection'; +import DatabaseAdapter from '../db/DatabaseAdapter'; export default class MessageHandler { private readonly db: DatabaseAdapter; diff --git a/tslint.yml b/tslint.yml index 75dd8a9b..2ccdd1b1 100644 --- a/tslint.yml +++ b/tslint.yml @@ -1,6 +1,6 @@ --- -defaultSeverity: error +defaultSeverity: warning extends: - tslint:recommended @@ -35,6 +35,8 @@ rules: - true - single - avoid-escape + radix: + - false space-before-function-paren: - true - anonymous: always