discord

Error 400 in discord.py

走远了吗. 提交于 2020-01-03 16:37:33
问题 I'm making a bot with Discord.py and I keep getting an error when trying to send a message with an embed. Here's the error I get: Traceback (most recent call last): File "C:\Users\pc\Documents\Storage\python\NanoBot\bot.py", line 101, in on_message await client.send_message(message.channel, embed=embed) File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message data = yield from self.http.send_message(channel_id, content, guild

Error 400 in discord.py

只谈情不闲聊 提交于 2020-01-03 16:37:32
问题 I'm making a bot with Discord.py and I keep getting an error when trying to send a message with an embed. Here's the error I get: Traceback (most recent call last): File "C:\Users\pc\Documents\Storage\python\NanoBot\bot.py", line 101, in on_message await client.send_message(message.channel, embed=embed) File "C:\Users\pc\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 1152, in send_message data = yield from self.http.send_message(channel_id, content, guild

Raise custom error message for

余生长醉 提交于 2019-12-31 05:55:06
问题 So below code blocks server and user id in the list when they use ?hello , so I am trying to raise custom error message. If user id is in list, it will tell User Blacklisted and if server id is in list, it will tell Server has been Blacklisted . LIST_OF_USER_IDS = ['34534545546', '34534545546'] LIST_OF_SERVER_IDS = ['34534545546', '34534545546'] def blacklists(users, servers): def predicate(ctx): return ctx.message.author.id not in users and ctx.message.server.id not in servers return

Python - DM a User Discord Bot

六眼飞鱼酱① 提交于 2019-12-31 05:42:10
问题 I'm working on a User Discord Bot in Python .If the bot owner types !DM @user then the bot will DM the user that was mentioned by the owner. @client.event async def on_message(message): if message.content.startswith('!DM'): msg = 'This Message is send in DM' await client.send_message(message.author, msg) 回答1: The easiest way to do this is with the discord.ext.commands extension. Here we use a converter to get the target user, and a keyword-only argument as an optional message to send them:

How can I use a python discord bot cog to read all messages that are sent? on_message does not seem to be working

被刻印的时光 ゝ 提交于 2019-12-30 14:07:51
问题 I have the cog set up properly (which I know, because I have a separate cog which handles all of the commands, so that on_message does not mess them up), but on_message just doesn't do anything. I've tried including it into the other cog, but I still don't get an error with anything, it just doesn't work. I've also tried using different forms of @bot.event but these all just cause errors. Lastly, I know that the cog is working because the on_ready in the main .py alerts me that it had loaded

How to change a channels name using discord.py v.1.0.0a?

我是研究僧i 提交于 2019-12-29 08:25:36
问题 i've already searched a lot about this online. There I came across the API Refrence (https://discordpy.readthedocs.io/en/rewrite/api.html#discord.TextChannel) which kind of helped me finding what command I need to use. So my conculsion would be to use this code: channel = client.get_channel(475772135730708480) @client.command() async def emoivb(ctx): await discord.VoiceChannel.edit(channel, name = "test") the problem is that it doesnt work with this error: File "C:/Users/MyUser/Desktop

How to change a channels name using discord.py v.1.0.0a?

妖精的绣舞 提交于 2019-12-29 08:25:26
问题 i've already searched a lot about this online. There I came across the API Refrence (https://discordpy.readthedocs.io/en/rewrite/api.html#discord.TextChannel) which kind of helped me finding what command I need to use. So my conculsion would be to use this code: channel = client.get_channel(475772135730708480) @client.command() async def emoivb(ctx): await discord.VoiceChannel.edit(channel, name = "test") the problem is that it doesnt work with this error: File "C:/Users/MyUser/Desktop

How do I filter words with a discord bot? (JavaScript)

末鹿安然 提交于 2019-12-25 19:21:26
问题 I have recently created a bot for my discord server. Now I want him to filter bad words. For example: User (without bot): You are an asshole User (with bot): You are an [I'm stupid because I swear] Is this even possible in Discord? I have given my bot all permissions! (including removing messages, it can't edit message with the program self tho) If that is not possible^ Can we do the following? The ability to directly delete the message and write the following: Bot: @username Do not swear!

Issue sending file via Discord bot (Python)

江枫思渺然 提交于 2019-12-25 18:30:46
问题 if message.content.upper().startswith("!HEADPATS"): time.sleep(1) with open('tenor.gif', 'rb') as picture: await client.send_file(channel, picture) I've got my discord bot up and running (everything's written in python). I'm trying to get the bot to send a .gif in the channel upon the command "!headpats". The file is uploaded and the code compiles fine, but when the !headpats command is called via discord, the compiler spits this out... File "main.py", line 106, in on_message await client

Access variables between commands with discord.py

有些话、适合烂在心里 提交于 2019-12-25 17:25:11
问题 I have this (overly simplified) Discord bot voting_enabled = False @bot.command() async def start(): voting_enabled = True @bot.command() async def finish(): voting_enabled = False @bot.command() async def vote(): if voting_enabled: # Do something else: # Do something else The problem When I call call the vote() command, it always goes through the else part of the code. Even after calling the start() command What I want to achieve I want that the vote() command behave differently depending on