discord.py

How can I get user input in a python discord bot?

ⅰ亾dé卋堺 提交于 2020-12-08 07:10:15
问题 I have a python discord bot and I need it to get user input after a command, how can I do this? I am new to python and making discord bots. Here is my code: import discord, datetime, time from discord.ext import commands from datetime import date, datetime prefix = "!!" client = commands.Bot(command_prefix=prefix, case_insensitive=True) times_used = 0 @client.event async def on_ready(): print(f"I am ready to go - {client.user.name}") await client.change_presence(activity=discord.Activity(type

How to make discord python bot react to its own message?

蓝咒 提交于 2020-12-07 15:19:54
问题 Currently working on a small bot which sends an embed and I want it to react to itself but am unsure on how to do that. Any help? 回答1: Get the message you want to react to and use Client.add_reaction() For example, if you're reacting to an embed msg = await bot.send_message(ctx.message.channel,embed=embed) await bot.add_reaction(msg, "😮") 回答2: If you have this in your code if message.author == client.user: return Your bot will not respond to itself, and it shouldn't respond to itself normally

(Python: discord.py) ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly

喜夏-厌秋 提交于 2020-12-05 11:24:16
问题 trying to download discord.py using pip install, gave me the error message in the title. I installed using cmd and the commands py -m pip install -U discord, the cmd was also run in admin. tried using pip, pip3, and pip3.9, all of which didnt work. I tried uninstalling/reinstalling/upgrading (in that order) the said libraries: pip yarl multidict wheel setuptools versions of python that I tried (in all versions are downloaded with default settings with nothing changed): python-3.9.0-amd64.exe

(Python: discord.py) ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly

偶尔善良 提交于 2020-12-05 11:21:25
问题 trying to download discord.py using pip install, gave me the error message in the title. I installed using cmd and the commands py -m pip install -U discord, the cmd was also run in admin. tried using pip, pip3, and pip3.9, all of which didnt work. I tried uninstalling/reinstalling/upgrading (in that order) the said libraries: pip yarl multidict wheel setuptools versions of python that I tried (in all versions are downloaded with default settings with nothing changed): python-3.9.0-amd64.exe

(Python: discord.py) ERROR: Could not build wheels for multidict, yarl which use PEP 517 and cannot be installed directly

梦想与她 提交于 2020-12-05 11:20:14
问题 trying to download discord.py using pip install, gave me the error message in the title. I installed using cmd and the commands py -m pip install -U discord, the cmd was also run in admin. tried using pip, pip3, and pip3.9, all of which didnt work. I tried uninstalling/reinstalling/upgrading (in that order) the said libraries: pip yarl multidict wheel setuptools versions of python that I tried (in all versions are downloaded with default settings with nothing changed): python-3.9.0-amd64.exe

ClientConnectorError: Cannot connect to host discordapp.com:443 ssl:default [Connect call failed ('162.159.134.233', 443)]

我们两清 提交于 2020-11-29 19:25:59
问题 So I was trying out making a bot in Discord and I tried running my discord bot over Gitpod and it was able to run, but when I tried running it on pythonanywhere.com, I get this error: aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discordapp.com:443 ssl:default [Connect call failed ('162.159.134.233', 443)] Here is a snippet of my code: import discord from discord.ext import commands import json with open("credentials.json") as creds: creds = json.loads(creds.read())

ClientConnectorError: Cannot connect to host discordapp.com:443 ssl:default [Connect call failed ('162.159.134.233', 443)]

本秂侑毒 提交于 2020-11-29 19:21:18
问题 So I was trying out making a bot in Discord and I tried running my discord bot over Gitpod and it was able to run, but when I tried running it on pythonanywhere.com, I get this error: aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discordapp.com:443 ssl:default [Connect call failed ('162.159.134.233', 443)] Here is a snippet of my code: import discord from discord.ext import commands import json with open("credentials.json") as creds: creds = json.loads(creds.read())

Discord.py welcome bot on_member_join event not getting callded

强颜欢笑 提交于 2020-11-25 03:56:25
问题 I've been interested in working with discord bots lately, and from what I'm seeing this code should work but it is not... I'm simply just playing around with the API because it's fun so I'm pretty new with this. I just want the bot to welcome someone when they join. import discord client = discord.Client() @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) channel = client.guilds[0].get_channel(CHANNEL ID) await channel.send("Bot online") @client.event