I have several media channels within my Discord. Each based around different topics. I m trying to get it to where if a new post is made in a media channel then a text channel gets a message sent into it with a link to the new media.
每一媒体频道也将有自己的信号频道。
这里是未遂文字:
const gameMediaMap = new Map();
gameMediaMap.set( 1236005955464986745 , 1234209500437680260 );
client.on( messageCreate , async (message) => {
if (gameMediaMap.has(message.channel.id)) {
const gameNotifierChannelId = gameMediaMap.get(message.channel.id);
const gameNotifierChannel = await client.channels.fetch(gameNotifierChannelId);
if (gameNotifierChannel) {
const postTags = message.content.match(/#[w-]+/g) || []; // Extract hashtags
const postTagsString = postTags.join( , );
const messageUrl = `https://discord.com/channels/${message.guild.id}/${message.channel.id}/${message.id}`;
const notificationMessage = `A new clip was posted in <#${message.channel.id}>. [Go to clip](${messageUrl}).
Video tagged with: ${postTagsString} .`;
gameNotifierChannel.send(notificationMessage);
}
}
});
As it is nothing happens when a new post is made, but the rest of the bot this is attached to works flawlessly.
任何建议或想法?