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

Discord.js 禁止命令中的無效表單正文

Invalid Form Body in Discord.js ban command(Discord.js 禁止命令中的無效表單正文)
本文介紹了Discord.js 禁止命令中的無效表單正文的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

所以,我一直在嘗試發出禁令命令.我基本上在踢命令上使用了相同的系統,但在這里它不起作用,只是給了我一個錯誤.我很困惑,因為在錯誤中它沒有顯示一行代碼或其他東西.
我的命令/代碼:

So, i have been trying to make a ban command. I basically used the same system on a kick command, but here it didnt work and just gave me an error. I am confused since in the error it doesnt display a line of code or something.
My Command / Code:

module.exports = {
    name: 'ban',
    description: "Ban Command.",
    execute(msg, args){
    const Discord = require('discord.js')
    const Embeds = require('./../embed')
    let perms = msg.member.permissions  
    let has_kick = perms.has("BAN_MEMBERS")
    if (has_kick === true) {
        const toban = msg.mentions.members.first()
        delete args[0]
        var string = args.join(' ')
        Embeds.error(toban, `You have been banned from ${msg.guild.name} by the user ${msg.author} with the reason ${string}`)
        setTimeout(function(){ 
            try {
            toban.ban(`was banned by ${msg.author} for: ${string}`)
            Embeds.kicked(msg.channel, `${toban} has been banned by ${msg.author} from the server with the following reason: ${string}`, `Banned User from the server`)
            } catch {
                Embeds.error(msg.channel, `I dont have permissions to ban ${toban} `, "Error")
            }
         }, 1000); 
    } else {
        const toban = msg.mentions.members.first()
        Embeds.error(msg.channel, `You dont have permissions to Ban ${toban} `, "Error")
    }
}
}

錯誤:

(node:13896) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
DICT_TYPE_CONVERT: Only dictionaries may be used in a DictType

推薦答案

這很容易解決,你所要做的就是以正確的方式將適量的參數傳遞給 .ban 功能.

this is pretty easy to solve, all you have to to is pass the right amount of Parameters in the right way to the .ban function.

.ban({ days: 7, reason: 'your reason here' })

https://discord.js.org/#/docs/main/stable/class/GuildMember?scrollTo=ban

這篇關于Discord.js 禁止命令中的無效表單正文的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 服務器時的歡迎消息)
主站蜘蛛池模板: 欧美白人做受xxxx视频 | 欧美色偷拍| 天天操伊人 | 在线天堂免费中文字幕视频 | 国产一区| 免费国产一区二区 | 国产成人精品一区二区三区在线 | 最新高清无码专区 | 玖玖国产 | 欧美日韩1区2区 | 99久久国产综合精品麻豆 | 日韩综合一区 | 亚洲精品一区二区三区四区高清 | 91正在播放 | 欧美日韩网站 | 久久69精品久久久久久国产越南 | 国产一区二区三区高清 | 亚洲成人av一区二区 | 国产精品3区 | 99热碰| 免费观看一级毛片 | 欧美一区二区三区视频在线播放 | 一级无毛片 | 欧美一区二区 | 精品一级 | 亚洲综合小视频 | 久久久久久久一区 | 日韩插插 | 精品免费国产一区二区三区四区介绍 | 精品国产区 | 一级毛片在线看 | 一区二区三区国产精品 | 午夜欧美一区二区三区在线播放 | 97人人澡人人爽91综合色 | 久久久精品影院 | 日韩三级免费网站 | 亚洲国产黄色av | 成人免费视频网址 | 久久久久久成人 | 黄a免费网络 | 国产伦精品|