Skip to content

Commit

Permalink
fix: 引数の型を EmojiEvent に修正 (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikuroXina authored Feb 4, 2023
1 parent 800c6c1 commit bfc69ff
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/service/emoji-log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Snowflake } from '../model/id.js';
import type { EmojiEventResponder, RoleEvent } from '../runner/index.js';
import type { EmojiEvent, EmojiEventResponder } from '../runner/index.js';
import type { StandardOutput } from './output.js';

export interface EmojiData {
Expand All @@ -9,22 +9,25 @@ export interface EmojiData {

export class EmojiLog implements EmojiEventResponder<EmojiData> {
constructor(private readonly output: StandardOutput) {}
async on(event: RoleEvent, role: EmojiData): Promise<void> {
async on(
event: EmojiEvent,
{ emoji, emojiAuthorId }: EmojiData
): Promise<void> {
if (event !== 'CREATE') {
return;
}

if (role.emojiAuthorId == undefined) {
if (emojiAuthorId == undefined) {
await this.output.sendEmbed({
title: '絵文字警察',
description: `誰かが ${role.emoji} を作成しました`
description: `誰かが ${emoji} を作成しました`
});
return;
}

await this.output.sendEmbed({
title: '絵文字警察',
description: `<@${role.emojiAuthorId}> が ${role.emoji} を作成しました`
description: `<@${emojiAuthorId}> が ${emoji} を作成しました`
});
}
}

0 comments on commit bfc69ff

Please sign in to comment.