Skip to content

Commit

Permalink
Raw /verify message feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Seefaaa committed Sep 14, 2024
1 parent 0645c2d commit af04d2b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/events/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './interactionCreate';
export * from './messageCreate';
export * from './ready';
24 changes: 24 additions & 0 deletions src/events/messageCreate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Events, type Message } from 'discord.js';

import type { Event } from '../types';

const GUILD_ID = Bun.env.GUILD_ID;

export class MessageCreateEvent implements Event {
public name = Events.MessageCreate;
public async execute(message: Message) {
if (message.guildId === GUILD_ID) {
const [command, token] = message.content.split(' ');
if (command === '/verify' && /^([A-z']+-){5}[A-z']+$/.test(token)) {
try {
await message.reply({
content:
'Hesabını doğrulamak için /verify yazdıkdan sonra çıkan komutu kullanman gerek, ayrıca doğrulama tokenini bir başkası ile paylaşmamalısın.',
options: { ephemeral: true },
});
message.delete();
} catch {}
}
}
}
}
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { Client, Collection, GatewayIntentBits } from 'discord.js';
import { createLogger, deployCommands } from './utils';

const client = new Client({
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});

client.logger = await createLogger();
Expand Down

0 comments on commit af04d2b

Please sign in to comment.