discord

Set channel id for DiscordBot for multiple servers

丶灬走出姿态 提交于 2021-02-20 04:56:51
问题 Could someone help me set command to set channel for specific server so that it does not interfere with each other? Actually I have this: var testChannel = bot.channels.find(channel => channel.id === "hereMyChannelID"); I want to set command which Owner can use to set channel id for his server. 回答1: You can accomplish this task by creating a JSON file to hold the specified channels of each guild. Then, in your command, simply define the channel in the JSON. After that, anywhere else in your

Set channel id for DiscordBot for multiple servers

心已入冬 提交于 2021-02-20 04:54:45
问题 Could someone help me set command to set channel for specific server so that it does not interfere with each other? Actually I have this: var testChannel = bot.channels.find(channel => channel.id === "hereMyChannelID"); I want to set command which Owner can use to set channel id for his server. 回答1: You can accomplish this task by creating a JSON file to hold the specified channels of each guild. Then, in your command, simply define the channel in the JSON. After that, anywhere else in your

How to remove all roles and add one role on discord bot, and then remove the added role and restore previous roles

丶灬走出姿态 提交于 2021-02-20 02:57:47
问题 I have a line of code for a discord bot to remove a specific named role and add a role named "muted" for a specific amount of time. Basically, the server can only have 3 roles, one that can issue the command, a "normal" rank with normal permissions, and then a "muted" role. and my code specifically removed the normal role and adds the muted role so they don't have any permissions. Well I added my bot onto another server with more than 3 roles, I decided to give everyone the normal role and

Guilds Highest Role Command?

南笙酒味 提交于 2021-02-19 23:47:22
问题 I want to get the highest role in the guild with discord.js message.guild.roles.highestRole This doesn't work. Any help would be appreciated. Thanks from now :) 回答1: For discord.js v12 / master use message.guild.roles.highest.name For discord.js v11.4.x / stable use message.guild.roles.sort((b, a) => a.position - b.position || a.id - b.id).first().name, this will sort the roles Collection by their position and then get the highest one, and return the name of it. 来源: https://stackoverflow.com

Guilds Highest Role Command?

点点圈 提交于 2021-02-19 23:41:06
问题 I want to get the highest role in the guild with discord.js message.guild.roles.highestRole This doesn't work. Any help would be appreciated. Thanks from now :) 回答1: For discord.js v12 / master use message.guild.roles.highest.name For discord.js v11.4.x / stable use message.guild.roles.sort((b, a) => a.position - b.position || a.id - b.id).first().name, this will sort the roles Collection by their position and then get the highest one, and return the name of it. 来源: https://stackoverflow.com

Guilds Highest Role Command?

丶灬走出姿态 提交于 2021-02-19 23:40:33
问题 I want to get the highest role in the guild with discord.js message.guild.roles.highestRole This doesn't work. Any help would be appreciated. Thanks from now :) 回答1: For discord.js v12 / master use message.guild.roles.highest.name For discord.js v11.4.x / stable use message.guild.roles.sort((b, a) => a.position - b.position || a.id - b.id).first().name, this will sort the roles Collection by their position and then get the highest one, and return the name of it. 来源: https://stackoverflow.com

Save JSON file to grab other data from it later

若如初见. 提交于 2021-02-19 06:04:27
问题 I want to be able to save my json file with new data and then call upon that data so that I can save new data again. Right now all it is doing is it is, when I call upon any part of the JSON file's data, staying the same the last time I manually saved it. (I did edit some code and a better description of my problem) Thank you in advance! Here is my code there is no error log: const Discord = require('discord.js'); const botconfig = require("./botconfig.json"); const fs = require("fs"); const

Discord.py @bot.event

筅森魡賤 提交于 2021-02-19 05:35:52
问题 So I have a script that uses both @bot.event and @bot.command() . The problem is that when I have a @bot.event waiting the @bot.command() will not run. Here is my code: @bot.event async def on_ready(): print("Bot Is Ready And Online!") async def react(message): if message.content == "Meeting": await message.add_reaction("👍") @bot.command() async def info(ctx): await ctx.send("Hello, thanks for testing out our bot. ~ techNOlogics") @bot.command(pass_context=True) async def meet(ctx,time): if

Latency command in Discord.py

巧了我就是萌 提交于 2021-02-18 22:41:30
问题 I've looked in a lot of places and I can't find a way to make a ping (latency) command using discord.py , something like this: @client.command(pass_context=True) async def pong(ctx): # Somehow find 'pingtime' await client.say(pingtime) 回答1: Really at this point you should be using the rewrite branch of discord.py This would be my solution using the commands extension. @bot.command() async def ping(ctx): await ctx.send('Pong! {0}'.format(round(bot.latency, 1))) 回答2: On the rewrite branch of

Latency command in Discord.py

时光怂恿深爱的人放手 提交于 2021-02-18 22:38:44
问题 I've looked in a lot of places and I can't find a way to make a ping (latency) command using discord.py , something like this: @client.command(pass_context=True) async def pong(ctx): # Somehow find 'pingtime' await client.say(pingtime) 回答1: Really at this point you should be using the rewrite branch of discord.py This would be my solution using the commands extension. @bot.command() async def ping(ctx): await ctx.send('Pong! {0}'.format(round(bot.latency, 1))) 回答2: On the rewrite branch of