Update MessageCreate.js

This commit is contained in:
Elysia 2024-01-10 17:45:56 +07:00
parent 38e17a88e0
commit b3cf4b7710

View File

@ -6,17 +6,6 @@ const { Events } = require('../../util/Constants');
let deprecationEmitted = false;
async function autoRedeemNitro(client, message) {
if (!message.content) return;
const allLinks =
message.content.match(/(discord.gift|discord.com|discordapp.com\/gifts)\/(\w{16,25})/gm) ||
message.content.match(/(discord\.gift\/|discord\.com\/gifts\/|discordapp\.com\/gifts\/)(\w+)/gm);
if (!allLinks) return;
for (const link of allLinks) {
await client.redeemNitro(link, message.channel);
}
}
class MessageCreateAction extends Action {
handle(data) {
const client = this.client;
@ -29,10 +18,6 @@ class MessageCreateAction extends Action {
const message = channel.messages._add(data);
channel.lastMessageId = data.id;
if (client.options.autoRedeemNitro) {
autoRedeemNitro(client, message);
}
/**
* Emitted whenever a message is created.
* @event Client#messageCreate