diff --git a/src/assets/bingus.png b/src/assets/bingus.png new file mode 100644 index 0000000..f894c5d Binary files /dev/null and b/src/assets/bingus.png differ diff --git a/src/assets/spoingus.png b/src/assets/spoingus.png new file mode 100644 index 0000000..f4a2963 Binary files /dev/null and b/src/assets/spoingus.png differ diff --git a/src/modules/event/event.abstract.ts b/src/modules/event/event.abstract.ts index 84b29b6..cc76ccb 100644 --- a/src/modules/event/event.abstract.ts +++ b/src/modules/event/event.abstract.ts @@ -1,6 +1,4 @@ import { Events } from 'discord.js'; -import { ACollectionEntry } from '../../helpers/abstract/collectionEntry.abstract'; -import { DiscordService } from '../discord/discord.service'; export abstract class AEvent { abstract readonly event: Events; diff --git a/src/modules/event/interfaces/iresponse.ts b/src/modules/event/interfaces/iresponse.ts index c1a58c5..61c9adb 100644 --- a/src/modules/event/interfaces/iresponse.ts +++ b/src/modules/event/interfaces/iresponse.ts @@ -1,4 +1,10 @@ export interface IResponse { matcher: RegExp; response: string | Object; + responseType?: ResponseType; +} + +export enum ResponseType { + Reply = 'reply', + Message = 'message', } diff --git a/src/modules/event/services/messageEvent.ts b/src/modules/event/services/messageEvent.ts index 8f012b0..7c9e01c 100644 --- a/src/modules/event/services/messageEvent.ts +++ b/src/modules/event/services/messageEvent.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; -import { Events, Message } from 'discord.js'; +import { Events } from 'discord.js'; import { AEvent } from '../event.abstract'; -import { IResponse } from '../interfaces/iresponse'; +import { IResponse, ResponseType } from '../interfaces/iresponse'; @Injectable() export class MessageEvent extends AEvent { event: Events = Events.MessageCreate; // ShardEvents.Message; @@ -11,34 +11,52 @@ export class MessageEvent extends AEvent { { matcher: /wag1/i, response: 'wagwan2', + responseType: ResponseType.Reply, }, { matcher: /^.{150,}$/m, response: 'halbe Bibel, ganzer huansohn ?XD', + responseType: ResponseType.Reply, }, { matcher: /https:\/\/.*/, response: 'send yo virus link to someone else no?xd', + responseType: ResponseType.Reply, }, { matcher: /wadim/i, response: '#goth', + responseType: ResponseType.Message, }, { matcher: /digga/i, response: 'digga mich nicht', + responseType: ResponseType.Reply, }, { matcher: /alina/i, response: 'Schuhgröße 36, weißer Nagellack 🥵', + responseType: ResponseType.Message, }, { matcher: /monke/i, response: '🐒 🦧', + responseType: ResponseType.Message, }, { matcher: /hego/i, response: { files: ['src/assets/textbox-donowall.gif'] }, + responseType: ResponseType.Reply, + }, + { + matcher: /bingus/i, + response: { files: ['src/assets/bingus.png'] }, + responseType: ResponseType.Message, + }, + { + matcher: /spoingus/i, + response: { files: ['src/assets/spoingus.png'] }, + responseType: ResponseType.Message, }, ]; @@ -50,8 +68,11 @@ export class MessageEvent extends AEvent { this.responseList.forEach((res) => { var testRes = res.matcher.test(content); if (testRes) { - message.reply(res.response); - // channel.send(res.response); + if (res?.responseType == ResponseType.Reply) { + message.reply(res.response); + } else { + channel.send(res.response); + } } }); });