#discord-bots
1 messages · Page 904 of 1
The guild that the message belongs to, if applicable.
@bot.command()
async def serverinfo(ctx):
"""Shows server info"""
server = ctx.message.server
roles = str(len(server.roles))
emojis = str(len(server.emojis))
channels = str(len(server.channels))
embeded = discord.Embed(title=server.name, description='Server Info', color=0xEE8700)
embeded.set_thumbnail(url=server.icon_url)
embeded.add_field(name="Crée le:", value=server.created_at.strftime('%d %B %Y at %H:%M UTC+3'), inline=False)
embeded.add_field(name="Server ID:", value=server.id, inline=False)
embeded.add_field(name="Membres sur le serveur:", value=server.member_count, inline=True)
embeded.add_field(name="Server owner:", value=server.owner, inline=True)
embeded.add_field(name="Default Channel:", value=server.default_channel, inline=True)
embeded.add_field(name="Server Region:", value=server.region, inline=True)
embeded.add_field(name="Verification Level:", value=server.verification_level, inline=True)
embeded.add_field(name="Nombre de rôle:", value=roles, inline=True)
embeded.add_field(name="Nombre d'émojis:", value=emojis, inline=True)
embeded.add_field(name="Nombre de Channel:", value=channels, inline=True)
await ctx.send(embed=embeded)```
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | [1, 2, 3] <class 'list'>
002 | {'1': 2, '3': 4} <class 'dict'>
003 | "hello there" <class 'str'>
The guild that the message belongs to, if applicable.
Maybe you mean system_channel?
@bot.command()
async def serverinfo(ctx):
"""Shows server info"""
guild = ctx.message.guild
roles = str(len(guild.roles))
emojis = str(len(guild.emojis))
channels = str(len(guild.channels))
embeded = discord.Embed(title=guild.name, description='Server Info', color=0xEE8700)
embeded.set_thumbnail(url=guild.icon_url)
embeded.add_field(name="Crée le:", value=guild.created_at.strftime('%d %B %Y at %H:%M UTC+3'), inline=False)
embeded.add_field(name="Server ID:", value=guild.id, inline=False)
embeded.add_field(name="Membres sur le serveur:", value=guild.member_count, inline=True)
embeded.add_field(name="Server owner:", value=guild.owner, inline=True)
embeded.add_field(name="Default Channel:", value=guild.default_channel, inline=True)
embeded.add_field(name="Server Region:", value=guild.region, inline=True)
embeded.add_field(name="Verification Level:", value=guild.verification_level, inline=True)
embeded.add_field(name="Nombre de rôle:", value=roles, inline=True)
embeded.add_field(name="Nombre d'émojis:", value=emojis, inline=True)
embeded.add_field(name="Nombre de Channel:", value=channels, inline=True)
await ctx.send(embed=embeded)
oh ok
Except for any non-serialisable objects, E.g Message, Guilds Members etc
How is that ?
its system_channel not default_channel
what are webhook embed docs
Thanks
@bot.command(name="claim",description="This is the description of your command. both name and description are optional",pass_context=True)
async def _claim(ctx, *, reason=None):
username, user = reason.split(':')
if not get(ctx.guild.roles,id=int(952619437427654696)) in ctx.author.roles:
return await ctx.send("you dont have role 3l make ticket to apply")
huk = "webhook"
disc =DiscordWebhook (url =huk )
embed = DiscordEmbed(title='Alexs' , description='ok', color='264dd9')
disc.add_embed(embed)
response = disc.execute()``` webhook sends anyway without command
pep-8 consistency:
indents:
color being str:
not async:
some whack webhook module:
useless brackets:
deprecated parameters:
useless get functions:
no typehints:
LOL
with what?
Hello, when im trying to make the bot add a default emoji to a message, it is throwing
discord.ext.commands.errors.EmojiNotFound: Emoji ":star:" not found.
.How can i get the bot to recognize normal emotes? i cant find a way
like for example in the command, id do .add (message id here) (emoji here)
How can I set a custom bot status?
!d discord.ext.commands.Bot.change_presence
await change_presence(*, activity=None, status=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the client’s presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
``` Changed in version 2.0: Removed the `afk` keyword-only parameter...
unicode
I'll try, thx
yea i just read about it, how can i get it in unicode tho
search up emoji to unicode
there are some websites where you type in the emoji and it gives you the unicode
some command like that
ill find a way to do it wihtin the commsnd
\U00002b50: WHITE MEDIUM STAR - star — http://www.fileformat.info/info/unicode/char/2b50
Get the complete details on Unicode character U+2B50 on FileFormat.Info
!charinfo 👍
\U0001f44d: THUMBS UP SIGN - 👍
yea
are there docs for dpy2?
yeah you just go to the discord.py docs and change it to unstable
i think
oh ok, thx
realistically noone ever uses docs
you just print(dir(obj)) to get all the info you need
or look at the sourcecode
I prefer reading source over the docs
agreed
But then again, it's mostly just preference some people won't be able to understand
if you know how to, sourcecode > docs
hmmm
well, i want to know how to make a dropdown
i am not good at reading source code
i have realised
just wondering, is it possible to host multiple bots on a VPS
meh reading dropdown sourcecode would probably be an assache anyway
depending on your vps, but most likely
for specifically dropdowns are pycord and dpy the same?
but I know that there are tiny (tiny) changes
Try it out and see then
alright
how to delete the webhook on on_webhooks_update event?
!d discord.Webhook.delete
await delete(*, reason=None, prefer_auth=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes this Webhook.
what does said time command do?
Can you describe what the time command will do?
time you mean the current time?
:P i did, basically this event returns the channel. and when i do channel.webhook.delete(). it gives this error 'TextChannel' object has no attribute 'webhook' so ya
for dropdowns, is it mandatory to create a sub-class?
cuz im watching a yt vid (cuz i dont understand anything else) and I don't rlly trust it that much
idk tho
why the hell does it return channel
idk tbh
Subclass of the view?
!d discord.on_webhooks_update
discord.on_webhooks_update(channel)```
Called whenever a webhook is created, modified, or removed from a guild channel.
This requires [`Intents.webhooks`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.webhooks "discord.Intents.webhooks") to be enabled.
cringe
Relative time with formatters
i mean seems pretty pointless considering each message literally has a timestamp on it
i get ttt has no attribute current_player
ok, in dropdowns, is there a way to hide the view ONLY to a member after they have selected it
ephemeral=True
no
Or what
he didnt mean tht
oh
he wanted to hide the view for a single member
which isnt possible according to my knowledge
well, i dont need that specificaly
i just need a solution that the user can only pick once
just store a bool of whether the user has already selected earlier or not ig
#help-carrot can someone help pls ;-;
🗿
anyone know how to make a command where it takes everyone off a role you mention
as in it mentions without the ping?
you would create a webhook with the mention in the content and set allowed mentions to none
you didnt understand
you didn't word it well 
ik i didnt
idk how to explain it
pretty much the role you mention everyone on that role will be remvoed from the role if that makes sense
if member is a role, and you run the command it removes the role from everyone that has it?
yes
property members```
Returns all the members with this role.
then just await member.remove_role(role)
@client.event
async def on_message_delete(message):
with open('log.json', 'r', encoding='utf-8') as f:
guilds_dict = json.load(f)
embed = discord.Embed(title=f"deleted a message {message}",description="", color=0xFF0000)
embed.add_field(name=message.content, value=f"This is the message that he has deleted",inline=True)
channel_id = guilds_dict[str(client.guild.id)]
await client.get_channel(int(channel_id)).send(embed=embed)
channel_id = guilds_dict[str(client.guild.id)]
AttributeError: 'Bot' object has no attribute 'guild'
WOOOOOO I DID IT
is there a way, that when Select Callback is called, to find (if exists) the last option selected?
nice
ok, does discord.ext.commands.Bot not have slash_command
how to make slash commands (dpy 2.0)
@fervent surge app_commands
bot.app_commands?
that doesn't work
im just reallly confused
why is there no 2.0 docs?
Did what?
HuH?
I don’t think discord.py supports / commands maybe try next cord or something
im sure it does
should I just use pycord
They only started updating it like week ago I don’t think so yet
like, atleast they have docs
Yes it’s more efficient
@bot.command(name="claim",description="This is the description of your command. both name and description are optional",pass_context=True)
async def _claim(ctx, *, reason=None):
username, user = reason.split(':')
if not get(ctx.guild.roles,id=int(952619437427654696)) in ctx.author.roles:
return await ctx.send("you dont have role 3l make ticket to apply")
webhook = DiscordWebhook(url= os.environ['alexlol'])
embed = DiscordEmbed(title=f'{user}', description= 'ok {username}', color= '264dd9' )```
Auto sends requests to web hook
Even thought it’s command
as if
What are you even trying to do
how to install pycord????
dont
i will
i am soooooo confused
i can't even explain it
and 100000% im not using disnake
ill try again tomorrow i suppose
yay
why lol
Make command work on certain role and if it has role send webhook request
you might want to start by actually learning python
use the @has_role decorator
Overrated decision
Hi, I seem to be having some issues getting my bot to run a function. It's producing this error```py
File "C:\Users\Teagan\Documents\Coding\Zupie\bot\cogs\users.py", line 47, in userinfo
await userinfo(interaction, member)
NameError: name 'userinfo' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\tree.py", line 696, in _call_context_menu
await ctx_menu._invoke(interaction, value)
File "C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\app_commands\commands.py", line 659, in _invoke
raise CommandInvokeError(self, e) from e
discord.app_commands.errors.CommandInvokeError: Command 'User Info' raised an exception: NameError: name 'userinfo' is not defined```I would put the _userinfo inside of my cog class but I want the context menu function to be able to call _userinfo which it won't be able to do if it's inside the class as d.py 2.0 context menu's can't be in classes and so don't have self.
This is my code: https://paste.pythondiscord.com/matugudapa
It's not out yet, still in alpha
But yea you can refer to the master docs
How do u send a dm in discord.py
So I'm getting this errorpy Failed to Load Extension cogs.users ExtensionFailed: Extension 'cogs.users' raised an error: ImportError: cannot import name 'Context' from 'discord' (C:\Users\Teagan\Documents\Coding\Zupie\env\lib\site-packages\discord\__init__.py)when trying to import Context like thispy from discord import Member, User, Interaction, Embed, app_commands, Context, is that not the way to do it? (d.py 2.0)
from discord.ext.commands import Context
Why? Disnakes not that bad
this is gonna be hard to explain but i have a football sign command where when you run it, it gives the person the role im trying to find out how to make it where you can only sign a certain amount of people and when u get to that amount it doesnt work
think of it as a -giverole command but you can only do it a certain amount of times for each role
every role has a max of (amount) of players to sign
thats an example "roster" is the amount
so I'm having this issue where even with every intent enabled, on_message doesn't seem to have any content
Maybe check the amount of members a role has?
!d discord.Role.members
property members```
Returns all the members with this role.
it does however get a message object py <Message id=952709353469796387 channel=<TextChannel id=819070016036667412 name='standing-chat' position=21 nsfw=False news=False category_id=760303039831212042> type=<MessageType.default: 0> author=<Member id=668304274580701202 name='StandingPad' discriminator='9655' bot=False nick=None guild=<Guild id=760302595808952352 name='The Random Server' shard_id=0 chunked=True member_count=12>> flags=<MessageFlags value=0>>
Can u show where u define ur intents
not what i want idk how to explain it perfectly just look at the screenshots "roster 5/21" i want it where u can only sign 21 people and if u have 21 nothing happens next
I have a wrapper class, so the intents and registering the intents looks something like:py discord_intents = discord.Intents.default() discord_intents.members = True discord_intents.presences = True discord_intents.messages = True commands.Bot.__init__(self, command_prefix = ">", intents=discord_intents)
What does the bot do when u sign someone
so pretty much if you own a team when u do sign it gives the member the team role so hes on your team
and i want to make it where the team owner can only sign 21 people
discord_intents.message_content = True
You could use a database
no idea how to use that shit
Learn
Well I guess check the number of people on the team role and decide what you want to do from there. I’m not sure if that’s what ur asking
i need to make a command where when they hit the limit they cant sign anymore
if len(role.members) > some_int: # do some stuff
My bot got verified
what do i do in the do some stuff lol
ehhhh idk why this doesnt work, also there is no errors ```py
@client.event
async def on_guild_channel_create(channel):
start_time = time.time()
guild = channel.guild
members = []
channel_names = []
async for x in guild.audit_logs(action = disnake.AuditLogAction.channel_create, limit = 2):
members.append(x.user.id)
channel_names.append(x.target.name)
if members[0] == members[1]:
punished = disnake.utils.get(guild.members, id = int(members[0]))
punished_roles = [x.id for x in punished.roles]
if whitelisted[0] or whitelisted[1] or whitelisted[2] in punished_roles:
return
try:
await punished.kick(reason = "Created Channels")
except Exception as e:
print(f"Error: {e}")
final_time = time.time()
total = int(round(final_time - start_time))
text = str(datetime.timedelta(seconds=total))
channel_name =', '.join(channel_names)
em = disnake.Embed(title="Action | Created Channels")
em.add_field(name=f"{punished} created channels({channel_name})",value=f" {punished} was kicked for creating channels. ", inline = False)
em.add_field(name="Time taken", value= f"{text}s", inline = False)
em.set_author(name= guild.name)
channel = client.get_channel(security_channel)
await channel.send(embed=em)```
security_channel is a variable that has the channel id ^
Whatever u want to happen when the amount of players hits the limit
Shouldn't it be <
Oh wait
Well that could also work
Well if you do < then adding to the roster and role and stuff will be in an extra indent
Which I personally don’t like
any idea?
i just dont know why it doesnt returns a error or work
whats the command to make the command not work so he cant sign anymore

Now you want a command to makes signers not be able to sign anymore?
@slate swan wake up, and help me wit dat 
i need to make it where when they hit the limit then they are not able to
Then use this in ur command
You can just do what master said
?
Why are you using a try and except
,
ik that so how do i make it where it stops working if i just put that it wont do anything will it?
if the bot doesnt have perms to do something?
what is that
also i've removed the try except and the samething
some event 
Well if when u sign someone it adds to a certain role. If you check the amount of people in the role then u can send some sort of message or whatever u want to do
anti create channel
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'
@bot.command()
async def massban(ctx):
users = [id1, id2, id3]
for user in users:
async with ctx.channel.typing():
userban = bot.get_user(user)
await ctx.guild.ban(user=userban, reason='Massban')
await asyncio.sleep(10)
await ctx.send("Done")```
trying to ban only a few members, but it says that the return of bot.get_user is none
make a for loop to get the elements inside the list
nvm shit confusing me ill just find another way
Sorry I couldn’t help. Looks like a cool bot tho
for user in users: no?
for user in users:
await ctx.guild.ban(user= user, reason = "massbad")```
yes
thanks
wait i didnt see that
its cool lol
ma bad i didnt see it haha
just remove the "userban"?
ok, so do user?
Not sure if this would work but try discord.Object(id=user) instead of bot.get_user()
so for nextcord nextcord.Object(id=user)
Oh yes
if the users id is valid then, that should work w/o the client.get_user
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'int' object has no attribute 'id'
@bot.command()
async def massban(ctx, *, users):
for user in users:
async with ctx.channel.typing():
# simulate something heavy
userban = bot.get_user(user)
newUser = int(user)
await ctx.guild.ban(user=newUser, reason='Massban')
await asyncio.sleep(10)
await ctx.send("Done")```
That happens when the user isn't in the cache
so bot.cache_users?
fetch them instead
fetch_user() make an API call so it's guaranteed to return an object given it's a valid ID
what if they arent in the server?
so await user.fetch_user()
Would discord.Object work?
That just creates a snowflake
Should still return an object
Won’t all the ban need is the id?
alright
For banning and unbanning yes, a snowflake will do
do u see anything wrong @sick birch ?
So wouldn’t fetch_user be an un needed api call? Unless you need other info about the user
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'fetch_user'
bot.fetch_user
i also just noticed that the logo of the server updated
bot.fetch_user ig
wrong place soz
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10013): Unknown User
but it is a user
Well it couldn’t find it
but i used yours
Yeah maybe the id is wrong
use a valid id
ok i have yours
maybe the bot doesnt have mutual servers with the user
but it should get them no matter what
I think the id may have to be an int
no
the bot should have mutual servers
with the user 
I want it without mutual servers 
thats impossible
Try this
so then how come it works on other commands (regular ban)
ok
like the other bots?
for example dyno?
Same error
I did it on mine, which is in 2 server, it banned someone
does that someone have mutual servers with the bot?
no
interesting
maybe i need to make it like this
can I do that in the func though?
but u want to ban more than 1
like async def massban(ctx, *, user: nextcord.User)
no but that will give error, maybe user = nextcord.User
but that allows u to ban only 1 user
yea
no, user: nextcord.User is correct
but if i want it for each user
after the for loop
newUsertoban = user.nextcord.User?
That wouldn’t work
then add more than one e.g ````py
async def mycommand(ctx, user: nextcord.User, user: nextcord.User, etc ...)``` or you need to make a list 
Figured as much
!d nextcord.ext.commands.Greedy
class nextcord.ext.commands.Greedy```
A special converter that greedily consumes arguments until it can’t. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.
When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.
For example, in the following code:
```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
``` An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
make it a list? ```py
list = []
list.append(user)
then use dis
didnt know that exists
ok so now how. do i make it a nextcord.User
commands.Greedy[nextcord.User]
k, imma try that
its going to return a list
I still have the for loop with it
from nextcord.ext.commands import Greedy
👍 trying now
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'User' object is not iterable
@bot.command()
async def massban(ctx, *, users: Greedy[nextcord.User]):
print(users)
for user in users:
async with ctx.channel.typing():
await ctx.guild.ban(user=user, reason='Massban')
await asyncio.sleep(10)
await ctx.send("Done")```
why are you triggering channel.typing for every user
let it trigger outside of the for loop
oops
extcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'User' object is not iterable
Ehat did users print
you dont seperate it with ,
nothung printed btw
Welp this is all I managed to do and my bot doesn't stop saying howdy now
i want it for a lot of users
will take infinite users
yeah
no because it has a specifc amount of users
btw its the part with Greedy[nextcord.User] it says its not a user
no
!d discord.ext.commands.Greedy
class discord.ext.commands.Greedy```
A special converter that greedily consumes arguments until it can’t. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.
When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.
For example, in the following code:
```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
``` An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
ok so i get the user ids, but then how do i get them globally like nextcord.User
so I can ban them even if not in mutual servers
try using nextcord.Object
users = [1234456634543, 2345345345343]
for user in users:
await guild.ban(discord.Object(id=user))
you shouldn't need that for a mass ban
okie
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10013): Unknown User
well user wasnt found
well , yes, but if i use a regualr ban command (https://cdn.discordapp.com/attachments/343944376055103488/952719208909783060/Screen_Shot_2022-03-13_at_8.05.54_PM.png) using user: nextcord.User it works
yeah im not sure
k
so im using discord commands.Paginator and im curious if i can have the reactions have multiple functions rather than just going next or back is there anyway i can do that?
paginator.add_reaction('🏠', "first")
paginator.add_reaction('🎉', "next")
paginator.add_reaction('🛠️', "next")
paginator.add_reaction('🎮', "next")
paginator.add_reaction('🔨', "last")
embeds = [embed , embed2, embed3, embed4, embed5]
await paginator.run(embeds)```
yea commands.Paginator mb
idt that supports reactions
ohh
does anyone know how to find a role id by the role name?
or is that not possible
im trying to make a command it requires a role id but i want it to be a public bot so it has to find the id
get a guild's list of roles, then match the name of the role u r looking for, then get the id
a role should have .id attr
its a football bot i have this rn
damn
!d discord.utils.get
discord.utils.get(iterable, /, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.
If nothing is found that matches the attributes passed, then `None` is returned.
Changed in version 2.0: The `iterable` parameter is now positional-only.
Changed in version 2.0: The `iterable` parameter supports [asynchronous iterable](https://docs.python.org/3/glossary.html#term-asynchronous-iterable "(in Python v3.10)")s...
my bad
but we'd prefer if you just explain :) thanks
yep ok
does anyone know of a eval cog
my giveaway cog broke and cleared the json file
so ima just use an eval command to finish the giveaway and pick 4 winners
so jsut do this
actually go to dms
ok
Use the jishaku extension
Is that easy to put into repl
Don't know about replit, should get off of replit anyway
I use it for small per server projects
replit😔
👀
ok
didnt work
use discord-ext-menus
me?
no, 9Dee
wym
Show the error
something like:
role = discord.utils.get(guild.roles, name="Name of role")
if role:
role_id = role.id
im on mobile rn so have some patience pls
variable naming
ikr
id is a built in
fr? ok
be careful though, if there is no such role with said name it will return None
!e print(id)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
<built-in function id>
!d id gives u the address of the memory allocation of the object
id(object)```
Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same [`id()`](https://docs.python.org/3/library/functions.html#id "id") value.
**CPython implementation detail:** This is the address of the object in memory.
Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `builtins.id` with argument `id`.
!e print(id("lol"))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
140265660965488
i.e ^
i think u meant e.g. lol
Right
He means in example
lol
not really on topic ~~ idc~~
yea yea lets move on
That do be used for saying that is, right?
i.e. stand for id est which means that is [to say] so yea, youre right
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Thanks oki
Man dpy 2.0 is gonna have so many breaking changes it’s not even funny. 💀
They made all extension related methods async
IKR
yep
😔 I hate its slash commands impl
why did they even choose to do that
isn't it just a PR rn?
or was it merged
o
Why
The raw socket receive events aren’t fired anymore unless you have some option turned on in your Client instance constructor as well.
smh
This rewrite for my bot I’m going to have to do when this releases is gonna hurt 🥲
creating a whitelist of server id's and then a simple if statement comparing if the server the command was sent in is in the whitelist should be all it takes
I might be slow but all of my cogs just tanked. I was reading the previous chats and it looks like Rapptz made everything extension related async, so I am getting errors like
RuntimeWarning: coroutine 'BotBase.add_cog' was never awaited
client.add_cog(Moderation(client))
for a moderation cog for example
What is the solution to fixing this
youd make your setup function async and then await add_cog
async def setup(client):
await client.add_cog(Moderation(client))
so something like that?
yeah that looks right
discord/ext/commands/bot.py line 531
async def add_cog(```
yup its a coroutine now
it is now
^ src code proves it
ok thats cool
Good thing tbh
At least now we can run async functions in it
that worked but now in the setup I am getting a different error
for i in range(len(cogs)):
cogs[i].setup(client)
it is in main.py and is returning "RuntimeWarning: coroutine 'setup' was never awaited
cogs[i].setup(client)" where cogs is a list of the cogs of the bot
wait you manually load your extensions?
yeah its not the best, I throw them all into a list and then iterate through and set them up
well the setup function dpy recommends is intended as part of their extensions system where youd use bot.load_extension('path.to.module') to load each file
oh ok, I can give that a try
i mean, they made that method require awaiting too
of course it gives the same
RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
client.load_extension('cogs/mod.py')
yeah, where do I await?
the... method call?
also it has to be dot-qualified, as if you were importing it
in your case itd be cogs.mod
so ?
await client.load_extension('cogs.mod.py')
without the py
oh right
just like how youd write import random and not import random.py
yeah that makes sense
aight im off to bed now
epic, thanks for the help
i think it's because of how d.py uses asyncio idrk
probably the method has coroutines in it now hence why its a coroutine
if message.attachments:
em = discord.Embed()
em.set_image(url=message.attachments_url)
em.color = 0x2f3136
await channel.send(embed=em)
else:
error: AttributeError: 'Message' object has no attribute 'attachments_url'
how do i put the attachment to the embed image
not every attachment have a url
how do i make it so it has a url
only images and gifs can be
so its technically impossible
possible for images and gifs, also videos but you can't set them in embeds. except these 3 no other attachment have a link on discord
how do i attach it outside the embed
the video link
like you need to set them up by endswith('.mp4') kind of stuff
is there any way i can activate cooldown only during specific instances off a command? please ping me if you answer this
cooldown begins once the command is invoked properly
i want like an if statement?
hi guys
it will still be triggered
Hello can anyone guide me on how to make an economy system in my bot
Python
use tutorials
All use discord.py and json
oh is it possible to reinvoke a cooldown inside a command if a boolean statement runs false?
then what do you want to use?
Anything as long as it works
????
hmm
Its outdated apparently
i see
for example if somebody doesn't reply before timeout then they can run the command again instantly?
Yes
ofc
can you tell me how to do that
yes
use try, except...
yes
so basically the whole command is a try: except?
@bot.command
async def - wait why am i spoon feeding you? XD
depends
Don't spoonfeed, they don't learn anything that way
ik thats why i stopped
Use a database and integrate that with your bot
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
so should i just raise error if timeout and then have an error handler?
i don't think i can do that inside the cmd tho
do what inside of the command?
Hey kayle
hey jord
nvm i foudn it dynamic cooldown
U said db which and how
Im not asking for spooonfeed
Im asking ways, dont tell me cmd tell me ways
sed
aiosqlite3/mongodb/redis/pgsql
if you want something similar to json use mongo, pgsql/aiosqlite3 require you to learn CRUD operations/sql
depends
Have u ever used or know how to use json?
Can u gimme the integrating cmd
Spoonfed
Like the path mentioning it showed an error in the path i put like......
🗿
Only tht 2 lines
that with open one?
that's pretty simple
Ik but its showing me 2 errors last time i did, i need some spoonfeeding
well
I can explain you the format
firstly import json and then with open [then your file name] as [and give it a name here]
then use dump() function
Uhh as for the file name
Its main bank
Uk what ill remove my laptop out and try it rn
U explain pls
what are you trying rn?
Geting it out a sec
I found it ez
its not a database...
alright
you can do that, but not a good practice
read this message ^
your call
Hey @inland crest!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Hey @inland crest!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Hey @inland crest!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
...
how do i send?
use paste bin
its saved on paste bin
copy the link and send the link here
i dont get them
i dont understand the cmd the async def
i dont use smthing i dont understand
its a rule i follow
then learn it
thats why i cam here seeking for help
try learning about asynchronous programming
the proper decorator is @wooden frigate
whats tht a video?
argh
np i got it

@inland crest how new are you to python?
any ideas why this is not working
2 yrs
you would know what async and all that other shit is.
i learned async the first 3 days i started python
yes thanks
any1?
am i supposed to put an api key or smth
i have no clue, but it’s reading smth as a nonetype, make sure all params or kwargs are correct, etc
Specify a source language
!eval print(2+2)
@inland crest :white_check_mark: Your eval job has completed with return code 0.
4
isnt it supposed to detect
!eval ```py
@inland crest :warning: Your eval job has completed with return code 0.
[No output]
#bot-commands
ok
in the docs it says it doesnt have to
No
.
wats the issue 
probably an issue with your eval function
nope same thing happens in the main code
Library issue
Ive seen this issue before, u install version 3.0.0 by default. Install 4.0.0
Jesus christ thats blinding
what should i do

I think it's guild_ids = [servers]
english not good

googletrans is ass
thats why i removed it
@client.command(aliases = ['purge'])
async def clear(ctx, amount =11):
if (not ctx.author.guild_permissions.manage_messages):
await ctx.send('this command requires ``Manage Messages`` ')
return
amount = amount + 1
if amount > 101:
await ctx.send('Can not delete more than 100 messages')
else:
await ctx.channel.purge(Limit = amount)
await ctx.send('Cleared Messages')
await ctx.channel.purge(Limit = amount)
TypeError: purge() got an unexpected keyword argument 'Limit'
I have this error but I don't know why
limit=
Congratulations
i made a music bot for a while ago. But today when i was gonna use the bot i realised it wasnt working. i didnt change anything so it must have been a change to python, discord.py or youtube.dl.
This is the error i get:
Traceback (most recent call last):
File "/home/runner/Selonbot-beta-6/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 278, in play_func
check_queue(ctx,channel)
File "main.py", line 241, in check_queue
voice_client.play(FFmpegPCMAudio(URL,**FFMPEG_OPTIONS), after= lambda e: check_queue(ctx, channel))
File "/home/runner/Selonbot-beta-6/venv/lib/python3.8/site-packages/discord/player.py", line 225, in __init__
super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
File "/home/runner/Selonbot-beta-6/venv/lib/python3.8/site-packages/discord/player.py", line 138, in __init__
self._process = self._spawn_process(args, **kwargs)
File "/home/runner/Selonbot-beta-6/venv/lib/python3.8/site-packages/discord/player.py", line 147, in _spawn_process
raise ClientException(executable + ' was not found.') from None
discord.errors.ClientException: ffmpeg was not found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/Selonbot-beta-6/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/Selonbot-beta-6/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/Selonbot-beta-6/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg was not found.```
read the error
idk, but maybe something got fucked and you deleted ffmpeg
hmmm
i didnt change anything
like it should be working cus i changed nothing
something must have changed in discord or youtube
Heyyy, how do we do that for example with the ban command if someone who doesn't have the authorization the bot sends a message saying he doesn't have the authorization ?
Don't use replit
install ffmpeg
its just a command
Heyyy, how do we do that for example with the ban command if someone who doesn't have the authorization the bot sends a message saying he doesn't have the authorization ?
Wait wait
ok
oh, any good alts u know?
why?
i already import it
not import, install
Read googletrans's issues on github
theres a way to fix that error
you install it, not import it
sudo apt-get install ffmpeg or whatnot
alright
debian based distros are cringe
Replit is not designed for discord bots, also this @regal cove
🗿 true
i know
i know all the flaws and stuff about repl.it
nice
i have considered my options and decided to use it
replit doesn't support ffmepg now btw so you can't solve that error
ohhh so thats why it stopped working
yea
did you consider that you will have problems with some block of code which normally they will work but replit mess it all up?
cus it used to work just by installing Pynacl
what?
i said i have considerd my options
meaning its the best free thing for me imo
Hi anyone knows how to make a custom help command instead of having the default one
I am use / commands
package?
Yeah that is for discord.py, he is using slash command
this is what i use:
client.remove_command("help")
@client.command(name="help")
async def help_func2(ctx):̀```
Nextcord here
i dont use slash command tho
It will be mandatory for public bots from April 202
*2022
Uhm didn't use it for a while, you have to read the docs first, you need to find in the docs a way to retrieve all slash commands
my bot aint public tho
i dont want it to be public honestly
I want it as big as dank memer bot
We can't suggest you free hostes, they are not good and can be unsafe
I don't think there are any
Untill you migrate your bot to a linux VPS and your code doesn't work for some reason lol
HI
Hey
anyone knows why commands.Bot.users is returning an empty list?
while my bot is in a server with almost 5.1k members
intents?
hi
Is there a way like you swear saying shit and it deletes the message and says swearing is not allowed
import discord
from discord.ext import commands
class Role(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
@commands.has_permissions(manage_roles=True)
async def role(self, ctx, user: discord.Member, *, role: discord.Role):
if role.position > ctx.author.top_role.position:
await ctx.send("You don't have permission.")
if role in user.roles:
await user.remove_roles(role)
await ctx.send(f"Succesfully removed {role} from {user.mention}.")
else:
await user.add_roles(role)
await ctx.send(f"Succesfully given {role} to {user.mention}.")
def setup(client):
client.add_cog(Role(client))
``` This command works in my server where I am the server owner, but when I try it in another server and I got manage roles perms it just gives me a error I don't have enough perms
Is your highest role at the highest position in the server?
Ohk
The code runs but when you do the / command then it shows interaction failed?
soo i wanna make a dungeon but with moving enemy, is there anyway to make pathfinding algorithm :v (idk where to put it so i put it here xD)
Wrong channel
yes where :V
This is for discord bots,not for games
🗿 havent i says that idk where to put that
#game-development here
So the interaction is a button?
but that's for discord py related lol
Youre just mad
wtf?
=-=?
lamo
Well so you need a path finder in the end?
:v yes
Yes,so that happened with me too but with slash commands
I think its a error in the Interaction part
try in #algos-and-data-structs or #python-discussion
general is terrifying
or open take an help channel in #691405807388196926
Show me the Interaction part here,I wont open link
aye not for pygame, they mostly make a tutorial for pygame ;-;
uh.. Available Help Channels, the category
Using @ in channels LMAOOO
Oh that was the issue
i woke up like 20 minutes ago, sorry hqhahaha
Anyways @small igloo check the help channels in #691405807388196926
k ty
lol you should try disnake then xD
@placid skiff can you help me
the help command?
No
...
Yeah it did
bruh what they did so far is adjusting some doc and add a new file for app_commands
which is pretty bad tbh
what do you need?
@placid skiff
create a list of forbidden words and check if the message contains them
Yes
Idk hwo to do it
check how disnake did them and you will understand why i said that
Well you will need to use the on_message event, so everytime someone send a message it will be triggered
Yes!!
Huh
then you will proceed to get the content of the message and then you can use the any builtin method with your list
!d discord.on_message
discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Warning
Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
So it should be like this
i suggest you to use the bot.listen or cog.listener decorator because the bot.event will "eat" your commands
@client.event
async def nextcord.on_message(shit)
Idk how to use bot.listen
not exactly lol
@bot.listen
async def on_message(message: nextcord.Message):
#your stuff here
if you have subclassed the bot class and declare the event in your subclass, then you can just write the async function without the needing of the decorator
message: nextcord.Message('swear work here?')
type hinting, if you are using an IDE it will recognize automatically that message is an instance of Message class
so you will have intellisense for that variable
I am using replit
Lol
!e print('sus'*10)
@drowsy thunder :white_check_mark: Your eval job has completed with return code 0.
sussussussussussussussussussus
Lol
btw intellisense is not it only use, type hinting is used to make your code more readable, for you and for the others
# type-hinting for returning function
def my_func()->bool:
pass
# type-hinting for variables
def my_func_1(var_1: str):
pass
# type-hinting for decorator function:
import typing
T = typing.TypeVar
def decorator_function()->typing.Callable[[T], T]:
def function():
#stuff here
return function
🗿
blacklisted_words = ["whatever uwu blacklisted words you want"]
@client.listen("on_message")
async def uwu_on_message_listener(message: nextcord.Message):
if message.author.id == client.user.id:
return
if any(word in message.content for word in blacklisted_words):
await message.delete()
Morning to you too ashley xD
Morning black
somehow my disnake bot can't create webhooks anymore, is there any way to see if I got limited because I made too many?
there isnt a limit iirc
huh okay
unfortunately no, the ´channel.create_webhook´ just blocks
yup it's admin and it worked before
try using a try and except
ig
I do 🙃 but it just blocks

you can do better
Why using any. Just use len() 
You can make a list too [...]
It's less to type
?
how do i activate my bot
what do you mean?
run your code
How do you create a custom help order ?
client.remove_command("help")
@client.command(name="help")
async def help_func2(ctx):̀```
that way u will remove discords help command and make your own
i would suggest u make this command in an embed too
this isn't the best way tho, consider subclassing
subclassing too, is only more mechanic, but it is: More efficient, more easy to modify, more reliable
it's like creating the bot by creating an istance of it and subclassing it. Subclassing is a complete different method which gives you more control on the bot with the possibility to create more method that you can use to make easier your code
Use the help command provided by d.py
that one is super bad
honestly no one should use that
!d discord.ext.commands.HelpCommand then
class discord.ext.commands.HelpCommand(*args, **kwargs)```
The base implementation for help command formatting.
Note
Internally instances of this class are deep copied every time the command itself is invoked to prevent a race condition mentioned in [GH-2123](https://github.com/Rapptz/discord.py/issues/2123).
This means that relying on the state of this class to be the same between command invocations would not work as expected.
I can't, I would like to integrate buttons for each category but I can't
No..
it is tho
this is an example of commands.HelpCommand being subclassed, pretty nice isn't it
subclassed can be used
!d discord.View
to integrate buttons you need view
yea, the default one is already nice
bruh
@placid skiff it's ui.View
Thanks
btw this one is really nice, do you have the source code?
my code is messy so tell me if you want to see what I have in my code without help
Thanks
this is an example of the default help command that i hate
i hate this one it looks so bad
hi, disnake. do you know how to get the interaction.response from within the View, without an interaction happening. i want to disable all buttons on timeout, but the on_timeout method takes only self and not interaction
Nope
Interaction is constructed only when there is a click or smth
so there is no way to edit the message without an interaction? i can't believe that
U wanna timeout the view after x seconds automatically?
it's not like there is no way, you need something to trigger your code so you can edit the part that you are interested
yeah
timeout kwarg in the init of the View class
did that
!d disnake.ui.View.timeout
Timeout from last interaction with the UI before no longer accepting input. If None then there is no timeout.
but i want to disable the buttons first, so no one can click anymore
The whole view will be disabled
if dad == lost:
print("cry")
I don't wanna make u cry more, but #ot2-never-nester’s-nightmare
wdym with "order"?
my buttons wont be disabled :( it just doesn't listen anymore
Ah you want it to change the button style to ButtonStyle.disabled?
By disabled you mean that you want them to disappear?
yeah, sorry if that was unclear
Ah
!d disnake.ui.View.on_timeout
await on_timeout()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A callback that is called when a view’s timeout elapses without being explicitly stopped.
@client.command(name="Daddy_come_back")
async def trauma(ctx, milk)
await ctx.message.reply("i will come back son, its fine. just listen to your mom and everything will be fine. im just getting some milk baby")
Well then u gotta make an instnace variable:
view = MyView()
view.message = await ctx.send(...)
Now use this message attr
Do you want my code to see for yourself since I am a beginner in python too ?
and then edit that message with view=view?
Yea, in on_timeout, set the view to self
Bruh .-. it is not suggested to start studyin python with discord.py
You need to learn some basic before.
I can help you but you will barely understand something
How do I restrict events to only work in servers not Dms?
@commands.guild.only works for commands but not events
@maiden fable like that no one could ban me for not providing help xD
I was doing python before but it was 5 years ago and I had stopped since
I started learning Python while doing dpy 👀
ya'll so impatient 
Cz we are eager to try out new things fast 👀
in a bad way
essentially you need to know at least those thing:
OOP
difference between parameters and methods
subclassing
asynchronous programming
decorators
functions
basic python knowledge
Basic knowledge of type-hints (could be really helpfull sometimes)
I also started learning Python while coding in dpy, I know how it feels like 😔
and you tell others to not

cuz its the not best way

whoo it worked :)
Nice
i learned python really fast, like in a week or less (I had a knowledge from other language ofc) then i did some stupid little project and then i moved to d.py
in 5 years the only thing I remember is making random nitro code generators so you see I forgot a lot of things
😔 Random nitro codes
I wonder why one can't access the view's message by default. should I suggest it?
I suggest to you to study python again xD
Sure, I don't think anyone gonna care tho 🤷
well, you can... XD
oh no nvm
I don't have time, I have an internship report to do and learn C++ at the same time because next year I'm going to study at Epitech
well that's good
C++ provides a good knowledge to learn python as fast as possible
isn't it pretty common to edit a message without interaction xD
I just want to develop a discord bot for my private server so I don't have to use external bots
I understand but trust me, probably with your actual knowledge your bot will be finished when you start school
btw if you want to send your code we can watch at it
Discord bots arent that difficult to learn as long as a person has a slight amount of problem solving knowledge. If your already familiar with coding it really shouldnt give you any issues and for me personally was a great way to learn python and helped me to understand parts of it better than any other project
pretty sure that most of users here are not english native xD
I mean to edit a already sent message e.g. when progress is made. not only when a user clicks
Ah
Maybe at these hours
Cz its day in India rn
in Europe too D_D
And everyone ain't a night owl like me
it's the afternoon here
I am extremely bad in English, actually level A2 in Terminale
Lol I haven't even launch yet and i'm hungry
don't worry of that
That's why I'm asking you for help if I had the knowledge in python to code a bot I wouldn't have asked any question or even joined this server
Trust me you would have joined here anyways, i have enough knowledge but sometimes i need help too xD
btw as i said, if you want to send your code we can take a look at it
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
xD
is there a way to see if a message was deleted. e.g. by id
!d discord.on_raw_message_delete exists
discord.on_raw_message_delete(payload)```
Called when a message is deleted. Unlike [`on_message_delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_delete "discord.on_message_delete"), this is called regardless of the message being in the internal message cache or not.
If the message is found in the message cache, it can be accessed via [`RawMessageDeleteEvent.cached_message`](https://discordpy.readthedocs.io/en/master/api.html#discord.RawMessageDeleteEvent.cached_message "discord.RawMessageDeleteEvent.cached_message")
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Lol that is an event hunter, he needs to find a message
No there is no way lighting, deleted message can't be found even by fetching them
btw you can use the on_raw_message_delete event to save the data of the message that you are interested in
👀 He can always compare payload.message_id with his message id
thx both
your help command is empty xD
I know because I don't know how to complete it
though I also came up with this: I know in which channel the message was sent, so I can do channel.fetch_message(id) and see if it raises an error
!d discord.ext.commands.Bot.commands well first of all you need the list of the commands that your bot has, which can be accessed by doing this
property commands```
A unique set of commands without aliases that are registered.
or even better subclass the helpcommand
it will xD
yeah, but only if it was deleted xd
he is a newbie with python
Where ?
pretty easy tho
uhm i have a call now, @thin wolf to you
Is it? For a beginner to understand inheritance and subclassing?
What ?
well dpy is all about oop which inheritance falls into
not sure why someone would be working with such a lib and doesnt know oop its kinds hard which has happened to me
well its not that easy for a beginner as you said then
Discord is just very popular and especially here it's not a surprise that many beginners start with it. My point is for a beginner subclassing a class is hard and a less elegant and more basic solution may be better in this case
How do ppl buy items online using bots? I wasn’t requesting help, 8 was curious 🤔
Probably webscraping a site but I don't think it's tos compliant with most sites
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
How did you get the bot, to send 1 rule?
!src rule
Provides a link to all rules or, if specified, displays specific rule(s).
how to delete all webhooks of a particular channel
Prob look in the server
for webhook in message.channel.webhooks:
await webhook.delete()
will this work?
Hi so I have this command which runs a function user_info_func which sends a msg```py
@slash_user_group.command(name="info", description=info_description)
@app_commands.describe(member="The discord member to get information for.")
@legacy_user_group.command(name ="info", description=info_description, usage="[member]", aliases=["whois", "ui"])
async def info_legacy(self, ctx: commands.Context, member: discord.Member = None):
await interaction_or_context(ctx, member)
await user_info_func(ctx, member)
@slash_user_group.command(name="info", description=info_description)
@app_commands.describe(member="The discord member to get information for.")
async def info_slash(self, interaction: Interaction, member: Union[Member, User]=None):
await interaction_or_context(interaction, member)
await user_info_func(interaction, member)however as member is optional it can occasionally return None. To get around this I wrote another function called `interaction_or_context` py
async def interaction_or_context(transaction, member):
if isinstance(transaction, Interaction):
member = transaction.user if member is None else member
elif isinstance(transaction, Context):
member = transaction.author if member is None else member
else:
print("Something went wrong in 'interaction_or_context'")``` which is supposed to to check if the member arg is None and if it is then it sets member as the value of the person who invoked he command (that being discord.ext.commands.Context.author or discord.Interaction.user but for some reason it keeps returning None which is causing my user_info_func to say iscord.app_commands.errors.CommandInvokeError: Command 'info' raised an exception: AttributeError: 'NoneType' object has no attribute 'activity'


