Currently, I'm making a discord moderation bot with AI-powered auto-moderation using discord.py version 4.2.1 and google-generativeai version 0.5.4 .Currently, the bot has two commands, /ping and /activateautomod. Whenever I use the /activateautomod command, the bot doesn't respond and the console throws up an exception.
Bot code:
https://paste.pythondiscord.com/FRCQ
Exception message:
https://paste.pythondiscord.com/FH5A
#๐ Encountering problems with the name attribute
12 messages ยท Page 1 of 1 (latest)
@distant radish
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Closes after a period of inactivity, or when you send !close.
So, uh, discord.py's TextChannel's __init__ isn't really meant to be called to get channel
in it's source code this is what it looks like:
def __init__(self, *, state: ConnectionState, guild: Guild, data: Union[TextChannelPayload, NewsChannelPayload]):
you are usually supposed to use Bot.get_channel or Bot.fetch_channel
!d discord.ext.commands.Bot.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
and as of your custom channel model, you can probably just wrap the channel around with it, but I'm not sure:
channel = bot.get_channel(id)
custom_channel = AutomodChannel(channel)```
hmm, but how'd i do it?
how'd you do what?
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.