Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
markokajzer committed Aug 17, 2018
1 parent 073ad9e commit b0cc3b7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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"
}
Expand Down
16 changes: 8 additions & 8 deletions src/SoundBot.ts → src/bot/SoundBot.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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() {
Expand All @@ -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;

Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion src/bot.ts → src/main.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/MessageHandler.ts → src/message/MessageHandler.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 3 additions & 1 deletion tslint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

defaultSeverity: error
defaultSeverity: warning
extends:
- tslint:recommended

Expand Down Expand Up @@ -35,6 +35,8 @@ rules:
- true
- single
- avoid-escape
radix:
- false
space-before-function-paren:
- true
- anonymous: always
Expand Down

0 comments on commit b0cc3b7

Please sign in to comment.