最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Discord.js: Detecting Message From Webhook - Stack Overflow

programmeradmin0浏览0评论

I have a webhook bot. It sends webhook messages but it detects webhooks messages as same as normal messages. So it makes spam.

I use discord.js version 11.5.1

I thought this code will work but it did not work.

if (message.author.nickname == null) return;

I have a webhook bot. It sends webhook messages but it detects webhooks messages as same as normal messages. So it makes spam.

I use discord.js version 11.5.1

I thought this code will work but it did not work.

if (message.author.nickname == null) return;
Share Improve this question edited Jan 19, 2020 at 20:12 flashy asked Aug 31, 2019 at 20:08 flashyflashy 56411 silver badges25 bronze badges 3
  • Maybe it's not null try this: if (!message.author.nickname) return; – EugenSunic Commented Aug 31, 2019 at 20:10
  • I think message.author.nickname is not the true variable to test. I think there should be another variable for this case. – flashy Commented Aug 31, 2019 at 20:13
  • The code you gave cancels all mands – flashy Commented Aug 31, 2019 at 20:13
Add a ment  | 

1 Answer 1

Reset to default 6

I think this is what you're looking for: Message#webhookId

if (message.webhookId) return;

(For Discord.js V12 and under, use #webhookID with ID all capitalised instead.)

发布评论

评论列表(0)

  1. 暂无评论