Skip to content

Commit

Permalink
feat: basslineコマンドを追加 (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiratake authored Aug 27, 2023
1 parent d615e55 commit 441a93a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/commands/bassline.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Discord } from '@/discord'
import { Message } from 'discord.js'
import { BaseCommand, Permission } from '.'

export class BasslineCommand implements BaseCommand {
get name(): string {
return 'bassline'
}

get permissions(): Permission[] | null {
return null
}

getBasslineText(text: string = '221498004505362433'): string {
const suspectName = /^\d+$/.test(text) ? `<@${text}>` : text
return [
'ベースラインパーティーの途中ですが、ここで臨時ニュースをお伝えします。今日昼頃、わりとキモく女性にナンパをしたうえ、路上で爆睡をしたとして、',
'道の上で寝たり、女の子に声をかけたりしたらいけないんだよ罪の容疑で、',
`自称優良物件、${suspectName} 容疑者が逮捕されました。`,
].join('\n')
}

async execute(_discord: Discord, message: Message<boolean>): Promise<void> {
const [, ...suspectName] = message.content.split(' ')
await message.channel.send(
suspectName.length > 0
? this.getBasslineText(suspectName.join(' '))
: this.getBasslineText()
)
}
}
2 changes: 2 additions & 0 deletions src/discord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { Logger } from '@book000/node-utils'
import { BaseDiscordEvent } from './events'
import { Configuration } from './config'
import { BaseCommand } from './commands'
import { BasslineCommand } from './commands/bassline'
import { PingCommand } from './commands/ping'
import { PotatoCommand } from './commands/potato'

export class Discord {
public readonly client: Client

public static readonly commands: BaseCommand[] = [
new BasslineCommand(),
new PingCommand(),
new PotatoCommand(),
]
Expand Down

0 comments on commit 441a93a

Please sign in to comment.