46 lines
1.0 KiB
TypeScript
46 lines
1.0 KiB
TypeScript
|
import { Channel, Client } from 'discord.js';
|
||
|
import { isBooleanObject } from 'util/types';
|
||
|
import { ImplementableApi } from './implementableApi';
|
||
|
|
||
|
namespace DiscordParser {
|
||
|
export type Config = ImplementableApi.Config & {
|
||
|
token: string;
|
||
|
};
|
||
|
}
|
||
|
|
||
|
class DiscordParser extends ImplementableApi {
|
||
|
readonly token: string;
|
||
|
readonly channelid: string;
|
||
|
client: Client;
|
||
|
|
||
|
constructor(readonly config: DiscordParser.Config) {
|
||
|
super(config);
|
||
|
this.token = config.token;
|
||
|
// this.settingEvents();
|
||
|
this.client = new Client();
|
||
|
this.instantiateClient();
|
||
|
}
|
||
|
|
||
|
private instantiateClient() {
|
||
|
this.client.login(this.token);
|
||
|
}
|
||
|
|
||
|
public receivedMessage(message: ImplementableApi.Message) {
|
||
|
switch (message.type) {
|
||
|
case 'newEntriesNotify':
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private sendMsg(message: string) {
|
||
|
// this.client.channels.resolveID();
|
||
|
}
|
||
|
|
||
|
private settingEvents(): void {
|
||
|
throw 'empty';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export { DiscordParser };
|