discord

Discord.py missing required argument

五迷三道 提交于 2020-01-19 06:22:15
问题 I have a rewrite version discord.py.If message have content, error does not happened.I need that error does not happened if message have not content. My code: @client.command(pass_context = True) def async search(ctx,message): ... some code ... if members_count < voice_channel.user_limit: message.content += ' ' print(message.content) invite = await channel.create_invite(max_age=0) avatar = user.avatar_url if message == '': message_for_emb = '\u200b' elif message != '': message_for_emb = '

How to create a !verify command with Discord.js and mysql

混江龙づ霸主 提交于 2020-01-16 16:07:32
问题 I am trying to create a verification command that checks if a user is registered on my site, and changes the discord nickname to the site nickname. The command will be !verify nickname, and the bot will do the connection and return the results. This is for a Windows server running XAMPP. Does someone knows how to do it or have a tutorial? 来源: https://stackoverflow.com/questions/57545221/how-to-create-a-verify-command-with-discord-js-and-mysql

How to create a !verify command with Discord.js and mysql

孤者浪人 提交于 2020-01-16 16:06:52
问题 I am trying to create a verification command that checks if a user is registered on my site, and changes the discord nickname to the site nickname. The command will be !verify nickname, and the bot will do the connection and return the results. This is for a Windows server running XAMPP. Does someone knows how to do it or have a tutorial? 来源: https://stackoverflow.com/questions/57545221/how-to-create-a-verify-command-with-discord-js-and-mysql

Reading files in chat using discord bot

北战南征 提交于 2020-01-16 08:05:08
问题 As an experiment, I was trying to find whether I could read files that were entered as attachments into chat eg: image files, txt, etc. I've been looking around for a long while and I have still found no information on it. So it possible to do this using Discord.js? If so, how would I go about doing it? 回答1: This can be done using the attachments property of a Message to find the attachment and consequently its URL. You can then download the URL using the http and fs modules. It would look

Reading files in chat using discord bot

冷暖自知 提交于 2020-01-16 08:04:30
问题 As an experiment, I was trying to find whether I could read files that were entered as attachments into chat eg: image files, txt, etc. I've been looking around for a long while and I have still found no information on it. So it possible to do this using Discord.js? If so, how would I go about doing it? 回答1: This can be done using the attachments property of a Message to find the attachment and consequently its URL. You can then download the URL using the http and fs modules. It would look

How can I check if the message author has an admin role using Discord.js?

女生的网名这么多〃 提交于 2020-01-16 04:25:27
问题 I'm building a Discord bot and I want to have an if statement that will only proceed if the message author has an administrator role in the guild. I've tried having role-specific permissions, but this means that there will have to be the exact same name role on all servers that the bot is on. How can I check if the message author has an admin role? (The role has the administrator permission.) 回答1: There's really three different questions needed to be addressed here. They're all related, but

How do I get a list of all members in a discord server using the new discord.py version?

泄露秘密 提交于 2020-01-15 12:14:11
问题 I recently updated my discord.py and it seems some of my older commands are wrong. I need to loop through all the members of a discord server but the old way I did it does not work anymore. Heres my old code. @bot.command(pass_context = True) async def missing(ctx, channel : str = None, useDiscordID : bool = False): memberlist = [] for member in message.server.members: toAppend = '' if "barcode" in [y.name.lower() for y in member.roles]: if member.nick is None: toAppend = member.name else:

How do I get a list of all members in a discord server using the new discord.py version?

荒凉一梦 提交于 2020-01-15 12:13:13
问题 I recently updated my discord.py and it seems some of my older commands are wrong. I need to loop through all the members of a discord server but the old way I did it does not work anymore. Heres my old code. @bot.command(pass_context = True) async def missing(ctx, channel : str = None, useDiscordID : bool = False): memberlist = [] for member in message.server.members: toAppend = '' if "barcode" in [y.name.lower() for y in member.roles]: if member.nick is None: toAppend = member.name else:

Finding a user by their username#discrim

孤者浪人 提交于 2020-01-15 10:25:06
问题 Is it possible to get someone's user ID who you know their username and discrim, but is not in a mutual server with you? Thanks. 回答1: I don't think so. It makes sense since this can easily be abused. Imagine all the spam bots if bots can see all discord users. Below are two ways to get user info using discord.py , but note that they cannot be used as you ask. client.get_user_info can be used to get user info even if you don't share a server, but it takes the unique ID as an argument. server

Cannot catch UnhandledPromiseRejectionWarning in promise

a 夏天 提交于 2020-01-15 09:17:47
问题 so I'm trying to catch UnhandledPromiseRejectionWarning in my promise, but for some reason it's not working. It ignores my code and just outputs the error to console. Error: UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Forbidden (Cannot send messages to this user) code: e.message.author.openDM().then((message) => { message.sendMessage(`test`); }).catch((error) => { e.message.channel.sendMessage(error + "test"); }); This is a discord bot, using