Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Hi I Coded A Bot But I Want To limit Bot's One Exact Event in One Channel This is Code No Errors Just Need To Lock This Event in one channel

module.exports = async (client, message) => {
    if (message.author.bot) return
    if (message.channel.type === "dm") {
        const guild = client.guilds.cache.get("736112465678565437")
        const channel = guild.channels.cache.find(c => c.name === "modmail-messages")
        const embed = new Discord.MessageEmbed()
        .setAuthor(`${message.author.tag} | ${message.author.id}`, message.author.displayAvatarURL())
        .addField("Message", message.content)
        .setFooter("Sent")
        .setTimestamp()
        .setColor("PURPLE")
        await message.author.send("Sending To Staff...")
        await channel.send(embed)
    }
    if (message.channel.type !== "dm" && message.guild.channels.cache.find(c => c.name === "modmail-messages")) {
        const user = message.mentions.members.first()
        const args = message.content.slice(process.env.PREFIX.length).trim().split(/ +/g)
        let response = args.slice(1).join(' ')
        if (!response)
            return message.reply("please provide a response to the user!")
        if (!user)
            return message.reply("please specify a user!")
        await user.send(`**(?Hyper Staff)** ${message.member.displayName}: ${response}`)
    }
    if (message.content.indexOf(process.env.PREFIX) !== 0) return
    const args = message.content.slice(process.env.PREFIX.length).trim().split(/ +/g)
    const command = args.shift().toLowerCase()
    const cmd = client.commands.get(command)
    if (!cmd) return 
    cmd.run(client, message, args)
}```
question from:https://stackoverflow.com/questions/65540670/vsc-discord-bot-event-locking

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
113 views
Welcome To Ask or Share your Answers For Others

1 Answer

What do you mean by "locking the event in one channel"? You want the bot to send a message in a specific channel?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...