discord

Obtaining username from user id | discord.py

和自甴很熟 提交于 2021-02-13 17:05:43
问题 Well I have been working with databases for a while with discord in order to obtain major lists of user id's in a queue, although I am having problem's obtaining the user from user id as it returns none For Example members = list(privateduos[matchid]) user = discord.User(id=int(members[0])) await client.say("Say `test` " + str(user)) await client.wait_for_message(content="test", author=user) This is the Output The client.wait_for_message doesnt seem to detect the message author in the code as

Obtaining username from user id | discord.py

北战南征 提交于 2021-02-13 17:03:42
问题 Well I have been working with databases for a while with discord in order to obtain major lists of user id's in a queue, although I am having problem's obtaining the user from user id as it returns none For Example members = list(privateduos[matchid]) user = discord.User(id=int(members[0])) await client.say("Say `test` " + str(user)) await client.wait_for_message(content="test", author=user) This is the Output The client.wait_for_message doesnt seem to detect the message author in the code as

It works but still getting this error: UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions

那年仲夏 提交于 2021-02-11 17:58:38
问题 This error is a weird one because the code works: it creates an admin role with the Administrator flag. And most importantly: the bot is above the ADMIN role and is Administrator. The error appears when it's creating the role. The error says it's missing permissions but the ADMIN role is created successfully so it didn't fail. And there's another thing: when I leave out the position parameter it works just fine, no errors at all. But unfortunately I need the position parameter because I want

Discord Bot doesn't join voice channel

倾然丶 夕夏残阳落幕 提交于 2021-02-11 16:28:19
问题 im struggling to making my bot get into a voice channel, i have already read alot of posts that are here and none of them has been able to solve my problem, im trying to get my bot to reproduce the voice of a yt video but it doesn't even join and i dont know what to do, here is the code: import os import discord import youtube_dl from random import random, choice, randint from dotenv import load_dotenv from discord.ext import commands load_dotenv() token = os.getenv("DISCORD_TOKEN") GUILD =

Discord Bot doesn't join voice channel

不问归期 提交于 2021-02-11 16:27:45
问题 im struggling to making my bot get into a voice channel, i have already read alot of posts that are here and none of them has been able to solve my problem, im trying to get my bot to reproduce the voice of a yt video but it doesn't even join and i dont know what to do, here is the code: import os import discord import youtube_dl from random import random, choice, randint from dotenv import load_dotenv from discord.ext import commands load_dotenv() token = os.getenv("DISCORD_TOKEN") GUILD =

How can I automatically split a list up based on a given requirement?

若如初见. 提交于 2021-02-11 15:21:02
问题 On Discord, you can only have messages of character length 2000 or under. I am trying to append the server name, member amount and server ID for each server that the bot is in to a list, and then sending the list to a channel. However, as the list length exceeds 2000 I have tried to split it up, however the method requires it to be updated every time manually as the list gets larger. How can I make the script automatically split up the list based on how many 'splits' are required and then

Make a list of kickable members in Discord.js

爱⌒轻易说出口 提交于 2021-02-11 14:57:36
问题 So I am trying to clean up my old server, and I want my bot to kick everyone below a role named "bot". (and keep everyone above it) So I think (correct me if I am wrong) would be to create a list of kickable members and then kick each one (forEach). However, I can't find a way to make this list. Any help would be appreciated. Thanks! 回答1: You can compare role positions with Role.comparePositionTo // <guild> is a placeholder for the guild object const role = <guild>.roles.cache.find(r => r

How check on_message if message has emoji for discord py?

爷,独闯天下 提交于 2021-02-11 14:44:56
问题 I'm fairly new at using python and I'm trying to code a discord bot with basics functions, and I want for one of them to be that after someone uses a prefix if they post an emoji that the bot replies with the url of the emoji, but I have trouble trying to make it work. I don't know how to use on_message to check if a message contains an emoji. Could anyone help me? Thanks. #if message.content[0] == "!" and message.content[1:4] == " <:": #print(message.content[4:-1]) #emoji_name = "" #for i in

Discord bot sends response twice

风流意气都作罢 提交于 2021-02-11 13:41:40
问题 I'm coding a discord.js bot, and whenever I send a command, it gives a response twice. I've concluded it's because I have too many instances running. I try to delete the instances, but it doesn't delete. Sometimes it says "Some instances could not be deleted", and sometimes it doesn't delete at all. And through Terminal SERVICE VERSION ID VM_STATUS DEBUG_MODE default 20191208t223728 aef-default-20191208t223728-0l57 RUNNING default 20191208t223728 aef-default-20191208t223728-jb53 RUNNING

Discord bot sends response twice

蓝咒 提交于 2021-02-11 13:39:19
问题 I'm coding a discord.js bot, and whenever I send a command, it gives a response twice. I've concluded it's because I have too many instances running. I try to delete the instances, but it doesn't delete. Sometimes it says "Some instances could not be deleted", and sometimes it doesn't delete at all. And through Terminal SERVICE VERSION ID VM_STATUS DEBUG_MODE default 20191208t223728 aef-default-20191208t223728-0l57 RUNNING default 20191208t223728 aef-default-20191208t223728-jb53 RUNNING