Skip to content

Commit

Permalink
feat: 「えんえん」に対する自動リアクション機能を実装 (#70)
Browse files Browse the repository at this point in the history
Co-authored-by: Tomachi <[email protected]>
  • Loading branch information
Omuretsu and book000 authored Aug 27, 2023
1 parent dafc11e commit ef9393a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { SuperCommand } from './commands/super'
import { PowaCommand } from './commands/powa'
import { AlphaCommand } from './commands/alpha'
import { GreetingEvent } from './events/greeting'
import { EnenEvent } from './events/enen'

export class Discord {
private config: Configuration
Expand Down Expand Up @@ -43,7 +44,10 @@ export class Discord {
this.client.on('ready', this.onReady.bind(this))
this.client.on('messageCreate', this.onMessageCreate.bind(this))

const events: BaseDiscordEvent<any>[] = [new GreetingEvent(this)]
const events: BaseDiscordEvent<any>[] = [
new GreetingEvent(this),
new EnenEvent(this),
]
for (const event of events) {
event.register()
}
Expand Down
14 changes: 14 additions & 0 deletions src/events/enen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Message } from 'discord.js'
import { BaseDiscordEvent } from '.'

export class EnenEvent extends BaseDiscordEvent<'messageCreate'> {
get eventName(): 'messageCreate' {
return 'messageCreate'
}

async execute(message: Message<boolean>): Promise<void> {
if (message.content.includes('えんえん')) {
await message.react('🥲')
}
}
}

0 comments on commit ef9393a

Please sign in to comment.