witness commit

This commit is contained in:
Ben
2023-07-09 16:24:01 -04:00
parent 4b4b04a52c
commit b6ddca5a8f
6 changed files with 39 additions and 23 deletions
+15 -2
View File
@@ -22,6 +22,7 @@ const commands = [
@Injectable()
export class DiscordService implements OnModuleInit {
private token: string;
private clientId: string;
private guildId: string;
@@ -37,6 +38,10 @@ export class DiscordService implements OnModuleInit {
this.guildId = this.configService.get('DISCORD_BOT_GUILD_ID');
this.channelId = this.configService.get('DISCORD_BOT_CHANNEL_ID')
if (this.token.length < 1 || this.clientId.length < 1 || this.guildId.length < 1 || this.channelId.length < 1) {
return;
}
console.log('discord init')
this.commandCollection = new Collection();
@@ -49,6 +54,10 @@ export class DiscordService implements OnModuleInit {
async onModuleInit(): Promise<void> {
if (this.bot == null) {
return;
}
await this.registerCommands();
@@ -93,9 +102,13 @@ export class DiscordService implements OnModuleInit {
}
}
public async notifySUbscribersBlockFound() {
public async notifySUbscribersBlockFound(message: string) {
if (this.bot == null) {
return;
}
const guild = await this.bot.guilds.fetch(this.guildId);
const channel = await guild.channels.fetch(this.channelId) as TextChannel;
channel.send("Block Found!")
channel.send(`Block Found! result ${message}`)
}
}