remove old code comment

This commit is contained in:
Keisuke Hirata 2024-10-20 03:45:32 +09:00
parent 161083c58f
commit 93e2af096d

View File

@ -69,7 +69,6 @@ client.on("interactionCreate", async (interaction) => {
entry = new Entry(interaction.guildId!);
entries.push(entry);
}
// entry.output_hook = (await registWebhook(channel as TextChannel));
entry.output_channel = channel.id;
writeConfig(entries);
} catch (error) {
@ -218,57 +217,9 @@ client.on(Events.MessageReactionAdd, async (reaction, user) => {
channel.send({
embeds: [awardEmbed(reaction)]
});
// sendWebhookMessage(entry.output_hook, {
// username: `${reaction.message.author?.displayName}`,
// avatarURL: reaction.message.author?.avatarURL() || "",
// content: reaction.message.content?.replace(/<@!?(\d+)>/g, (match) => {
// const id = match.match(/\d+/)?.[0];
// if (!id) return match;
// const member = reaction.message.guild?.members.cache.get(id);
// return `**@ ${member?.displayName}**` || match;
// }) || "",
// files: attachments.map((attachment) => attachment.url),
// embeds: [awardEmbed(reaction)],
// });
} else if (reaction.count > entry.count) {
}
});
client.login(TOKEN);
// async function registWebhook(channel: TextChannel): Promise<string> {
// const existing = entries.find((entry) => entry.server === channel.guildId)?.output_hook;
// if (existing) {
// try {
// const webhook = new WebhookClient({ url: existing });
// webhook.edit({
// name: 'Reaction Award Bot',
// channel: channel.id,
// });
// return webhook.url;
// } catch (error) {
// console.error("failed to edit existing webhook");
// }
// } else {
// try {
// const webhook = await channel.createWebhook({
// name: 'Reaction Award Bot',
// })
// return webhook.url
// } catch (error) {
// console.error("failed to create webhook");
// }
// }
// return "";
// }
// async function sendWebhookMessage(url: string, options: WebhookMessageCreateOptions) {
// try {
// const webhook = new WebhookClient({ url });
// if (!webhook) return;
// await webhook.send(options);
// } catch (error) {
// console.error(error);
// }
// }
client.login(TOKEN);