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

如何使用突擊隊(duì)框架在 discord.js 禁止和踢命令中

how to add reason in discord.js ban and kick command with commando framework?(如何使用突擊隊(duì)框架在 discord.js 禁止和踢命令中添加原因?)
本文介紹了如何使用突擊隊(duì)框架在 discord.js 禁止和踢命令中添加原因?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我目前正在開(kāi)發(fā)一個(gè)帶有 commando 的 discord.js 機(jī)器人(這是 discord.js 創(chuàng)建者的官方框架/命令處理程序)
我在各種網(wǎng)站上研究過(guò)這個(gè)主題,但我的突擊隊(duì)框架似乎沒(méi)有任何效果.
這是代碼

I'm currently working on a discord.js bot with commando (which is the official framework/commands handler from the discord.js creator)
I have researched this subject on various websites and nothing seems to work with my commando framework.
This is the code

const Commando = require("discord.js-commando");

module.exports = class banCommands extends (
  Commando.Command
) {
  constructor(client) {
    super(client, {
      name: "ban",
      aliases: ["bans"],
      group: "general",
      memberName: "ban",
      description: "Banned the mention member from the server",
    });
  }
  run(message) {
    const target = message.mentions.users.first();
    if (!target) {
      message.reply("you need to have at least one users mentioned");
      return;
    }
    const { guild } = message;
    const member = guild.members.cache.get(target.id);
    if (member.bannable) {
      guild.members.ban(member);
      message.reply("That user has been banned");
    } else {
      message.reply("You cannot ban that user.");
      console.log(target);
    }
  }
};

有什么建議嗎?或任何具有相同主題的東西?

Any suggestion? or anything that have the same subject?

謝謝

推薦答案

您需要將它放在 options 參數(shù)中(參見(jiàn) docs).您也應(yīng)該使用 member.ban 而不是 guild.members.ban(member),但無(wú)論如何,這里有一個(gè)例子:

You'll need to put it in the options argument (see the docs). You should also probably use member.ban instead of guild.members.ban(member), but anyways, here's an example:

member.ban({
    reason: "Your reason here"
});

并且該成員將被禁止,審核日志中的推理會(huì)正確顯示.您還應(yīng)該在命令中添加 reason 參數(shù).不要問(wèn)我怎么回事,我已經(jīng)有一年沒(méi)有接觸過(guò) discord.js 了,尤其是突擊隊(duì).檢查指南.提及第一個(gè)論點(diǎn),然后提及原因.

And the member will be banned, with the reasoning in audit logs showing up properly. You should add an reason argument to your command as well. Don't ask me how though, I haven't touched discord.js in a year and especially not commando. Check the guide for that. Make the mention the first argument and the reason the rest.

這篇關(guān)于如何使用突擊隊(duì)框架在 discord.js 禁止和踢命令中添加原因?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

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(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來(lái)加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來(lái)自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時(shí)的歡迎消息)
主站蜘蛛池模板: 91一区二区三区 | 国产精品免费视频一区 | 久综合 | 国产高清在线精品一区二区三区 | 在线黄色影院 | 免费国产黄网站在线观看视频 | 国产精品美女久久久av超清 | 国产成人精品久久二区二区91 | 在线欧美激情 | 日本精品久久久久久久 | 国产高清一区二区 | 成人毛片视频在线播放 | 国产精品激情 | 国产精品国产精品国产专区不片 | 国产一区免费 | 欧美日韩成人影院 | 久久久毛片 | 夜夜av| 二区av| 久久精品色欧美aⅴ一区二区 | 亚洲最新在线 | 国产欧美在线 | h在线播放| 国产精品小视频在线观看 | 久久久久久久久久久久久久久久久久久久 | 国产精品久久久久久久久久久久久久 | 欧美电影大全 | 日本久久黄色 | www.国产 | 成av在线 | 91中文字幕在线观看 | 久久久久亚洲 | 91国自视频 | 亚洲免费高清 | 亚洲一区二区三区在线 | 久久久久精 | 成人高清在线视频 | 欧美国产日韩在线 | 成人精品在线 | 午夜国产精品视频 | 成人精品国产一区二区4080 |