discord.py

I'm getting a certain error on my TEMPMUTE command

冷暖自知 提交于 2021-01-27 12:56:09
问题 I have made a tempmute code or we can say I found one on stackoverflow. I copied the code but it doesn't seem to work. If anyone of you now and can help me thanks! The code is; @commands.has_permissions(kick_members=True) async def tempmute(ctx, member: discord.Member, time=0, reason=None): if not member or time == 0: return elif reason == None: reason = 'No reason' try: if time_list[2] == "s": time_in_s = int(time_list[1]) if time_list[2] == "min": time_in_s = int(time_list[1]) * 60 if time

How do you have a Discord bot read DMs sent to it? (discord.py)

冷暖自知 提交于 2021-01-27 12:50:55
问题 I've come up with a way to DM people, but I want to know what they say back to the bot through DMs, as if the bot "reads" the DM, and then forwards it to some channel in a discord server of mine, or, even better, DM it to me. Here is my starting code: if message.content.startswith("!dm"): if message.author.id == "[YOUR ID HERE]": memberID = "ID OF RECIPIENT" server = message.server person = discord.Server.get_member(server, memberID) await client.delete_message(message) await client.send

Creating Rule agreement when someone join

大城市里の小女人 提交于 2021-01-27 09:37:28
问题 I want to a bot that will set the new member to a role that can only view one channel and have to agree on rules in order to use the server. I have wrote this to do it but I keep getting this error. Ignoring exception in on_member_join Traceback (most recent call last): File "C:\Users\ezter\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "D:\programing\Discord Bots\Osis Nation\Start.py",

Creating Rule agreement when someone join

情到浓时终转凉″ 提交于 2021-01-27 09:36:33
问题 I want to a bot that will set the new member to a role that can only view one channel and have to agree on rules in order to use the server. I have wrote this to do it but I keep getting this error. Ignoring exception in on_member_join Traceback (most recent call last): File "C:\Users\ezter\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event yield from getattr(self, event)(*args, **kwargs) File "D:\programing\Discord Bots\Osis Nation\Start.py",

How to react to a specific message (discord.py)

纵饮孤独 提交于 2021-01-27 07:40:48
问题 I'm coding a suggestion bot that's supposed to send a player's suggestion to a suggestions channel in my server and react in the suggestions channel with some emojis. The problem is that using 'message' as the Message parameter would react to the message sent to trigger the code, but I want it to react to the message the bot sent to the suggestions channel. I'm fairly new to coding. How can I get the bot to react to a message in a different channel? text_channel = client.get_channel(

discord.py rewrite: TypeError: cogs must derive from Cog

我是研究僧i 提交于 2021-01-27 07:09:57
问题 As my bot is getting bigger, I'm trying to implement cogs, however I have ran across a problem. I have my whole code set up and ready, but for some weird reason I keep getting this error: Traceback (most recent call last): File "C:\Users\Lauras\Desktop\Akagi Bot\main.py", line 107, in <module> bot.add_cog("cogs.fun") File "C:\Users\Lauras\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 477, in add_cog raise TypeError('cogs must derive from Cog')

discord.py rewrite: TypeError: cogs must derive from Cog

笑着哭i 提交于 2021-01-27 07:09:01
问题 As my bot is getting bigger, I'm trying to implement cogs, however I have ran across a problem. I have my whole code set up and ready, but for some weird reason I keep getting this error: Traceback (most recent call last): File "C:\Users\Lauras\Desktop\Akagi Bot\main.py", line 107, in <module> bot.add_cog("cogs.fun") File "C:\Users\Lauras\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 477, in add_cog raise TypeError('cogs must derive from Cog')

How do you create a custom decorator for discord.py?

 ̄綄美尐妖づ 提交于 2021-01-25 06:54:53
问题 I am working on a bot. For a certain cog, I wish to create a custom check decorator that checks to see if the person running the command has a certain role. The role is stored as a role class as an instance variable. When I tried running it, it doesn't work. How do you make the decorator? class Moderation(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot self.mod_role = None # Assume there's already a role here class Decorator: @classmethod def requires_mod(cls, func):

How to make a canvas profile card in discord python bot?

有些话、适合烂在心里 提交于 2021-01-24 09:05:14
问题 I need help with discord.py. I've been creating a bot on python, so I wanted to make a canvas profile card with this bot. The problem is, I did not find anything in google about it, only node.js. I do not want to rewrite my bot and I'd like to make a profile card like example: juniperbot, mee6. Help me with it please! 回答1: I don't know jupiterbot nor mee6 but if canvas means Image manipulation with Canvas in documentation for discord.js then it is used only to generate image and simply send()

Discord.py Check if Channel is a DM

拥有回忆 提交于 2021-01-23 03:44:17
问题 I am creating a command that i only want to be executable through a DM with the bot. The current code makes it possible to send the command to any channel, i want to prevent this. @client.command() async def check(ctx, arg): if discord.ChannelType.private: await ctx.send(arg) I've also tried: discord.ChannelType == discord.ChannelType.private & discord.DMChannel 回答1: In discord.py, direct message channel objects come from class discord.channel.DMChannel. We can check if an object comes from a