discord.py

Discord.py Add embed Field without name attribute

▼魔方 西西 提交于 2021-01-28 14:01:02
问题 I want to show a Leaderboard (Place, Name, Level) in an embed TextBox. The thing is, that I HAVE TO put name='smth' in the embed.add_field function, otherwise it wont work. But if I do so, it looks like this: How can I delete these Titles? My current code is number = 0 for x in character_list: if number == 0: embed.add_field(name='Platz', value=x[0], inline=True) embed.add_field(name='Name', value=x[1], inline=True) embed.add_field(name='Level', value=x[2], inline=True) number = 1 else: embed

Cooldown mapping | Discord.py

南楼画角 提交于 2021-01-28 12:52:29
问题 I am using on_message to scan the code for specific keywords so that the bot can respond accordingly, and no, I cannot use commands to achieve this. I want to prevent people from spamming these keywords by turning on a cooldown so the bot will wait before checking again What the documentation says: class SomeCog(commands.Cog): def __init__(self): self._cd = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user) async def cog_check(self, ctx): bucket = self._cd.get_bucket

Cooldown mapping | Discord.py

拜拜、爱过 提交于 2021-01-28 12:43:01
问题 I am using on_message to scan the code for specific keywords so that the bot can respond accordingly, and no, I cannot use commands to achieve this. I want to prevent people from spamming these keywords by turning on a cooldown so the bot will wait before checking again What the documentation says: class SomeCog(commands.Cog): def __init__(self): self._cd = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.user) async def cog_check(self, ctx): bucket = self._cd.get_bucket

Discordpy Tasks not working as expected. No returning

こ雲淡風輕ζ 提交于 2021-01-28 12:30:28
问题 @tasks.loop(seconds = 5.0) async def remind420(self): print("YES") print(datetime.now().strftime("%H:%M")) if datetime.now().strftime("%H:%M") == "16:55" or datetime.now().strftime("%H:%M") == "04:20": await client.get_channel(499245707081940995).send("420!!") @remind420.before_loop async def remind420_before(): await client.wait_until_ready() remind420.start() There is no output. Absolutely no output. I expect the time to returned or atleast a yes. 回答1: Make sure to have all your imports and

ModuleNotFoundError: No module named 'discord'

安稳与你 提交于 2021-01-28 11:40:48
问题 Trying to run my .py file from CMD, but it can't find the discord module >>File 'C:\Users\\****\Desktop\Discord_Bot\main.py', line 1, in module >>import discord >>ModuleNotFoundError: No module named 'discord' Although, when I run: >>python >>import discord It works as intended, any suggestions? 回答1: Go into the terminal and use: pip uninstall discord.py wait a few seconds so it can fully delete it, and then use pip install discord.py . Should work 回答2: Maybe it's the Python version issue.

Issue adding a role when reacting to a post

浪尽此生 提交于 2021-01-28 11:11:44
问题 I'm having an issue adding a role when a user reacts to a post. How I'm wanting it to function is that when a user joins the Discord server the bot will send send a message using the on_join event (for now I'm using the command test for testing purposes). The next step is the on_reaction_add event, when the user reacts to this message the bot will add the role to that user. Here is what I'm working with. I've tested this however, I'm not getting the desired result. (on discord.py rewrite)

Why won't Discord bot recognize commands?

守給你的承諾、 提交于 2021-01-28 08:51:46
问题 I'm making a bot for a pokemon server, and I'm trying to make a command that will give the 'Gym Leader' role to another user. I try using the command, and using the test command, but there is no response in the server nor the shell. import os import discord from dotenv import load_dotenv from discord.ext import commands from discord.utils import get bot = commands.Bot(command_prefix='b!', case_insensitive=True) load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') client = discord.Client() @client

Heroku Discord Bot builds but doesn't work when deployed

☆樱花仙子☆ 提交于 2021-01-28 08:23:57
问题 I've deployed a Discord bot(discord.py) with heroku. The status of the bot is "online" in the Heroku's Dashboard however the bot is offline in Discord.I've added the Procfile and enabled the dyno in resources. Is there anything else i have to do?? EDIT: This is my procfile's content - worker :python bot.py Requirements.txt: 回答1: You can check the heroku logs using the following command in the command Prompt of your PC (you need to have Heroku CLI installed) heroku logs -a yourappnamehere any

@commands.has_permissions not checking for permissions

。_饼干妹妹 提交于 2021-01-28 06:06:08
问题 So basically what I am doing is trying to write a very basic kick and ban command to use for my discord bot. I've looked through many different tutorials and similar questions asked, but I simply cannot find a fix to this. @bot.command() @commands.has_permissions(kick_members=True) async def kick(ctx, user: discord.Member, *, reason=None): await ctx.kick(reason=reason) await ctx.send(f"{user} has been kicked successfully") When I have the bot up and running, everyone is able to kick everybody

Discord does not embed link when sent by my bot

旧时模样 提交于 2021-01-28 05:36:51
问题 My code works fine and the bot sends the link, but Discord does not recognize it as one and does not embed it. When I copy and paste it myself, it then recognizes it as a link and embed the image. Here is my code: import requests from bs4 import BeautifulSoup if message.content.startswith(".dog"): response = requests.get("https://dog.ceo/api/breeds/image/random") soupRaw = BeautifulSoup(response.text, 'lxml') soupBackend = str(soupRaw).split("message") soup2 = soupBackend[1] soup3 = soup2[3:]