我的ban命令检查用户是否是可禁止的,然后禁止它们。我的脚做了同样的事情,但实际上是有效的。禁止信息发送给用户,这样用户是可以被禁止的,但实际上并没有被禁止。这是我的密码
if (memberTarget.bannable) {
if (
message.member.roles.highest.position >
message.guild.members.cache.get(target.id).roles.highest.position
) {
t
当成员的状态错误中有一个邀请链接时,当他们试图添加一个角色时,我会得到这个错误:
C:\Users\Woody\Documents\Giveaway\node_modules\discord.js\src\managers\GuildMemberRoleManager.js:93
throw new TypeError('INVALID_TYPE', 'roles', 'Role, Snowflake or Array or Collection of Roles or Snowflakes');
^
我想执行一个setup命令,这样我就可以创建一个角色,并通过命令将其分配给自己。角色已经创建,但我不能给自己分配角色。在创建角色后,我总是得到一个错误代码。 我的代码: case 'setup':
if(!message.author.id == '416940852291045376') return message.channel.send('Du bist nicht ich :)')
message.guild.roles.create({
因此,我需要帮助设置一个通道的权限与另一个相同。以前,在discord.js v12中,您可以这样做:<channel>.permissionOverwrites.set(<channel>.permissionOverwrites);,但现在,在discord.js v13中,它只返回一个错误: new TypeError('INVALID_TYPE', 'overwrites', 'Array or Collection of Permission Overwrites', true),
^
Typ
好了,我一直在开发一个机器人,它可以使用discord.js创建通道覆盖。我对discord.js比较陌生,但是我看了这个纪录片,似乎在更改覆盖时使用的正确方法是我在下面的代码中使用的方法,但我得到了一个错误消息,并且我完全不知道如何修复它。 if (command == 'lockdown') {
if (commandArgs == '') {
let channel = msg.channel;
let roles = msg.guild.roles;
console.log(roles);
let testRole = 7083847
码
let role = message.guild.roles.cache.find(role => role.name === args[1]);
const member = message.mentions.members.first();
member.roles.remove(role).catch((e) => console.log(e));
在这里,args1是角色的名称。这段代码以前是工作的,但现在它显示了这个错误。
错误:
TypeError [INVALID_TYPE]: Supplied roles is not a
我正在执行一个命令,该命令将删除用户的所有角色,并为其指定一个角色。然而,我遇到了一个问题,它没有删除角色,这给了我[INVALID_TYPE]: Supplied roles is not an Array or Collection of Roles or Snowflakes.错误。我的代码如下所示: const { DiscordAPIError } = require("discord.js");
const Discord = require("discord.js");
const fs = require("fs");
cons
代码:
client.on('message', message => {
if (message.content.startsWith(`${prefix2}red`)){
if (message.member.roles.cache.some(role => role.name === 'streamer')) return message.channel.send("You already has that role")
let role = message.guild.roles.cache.find(
我正在用Discord.JS制作一个不协调的机器人,但当我尝试执行一个命令时,它显示了这个错误:
(node:4) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object. at Message.delete (/app/node_modules/discord.js/src/structures/Message.js:501:44) at /app/commands/warn.js:3:89.
warn.js代码为:
module.exports.run = a
我在做一个机器人,它有一个请求交互,我想检查用户交互是否有特定的角色。我一直被撞车:
TypeError [INVALID_TYPE]: Supplied roles is not a Role, Snowflake or Array or Collection of Roles or Snowflakes.
下面是代码:
client.on("interactionCreate", interaction => {
if (interaction.isButton() && interaction.customId === 'request
我在discord.js v12中设置了一个静音命令。每当我运行该命令时,我都会得到一个错误。我对编码有点陌生,所以我不能理解在运行命令时出现错误的原因。下面是我的代码: module.exports = {
name: "mute",
description: "Mutesd a member for a given time",
async run (client, message, args) {
const muteRoleId = message.guild.roles.cache.get('7621992
我正在尝试制作一个Discord.js机器人,它为用户添加了"Joueur“角色,用户使用了✅表情符号。我对JS很陌生,我在互联网上找到了reaction.message.guild.members.find函数,但是我不知怎么地得到了错误TypeError: reaction.message.guild.members.find is not a function,并且没有添加角色。下面是我代码的一部分:
client.on('messageReactionAdd', async (reaction, user) => {
if (reaction.em
它几天前并没有犯错误,现在却给出了一个奇怪的错误。
当我添加代码来添加或删除一个角色时,我会得到这个错误。
我的代码:
let member = message.mentions.members.first();
let role = message.guild.roles.get("707628035498836069");
let role1 = message.guild.roles.get("769919065551929385");
member.addRole(role);
member.removeRole(role1);
错误码:
(node:
我试图制作一个机器人命令,如果有人说_apply,他们将在通道中得到机器人的消息,50秒后,机器人将删除机器人对执行命令的人所回复的内容。这是我曾经尝试使用的代码。我使用的是一个单独的文件,而不是粘贴在index.js或bot.js文件中的代码。如果有人能帮我,或者指导我该做什么,这会对我有很大帮助!
Error code that I am getting: (node:5900) UnhandledPromiseRejectionWarning: TypeError [INVALID_TYPE]: Supplied options is not an object.
at Mess
我正在执行warn命令,但在角色分配方面遇到了问题。首先,我有一个为公会设置警告角色的命令。它响应&setwarnedrole {角色ID}。它将角色ID保存到JSON文件中,紧挨着行会ID。然后,warn命令读取该文件,并获取与执行该命令的行会ID一起存储的角色ID。您可以使用&warn {user ping/user ID}来警告用户。但当我这样做时,它会给我一个错误: TypeError [INVALID_TYPE]: Supplied roles is not a Role, Snowflake or Array or Collection of Roles or S
当我第一次编写这些函数时,我没有意识到.overwritePermissions()擦除设置了权限。注意到错误后,回到我的代码,我尝试更新joinPrivateChannel()以使用.updateOverwrite(),这样就不会为创建通道的用户清除我的通道权限。
作为参考,第一个函数createPrivateChannel()每次都工作得很完美,而第二个函数给出了错误TypeError [INVALID_TYPE]: Supplied parameter is not a User nor a Role.。我尝试过硬编码用户ID、成员变量、角色ID和角色变量(每种方式各有几种不同的方式),
我想让我的Discord机器人将角色设置为用户输入的对应角色参数,例如:!role btcm、!role nccm等。
我在discord.js addRole()函数上遇到了问题,因为我在discord.js.org上看不到它的文档。控制台显示TypeError: member.addRole is not a function
module.exports = message => {
const member = message.member;
switch(message.content.split(" ")[1]){
case
在运行一次命令时,我试图创建一个新角色并将其添加到成员中,但似乎必须运行该命令两次(一次:创建角色,两次:将角色添加到成员中)。 我猜这可能是由于这个错误:TypeError [INVALID_TYPE]: Supplied roles is not an Role, Snowflake or Array or Collection of Roles or Snowflakes. if (command === 'test') {
if (!message.mentions.users.size) {
return message.reply('You n
for (let l = 0; l < client.config.topMemberCount; l++) {
if (topMemberList[l] === null) continue;
if (String(topMemberList[l]) === '261292565247252480') continue;
let roleMember = message.guild.members.fetch(topMemberList[l]);
console.log(roleMember);
let roleToGive =
我正试图根据用户的角色将用户重定向到页面。下面是控制器中的登录代码:
[HttpPost]
public ActionResult Login(User model)
{
// Lets first check if the Model is valid or not
if (ModelState.IsValid)
{
using (AuthenticationAppEntities1 entities = new AuthenticationAppEntities1())
{