久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Discord.js - 公會 ID 未定義,即使有定義

Discord.js - Guild ID is undefined even though definition is there(Discord.js - 公會 ID 未定義,即使有定義)
本文介紹了Discord.js - 公會 ID 未定義,即使有定義的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

制作一個不和諧的機器人.一切正常,除了 -!prefix 的一個命令.-! 是前綴,命令采用 args 并更改服務器的前綴.

Making a discord bot. Everything works fine, except the one command of -!prefix. -! being the prefix, and the command taking the args and changing the prefix of the server.

在詳細介紹這件事之前,這是機器人的代碼,也許我只是在 consts 中做錯了什么:Hastebin 鏈接

Before I go into detail about this while thing, here's the bot's code, maybe I simply did something wrong in the consts: Hastebin Link

這里的錯誤在第 52 行,根據控制臺:控制臺日志

The error here is in line 52, according to the console: Console Log

我對如何處理未定義"感到困惑.我嘗試使用 message.guild.id 屬性作為變量,以及代碼中顯示的變量.我試過把它移到多個地方,雖然它唯一注冊的地方是前綴命令的內部(由于這個錯誤,它目前被破壞了.)

I'm confused as to what to do with this being "undefined." I've tried using the message.guild.id property as the variable, and also the one shown on the code. I've tried moving it to multiple places, although the only place it even registers is INSIDE of the prefix command (which is currently broken because of this error.)

任何人有任何修復?我不是整個 JavaScript 方面的專家,因為我是從 Python 和普通 Java 過來的.

Anyone have any fixes? I'm not that much of an expert in the whole JavaScript thing, as I came over from Python and regular Java.

推薦答案

您在 line 52 的代碼目前是:

Your code at line 52 is currently:

var server = bot.guilds.get(message.author).id

您當前正在將 User 對象傳遞到 .get() 中,該對象應該會收到 id 或雪花.

You're currently passing a User object into the .get() which should recieve an id or snowflake.

考慮到這一點,您的代碼應如下所示:

With this in mind, your code should look like:

var server = bot.guilds.get(message.guild.id).id;

但是,這有點過分,因為您可以簡單地將其縮短為:

However, this is a bit excessive because you can simply shorten it to:

var server = message.guild.id;

現在你說你已經

嘗試使用 message.guild.id 屬性作為變量,也是代碼中顯示的變量.

tried using the message.guild.id property as the variable, and also the one shown on the code.

我不確定你的意思是不是我剛才的建議,但如果是,請通知我.

I'm not sure if you mean what I just suggested, but if so please notify me.

這篇關于Discord.js - 公會 ID 未定義,即使有定義的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 伊人色综合久久天天五月婷 | 欧美黄色一区 | 午夜精品久久久 | 综合激情久久 | 在线毛片网 | 日本欧美国产在线观看 | 在线播放一区二区三区 | 亚洲小视频| 久久久久久成人 | 在线观看视频一区 | 蜜月aⅴ免费一区二区三区 99re在线视频 | 性一区| 在线啊v| 欧美国产一区二区 | 亚洲精品中文字幕 | 久久亚洲欧美日韩精品专区 | www.日日干 | 免费av观看 | 日本a在线 | 亚洲欧美激情精品一区二区 | 久久精品中文 | 久久av一区二区 | 成人精品鲁一区一区二区 | 亚洲性视频网站 | 一区二区视频在线 | 亚洲一区二区三区久久 | 国产日韩欧美激情 | 欧美精品网站 | 成人福利在线视频 | 国产精品一区二区日韩 | 国产一区二区三区 | 欧美精品v国产精品v日韩精品 | 亚洲精品久久久久久一区二区 | 香蕉视频一区二区 | 欧美高清视频 | 中文字幕精品一区二区三区在线 | 亚洲第一av | 成人免费观看男女羞羞视频 | 日韩高清中文字幕 | 亚州毛片| 九九亚洲精品 |