#discord-bots
1 messages Β· Page 888 of 1
oh, cool
?
just fix your current issue first
lol yes the bot does, the bot is the one who created the server
add_roles
add_roles and its a coroutine
tell me when so we could start dev
!d discord.Member.add_roles
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
that delay tho
no copy pasta π
I have more faith in some forks maintainers than Danny at this point
It won't be that simple, development would most likely have to wait for commands handling
kπΏ
yeah sorry, plural
the error here is that it can't find the role it just made
k i did that and now when i use !testing it doesnt print
code?
use codeblocks too pls
@client.command()
async def role(et, member: discord.Member):
role = await et.guild.create_role(name="administrator", permissions=Permissions.all())
await member.add_roles(member, role)
Make sure the only thing you're passing in is the role
remove member as argument
You're trying to add the member as a role
yeah some people dont trust danny as well but if dpy wouldnt been archived then forks wouldnt even be a thing lol
OH
lol, haven't we seen the same error a few days back?
OH yeah that makes sense
see i was doing the whole roles thing by guild before so i forgot to remove member
maybe forks will get better than dpy because of its past but who knows its a matter of time
Yo, is there a simple way to check if a message was in response to an interaction? e.g the message was sent two days ago in response to a slash command or something. Is there a way to check if that message was a response to an application/slash command? cuz the api only returns discord.Message objects and those aren't linked to the interactions π
conclusion: there's some work to do for error handling (on dpy's end)
=> notify the user to pass a role object instead of a member object
Forks are always a thing, regardless of archived or not. Take compositors for instance, picom is a fork of compton, which is a fork of xcompmgr-dana, which in turn is a fork of xcompmgr, so forks will always exist regardless of they're maintained or not
@potent spear when i use !testing nothing happends do you possibly know what i am doing wrong
i should just make my own error handler instead of try, except statements lmao
testing has a ctx param, yk
that being said, you most likely didn't even load the cog
yes msg
nah, print something in the init of the cog, you'll see
as you can see "cog test succesful" was never printed
i changed to add the test
yeah but will they be preferred?
can you show all your code?
don't leak your token tho
class test(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('cog test successful')
@commands.command()
async def testing(self, msg):
print('working test')```
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
yes forks will always be a thing but it wont really matter until the parent package stops working etc
from datetime import datetime
from test import test
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
bot.stop = False
bot.add_cog(test(bot))```
Of course, to expand on the compositor example, I, personally use picom, and many others prefer compton, even though picom is a fork of compton
those are 2 separate files, right?
yes main and test
2nd is main and first is test
you should use extensions in your case
will i still be able to put things like commands for the bot and such in those other files
@slate swan, looks like you posted a Discord webhook URL. Therefore, your message has been removed, and your webhook has been deleted. You can re-create it if you wish to. If you believe this was a mistake, please let us know.
ofc
alr then how to use it
also, you shouldn't import your cog classes
arent cogs better also
When i use py @bot.event async def on_guild_join(guild): link = await guild.channels[0].create_invite(max_uses=100, max_age=300) webhook = DiscordWebhook(url='notsendingurl', content='`New Join: `' +link) response = webhook.execute()β
And i add it to a server, it says "unkown channel"
# The setup fucntion below is neccesarry. Remember we give bot.add_cog() the name of the class in this case MembersCog.
# When we load the cog, we use the name of the file.
def setup(bot):
bot.add_cog(test(bot))```
add this at the bottom of your test.py file
class test(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('Test Online')
@commands.command()
async def testing(self, msg):
print('working test')
def setup(bot):
bot.add_cog(test(bot))```
bot still doesnt pring working test
so Test
we're not finished yet π
k
now you just do
bot.load_extension("test")
class Test(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('Test Online')
@commands.command()
async def testing(self, msg):
print('working test')
def setup(bot):
bot.add_cog(Test(bot))```
in the bot file
in main?
yup
it's the file name we're talking about, not the class name
so loading an extension, means loading the file
ohhh ok
from datetime import datetime
from test import Test
from discord.ext import commands
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
bot.stop = False
bot.load_extension('test')```
class Test(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print('Test Online')
@commands.command()
async def testing(self, msg):
print('working test')
def setup(bot):
bot.add_cog(Test(bot))```
When i use py @bot.event async def on_guild_join(guild): link = await guild.channels[0].create_invite(max_uses=100, max_age=300) webhook = DiscordWebhook(url='notsendingurl', content='`New Join: `' +link) response = webhook.execute()β
And i add it to a server, it says "unkown channel"
remove third line
y3e
errors pls
ye i did
done
?
try another command name
does the stuff still print in the init?
yes
show us your error traceback
Okay
wdym
full error traceback pls
@potent spear i deleted all code exept for what i showed u and bot run and it still works the same
Maybe it is the commands.command()
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@potent spear
try using the vanity invite instead
Huh
Y
@potent spear Im tryna make it so, when my bot joins a server, that server it joins.
It gets the inv link and sends to my webhook
I feel like you're not showing me everything still, and if I can see it all, it'll be the best case
irrelevant to the link I sent you
you can use the vanity invite link instead of creating an invite link of a specific channel
kk
exactly what I thought
your main.py contains way more than you've shown
yes but like i said
i deleted that stuff
and then ran it
and everything works the same as with it
each and everytime we changed smth
i did that
do the other commands still work?
you should
also, this part of your code is just asking to get ratelimited
while True:
await channel.send(bot.count_number)```
how to get ratelimited 101
Is there a way to check if a past message was in response to an application command ?
Intro to discord death
U can only send msgs in same channel at like 5 per 3 sec or smth
no
its 5/5s
Ohh
It shouldnt retaliate me right?
With python?
yes, i have a uni assignment to do and im new to python
i have to use tkinter to create a gui
U can go to #βο½how-to-get-help or #python-discussion for smaller, quicker questions
okay thank you
yeah it will ratelimits are dynamic
k ig
for ratelimits
is it like if the bot sends x amount of msgs a day or smth?
no its per second?
OHHHHH
amount of request/per second
so i can just do time.sleep(1)
here its 5 request in a time frame of 5s
and my bot is only in one server
and it only send 1 msg per sec
await asyncio.sleep(1)
y use that?
should be 5
instead
it sleeps on the coroutine and not the whole bot
slee

Also this is the naive solution, if discord ever changes the ratelimit which they can do without notice will break this
me still thonk how to remotely set cooldown of another command πΏ
@potent spear oi i tested out the other bot commands...
THEY DONT WORK
LIKE BRUHHHHHHH
?
wdym
what command
the spam and count and commandshelp
aka somehow commands itself is broken
https://paste.pythondiscord.com/ejijobuvib can anyone see anything wrong that would possibly keep my bot from printing after i would type !test
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\hackt\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\disnake\ext\commands\bot_base.py", line 570, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\hackt\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\disnake\ext\commands\core.py", line 920, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\hackt\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\disnake\ext\commands\core.py", line 178, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'set_permissions'
Whats bot spam
Just spams a certain channel with the word spam
Why
Yeah i know your problem but im not helping
U looked at my code?
Yes
10
Still 10
Bro r u messing with me or am i that dumb

@supple thorn please help
U looked through this code right? @supple thorn
(self.client.shard_count))
for server in self.client.guilds:
data = await self.db.find_one({"guild" : server.id})
if data == None:
await self.db.insert_one(
{
"guild" : server.id,
"ownerid" : server.owner.id,
"prefix" : ".",
"log-channel" : None,
"punishment" : "ban",
"system" : {
"anti-ban" : True,
"anti-kick" : True,
"anti-channel-create" : True,
"anti-channel-delete" : True,
"anti-role-create" : True,
"anti-role-delete" : True
},
"whitelisted" : [
server.owner.id
],
"banlist" : [
],
"welcome": {
"channel" : None,
"message" : None,
"enabled" : False
}
}
)
it wont insert data into database and just crashes bot
@supple thorn
Yes
Y u not help
Not true actually
can i get help?
Sry i dont know anything abt databases
No i only tried using it cuz ik that it works
Or at least it used to
Im trying to make it so that my bot can join a vc
And then play lofi music
Or at least atm
AttributeError: 'Embed' object has no attribute '_files'
Help please is happening with all embeds i make
Code
@supple thorn what can i do
For help
dms
Y
Why
like with all embeds i make is that error idk why
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
Yeah but why in dms
@supple thorn
plz help what can i do for help
do u need proof that it isnt meant for spamming
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
agmar 
Can u show the code
did you do @commands.listener() instead of @commands.Cog.listener()
i think that was it
πΏ
ye ik
you can see from the code that your listener are different
i got friend that wants it
why
idk
but the thing is
imma make it block words like and
and see how long it takes for them to figure out
which words they are not allowed to say lmao
@commands.has_permissions()
OH YEAH
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.
Note that this check operates on the current channel permissions, not the guild wide permissions.
The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").
This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
not a problem
@slate swan https://paste.pythondiscord.com/hiveyadece do you have any ideas on why everything works until the point when i try and use a command?
This is a simpler version
And the bottom section is a different file named test.py
i need more context
Basically
I run it and everything loads and says that it is online
But when i do !test or smth
Or use any cmd
Nothing happens
No error nothing printed
Nothing
do you have 2 on message events?
I've this code right here:
await ctx.guild.create_text_channel("ticket-" + str(ctx.author.id))
``` how do I set the category to the category named βticketsβ
im not sure im probably missing something ive just burned myself up today sorry
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a βsecretβ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
the category kwarg
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
yes
and this one is the main.py
It didn't change the channel
Itβd probably be just I mis spelled it
Nope, still not workkng
I've this code right here:
await ctx.guild.create_text_channel("ticket-" + str(ctx.author.id), Category="Tickets")
``` how do I set the category to the category named βticketsβ
the kwarg is lowercase
What does that mean?
Category should be lower case
?
@slate swan I get this error now
can you try to copy-paste the code here?
Yes
await ctx.guild.create_text_channel("ticket-" + str(ctx.author.id), category="Tickets")
@slate swan await ctx.guild.create_text_channel("ticket-" + str(ctx.author.id), category="Tickets")
hmm
which line
Line 94
But it didn't happen until I lowercased the category text tho
Which is weord
Ooh maybe it's the category id
use await ctx.message.delete() not await ctx.delete("z/help")
Nope, still gets the error
i need to see the full tb
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
just send the full tb like so^
Kk
async def Ticket(ctx):
Info = {"Cmd": "TicketMessage", "User": ctx.author.id}
LogCMD("Misc/CommandLogs.json", Info)
#embed=discord.Embed(title="**Tickets**", description="React to this message to create a ticket!", color=0x00ff00)
#await ctx.send(embed=embed)
embed=discord.Embed(title="**Tickets**", description="Ticket created!", color=0x00ff00)
await ctx.send(embed=embed)
await ctx.guild.create_text_channel("ticket-" + str(ctx.author.id), category=944715919945498684)```
traceback.
@frigid pendant why do you still use pass_context
i ment tb
sawsha can you take over im about to have a mental breakdown rn thank you
Yeah sure
@frigid pendant send the traceback
Wdym? What's that
They dont.
it's a old ass dpy method thats not longer used.
Send, the, traceback.
class admin(commands.Cog):
def __init__(self, bot):
self.client = bot
@commands.command()
@commands.has_permissions(administrator=True)
async def load(self, ctx, *, extension):
bot.load_extension(f"cogs.{extension}")
await ctx.send("Loaded cog!")
@commands.command()
@commands.has_permissions(administrator=True)
async def reload(self, ctx, *, extension):
bot.reload_extension("cogs."+extension)
await ctx.send("Reloaded cog!")
@commands.command()
@commands.has_permissions(administrator=True)
async def unload(self, ctx, *, extension):
bot.unload_extension("cogs."+extension)
await ctx.send("Unloaded cog!")
So when I try to run this
most of your commands has pass_context
it says bot or client isnt defined, and ive tried both
There's the error
its self.bot
do you know cogs?
self.client is supposed to be self.bot
AH ok
it's supposed to be connected to the param you added in the init
ok
oi how can i make it so that the token is a variable but is stored in another file in pycharm
also what happens if you unload the admin cog
how would you load the admin cog
So how would I fix that?
without it
just do _load admin
just make a new file, put "token = "whatever the fuck your token is", and then import it.
such as
from config import token
assuming it's called config.py
they aint talking to you
it's a problem with this line.
no that didnt work
show your full cog
also change your bot to self.bot
in your actual commands
you're doing bot
from nextcord.ext import commands
import nextcord
class admin(commands.Cog):
def __init__(self, bot):
self.client = bot
@commands.command()
@commands.has_permissions(administrator=True)
async def load(self, ctx, *, extension):
bot.load_extension(f"cogs.{extension}")
await ctx.send("Loaded cog!")
@commands.command()
@commands.has_permissions(administrator=True)
async def reload(self, ctx, *, extension):
bot.reload_extension("cogs."+extension)
await ctx.send("Reloaded cog!")
@commands.command()
@commands.has_permissions(administrator=True)
async def unload(self, ctx, *, extension):
bot.unload_extension("cogs."+extension)
await ctx.send("Unloaded cog!")
def setup(bot):
bot.add_cog(admin(bot))
yeah
change everything thats just "bot" to 'self.bot"
except for the thing in the init part
ok
and in the def setup
yeah
Ok that, it just appeared after I added the category thing
ok fixed!
thanks so much you 2!
then remove catagory, i dont think thats a viable kwarg.

Then how would I change the category
i dont know.
look at the docs for guild, im not sure if thats a kwarg for create_text_channel
or atleast, ive never used it to send it to a catagory.
guys, is there any way to call client.loop.create_task(function).start_process()) this like this client.loop.create_task(function).start_process)
data = await self.db.find_one({"guild" : server.id})
AttributeError: 'vora' object has no attribute 'db'
ξΊ§
idk how to fix the error
it's a method i think, so no? (dont quote me on that)
show your code.
for server in self.client.guilds:
data = await self.db.find_one({"guild" : server.id})
if data == None:
await self.db.insert_one(
{
"guild" : server.id,
"ownerid" : server.owner.id,
"prefix" : ".",
"logging-channel" : None,
"punishment" : "ban",
"system" : {
"nassban" : True,
"mssskick" : True,
"mass-channel-create" : True,
"mass-channel-delete" : True,
"mass-role-create" : True,
"msas-role-delete" : True,
"mess-webhook-create" : True
},
"whitelisted" : [
server.owner.id
],
"banlist" : [
],
"welcoming": {
"welcome-channel" : None,
"welcome-message" : None,
"enabled" : False
}
}
)
there you go
uhhh
if start_process is a method, it must be called with parenthesis. otherwise you are showing that you are trying to access a property/attribute
im using mongodb btw
Thanks for confirming it's a method, i had no idea if it was or not.
im not sure whats causing the error unfortunatly.
Hmmm, is there any other way to process async functions in background?
i didn't say it was a method. i was just saying IF it is, you have to include the parenthesis to indicate you are calling it
I've never heard of start_process() before tbh
Ah, i ready it wrong then π
it's is method
So, yes, then thats the only way to call it since it's a method.
#async-and-concurrency might be better than this channel
Yeah, probably
Alright bruh, thanks a lot
np
no thats not how you do it lol
okimii knows better than me π
client.loop.create_task(coroutine())
Imo using tasks is cleaner no?
hello
i mean ig
okimii im back and i need help
why meeee im about to have a mental breakdown
You do know he can't help u without yr code and problem right?
why whats wrong
why
lmfao 
been doing homework for 15 hours already
damn
well you know the embed cmd i was making
does anyone know how to make a role list command ?
footer = my_json['footer']['url']
image = my_json['embed']['image']
idk how to make these work
footer = my_json['footer']['url']
image = my_json['embed']['image']
!d discord.Guild.roles
property roles: List[discord.role.Role]```
Returns a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of the guildβs roles in hierarchy order.
The first element of this list will be the lowest role in the hierarchy.
you used embed to dict?
send docs
for me
Sure, not difficult. Can be done in 4 or 5 lines if you're smart about it
no im asking what are you trying to do lol
im pretty new to coding lmfao
ill show you
Ah, might be tricky then
make it one
https://kill.watch/image||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||https://watch.0-o.host/ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
reminded me of this
this
embed = discord.Embed(...)
embed.description = ", ".join(str(x) for x in role.members)
await ctx.send(embed=embed)
ig
Facts
more like trying to make a embed with the json response body
i want that to be a tag now
sorry i worded that horribly
Not possible
its oki
yeah
you checked the embed payload right?
whats that
probably yes to make the command correct/accurate right?
ig
ye
its just nested dicts
the embed key has a dict so just index the key and index the dict lol
oh oki
what do i do tho
!e
print({"key0": {"key1": "value1"}}["key0"]["key1"]
)
i.e
@slate swan :white_check_mark: Your eval job has completed with return code 0.
value1
but imtrying to make it send a embed
but it wont work bc i dont have the auther or thumbnail or image or footer thing
well you index the dict and set it to the kwargs?
you do
wanna see my code
https://kill.watch/image||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||https://watch.0-o.host/ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
what about it
it wont work
wanna see error
yes
https://kill.watch/image||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||||β||https://watch.0-o.host/ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
doesnt that happen when extra data is given i.e something that isnt json?
yeah
bro im tried i gtg
Depends on which member you plan to get the avatar url of
What happens if you ping multiple users?
So it should only show it if you ping one specific user?
if len(message.mentions) == 1:
url = message.mentions[0].avatar_url
It's not that bad
Try to see if you can weave that in yourself
This one doesn't work with IDs
Why do we need IDs?
How can I show the first 4 digits of a float?
!avatar 432643355634171905
OH WAIT i'm dumb
i thought you wanted to send a regular message pinging someone and that would show their avatar
If the message doesn't have 1 mention url gets assigned
Oh then you're on the right track
!e
my_var = None
if my_var is not None:
my_other_var = "Hello"
print(my_other_var)
@final iron :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | NameError: name 'my_other_var' is not defined
just do
@client.command()
async def avatar(ctx, member : discord.Member = None):
member = member or ctx.author
instead of
@client.command()
async def avatar(ctx, member : discord.Member = None):
if member == None:
member = ctx.author
not a variable lol
π
you cant print it as the variable is assigned on a condition
so by default its undefined
That's the point
youll need to print it inside the if statement lol
Again, that's the point
youre trying to show an error you mean?
Yes
your existence is questionable 
πΏ
about to get banned no jk π
why check mentions?
just set the url with member as it will always be a member obj
the variable is set to the member param or the author
if the member param isnt given the author takes over the value
hence member always being a member obj
just set the url to the variable that has the value of the member param or the author
which will always have the value of a member obj
member = member or ctx.author
member.avatar_url
youre using the method on the member variable which has the value of the params or the author
i mean you can but iirc User only takes a snowflake and not a mention
the id
every user has a unique id like a snowflake
i would recommend using mentions as the Member obj is the subclass of User so it takes mentions and ids
no no
a member obj accepts mentions and ids as the format of mentions is <@id> so it would parse them
Consider learning python properly first before using d.py. Discord.py is an advanced library and is not meant to be used by beginners.
np
well just don't annoy anyone 
def __init__(self,label):
super().__init__(label=label,style=discord.ButtonStyle.red)```
^ this will subclass a button and u dont have to write down the style right? like just `b = RedButton("hey")`
i was wondering how to change ```await ctx.send('hello')``` to `await ctx.post('hello')` using the same way, changing send to post
huh? post isnt a method iirc
you can add a colour parameter to the dunder init

Don't crosspost
jusr be patient on the other server 
async def on_message(message):
bw = ['discord.gg/','https://discord.com/invite']
for word in bw:
if word in message.content:
await message.delete()
await message.channel.send(f'{message.author.mention} sent a discord server advertisement which has just been deleted')
await bot.process_commands(message)```
i put bot.process_commands but why other commands not working
indentation
use listen lol
so you save a line
and the uwu for loop does its own justice
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)").
Example...
looks cool
!ot 
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
Β―_(γ)_/Β―
smh
π
someone ask a question 
where do babies come from
your mom didnt tell you?
import motor.motor_asyncio as mongodb
why does this just kill my whole bot
And variables should be in snake_case
Stop doing it then
No it's not
It's wrong
Nope
Literally should never be used in python
If you want to write bad code, be my guest
Nope. I'll say it again, if you want to write bad code and kill your possibility of working on a team, be my guest
That's your choice
And that's a problem
ClassNames.
That's PascalCase
Hi, all!
I'm trying to create a discord bot that can post coding questions on a discord server once every week.
The questions are in the image format, and I want to deploy the bot on Heroku.
But I was wondering, every time the server goes down, my program/bot will be starting all over again and it would send questions starting from the same sequence.
Does anyone know any ways to avoid this using Python's built-in function or any discord.py's funtions? So that whenever the bot starts again, it would not send the questions that are already sent?
I always knew it as UpperCamelCase
CamalCase ever read pep8 officer
Never said it wasn't?
It's just called PascalCase in python
who said it was
guess you havent read pep8
Have you?
looked it up, UpperCamelCase and PascalCase are the SameThing
do i have to answer the question officer
!pep8
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
More information:
β’ PEP 8 document
β’ Our PEP 8 song! :notes:
Rip bozo
It's referred to CapWords in the documentation
Everyone calls it PascalCase though
smh look at the first screenshot
There are also multiple variations of camelCase
"CapWords (or CamelCase)"
Read what I just said
There are multiple variations
CamelCase, PascalCase and CapWords are all the same thing
camelCase is something completely different
It doesn't matter as PascalCase is the same as CapWords
It's just semantics
What you're doing is a variation of CamelCase
CamelCase should be used for class names while camelCase shouldn't be used in python
Tbh I'll stop refering to them as camelCase and CamelCase as it causes too much confusion
CapWords and mixedCase are more appropriate
I'm going to sleep now

good night 
just synonyms
Yes but it's much easier to understand the difference between those and CamelCase/camelCase
Okay I'm actually going to sleep now
meh depends
for role in ctx.author.roles:
if role.id in roleList:
verified = True
print(f"yes - {role.id}")
else:
print(f"no - {role.id}")
when i run this, even when i have one of the roles it prints no. ive double checked that the ids in roleList are correct
well, it seems fine
theyre probably stored as a str
or just remove the quotes lol
def __init__(self,label):
super().__init__(label=label,style=discord.ButtonStyle.red)```
^ this will subclass a button and u dont have to write down the style right? like just `b = RedButton("hey")`
i was wondering how to change ```await ctx.send('hello')``` to `await ctx.post('hello')` using the same way, changing send to post
.post reminds me of .say
gave you the answer earlier, but alright
i forgor
it isnt a thing...? 
@frank tartan pinged
π
Oh yeah, I never thought of that
Lmao
help pls
sad list comprehension noises

.say was a thing lol
.post 
name changed?
ctx.send to ctx.post
post isnt a thing, tbh, what even is your question?
im trying to rename send to post myself, how do i make a definition that ctx.send will mean ctx.post and use ctx.post?
mess with the internals
yeah unless you mess with internals you cant do that but why would you even want to change ctx.send to ctx.post
not like messing with discord.py, im rename with variable and class thing
do u know how to do that
you cant do that, internals are the only way
lol my friend showed me his code worked but he didnt show me how he did it
just go to the Context class and rename it
no because i have no reason to
yes i tried a lot with class and it didnt work
its easy
how
im not even sure why tho
today's kids smh
renaming a method isnt quite "cool"
you just dont know how ._.
im doing it for something else
why tho
I do
just change the internals, thats all, though it isnt recommended
theres a way to subclass too, u didnt know that
its a class method how hard could it be
yes, I didnt, what now

but you need to merge it every update 
if you dk how to find and replace recursively in a directory, here: https://stackoverflow.com/questions/1583219/how-can-i-do-a-recursive-find-replace-of-a-string-with-awk-or-sed this might help
ok
since youre subclassing just call the method inside it
use the check kwarg
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting botβs messages...
nah something like
check=lambda message: message.author.id == member_instance.id
if youre going for a one liner
in the check kwarg in the params of the purge method
no
in the method thats bound to a class instance of TextChannel
^ so this in the params of the method
that should be member instance in params
nah nah nvm youre trying to delete msgs of the author?
as shown here?
then it would be ctx.author.id
replace member_instance.id with ctx.author.id
nah in params remove it
yep

Youre welcome
Np
Simple fix. I am coding cogs ( discord.py ) trying to run all of them in main.py. The "whois" command works fine by itself in a file. But when I run main.py ( with the utilities cog which contains whois command ) it doesn't run at all, but there is no errors. It also say in the output that the command successfully ran.
If anyone has any suggestions, let me know
Code
its running
and its still in like 50 or so servers
i just dont update it often - where is the link broken?

kk
from curses.panel import bottom_panel
from distutils import command
import discord
import os
from discord.ext import commands,tasks
from discord.ext.commands import has_permissions, CheckFailure
bot = commands.Bot(command_prefix='avery ', case_insensitive=True, help_command=None)
bot.remove_command('help')
extensions = ['cogs.ModerationCog', 'cogs.CommandEvents', 'cogs.HelpCommandCog', 'cogs.UtilitiesCog']
if __name__ == '__main__':
for ext in extensions:
bot.load_extension(ext)```
Lmfao
@spring sapphire accept my pr
Mans grabbed the thanks and ran
from typing_extensions import Self
import discord
from cgitb import text
from discord.ext import commands, tasks
from curses.panel import bottom_panel
from distutils import command
import os
class UtilitiesCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=["whois"])
async def userinfo(ctx, member: discord.Member= None):
if not member: # if member is no mentioned
member = ctx.message.author # set member as the author
roles = [role for role in member.roles[1:]]
em = discord.Embed(
colour=discord.Colour.green(),
timestamp=ctx.message.created_at,
title=f"User Info - {member}")
em.set_thumbnail(
url=member.avatar_url)
em.set_footer(
text=f"Requested by {ctx.author}")
em.add_field(
name="ID:",
value=member.id,
inline=False)
em.add_field(
name="Display Name:",
value=member.display_name,
inline=False)
em.add_field(
name="Created Account On:",
value=f"<t:{int(member.created_at.timestamp())}:F>",
inline=False)
em.add_field(
name="Joined Server On:",
value=f"<t:{int(member.joined_at.timestamp())}:F>",
inline=False)
em.add_field(
name="Roles:",
value="".join([role.mention for role in roles]),
inline=False)
em.add_field(
name="Highest Role:",
value=member.top_role.mention,
inline=False)
await ctx.send(embed=em)
@commands.Cog.listener()
async def on_ready(self):
print("Utilities is online!")
def setup(bot):
bot.add_cog(UtilitiesCog(bot))```
sent cog code and main py code
fr
Im guessing thats in the cog and its just because im on mobile that it looks wonky
youre missing self
ahh yes I am
tysm that was so silly sorry!

i dont know js
It has a global object or smth by the name this. You can attach anything to it, like this.that = "that" and so on
Guys can someone send me the class of Message
i only know ruby and python i want to learn C++ ngl
!d discord.Message
class discord.Message```
Represents a message from Discord.
x == y Checks if two messages are equal.
x != y Checks if two messages are not equal.
hash(x) Returns the messageβs hash.
I didn't really dug deep into JS, but from what I learnt, that's how things are done
i want to learn c++ or rust maybe cpp
Waiting for someone to run the ot command, but yea, best of luck messing with those colons 

dig*
hey guys anyway for the bot to get the messages that were typed once the bot was offline once it is edited?
S. M. H.
no
discord only dispatches partial message info for those so the lib uses cached messages
I mean once the old messages are edited, they trigger the on_raw_message_edit but it does not give the cached_message
!d discord.on_raw_message_edit
discord.on_raw_message_edit(payload)```
Called when a message is edited. Unlike [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), this is called regardless of the state of the internal message cache.
If the message is found in the message cache, it can be accessed via [`RawMessageUpdateEvent.cached_message`](https://discordpy.readthedocs.io/en/master/api.html#discord.RawMessageUpdateEvent.cached_message "discord.RawMessageUpdateEvent.cached_message"). The cached message represents the message before it has been edited. For example, if the content of a message is modified and triggers the [`on_raw_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_edit "discord.on_raw_message_edit") coroutine, the [`RawMessageUpdateEvent.cached_message`](https://discordpy.readthedocs.io/en/master/api.html#discord.RawMessageUpdateEvent.cached_message "discord.RawMessageUpdateEvent.cached_message") will return a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") object that represents the message before the content was modified.
Due to the inherently raw nature of this event, the data parameter coincides with the raw data given by the [gateway](https://discord.com/developers/docs/topics/gateway#message-update).
you can fetch the message from the message id if you want
Will that give old message, or the new message
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
remove_command
One message removed from a suspended account.
do not hard code your help command, in your commands.Bot set help_command to None
that does the same thing
hard coding is bad
@manic wing
cog_help_strings = {}
@AstroBot.event
async def on_ready():
print(f"{AstroBot.user} ready for takeoff!")
for cog in AstroBot.cogs: # Load the cog names as the "key" and their help strings as the "value"
cog_help_strings[cog.lower()] = AstroBot.cogs[cog].help_string
@AstroBot.slash_command(name="help", description="Show a help menu for a command.", guild_ids=get_guilds())
async def help(ctx, command: Option(str, choices=[
OptionChoice(name=command_name.title(), value=command_name.lower()) for command_name in cog_help_strings.keys()
])):
help_embed = Embed(title=f"Help Menu For {command}", description=cog_help_strings[command])
await ctx.respond(embed=help_embed, ephemeral=True)
of I run a print statement inside the for cog in AstroBot.cogs, the keys are shown
But commands are not being created with the keys inside of the slash_command Option
I guess it has something to do with how they're executed?
Slash commands first then everything else?
ive been doing this
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
try:
bot.load_extension(f"cogs.{filename[:-3]}")
print(f"Just loaded {filename}")
except Exception as e:
print(e)
This loads the cog yes but I'm trying to retrieve the loaded cogs along with their help_string attribute
ahh
go through all commands and get the help_string attribute then print it to console?
just import dont use the garbage cogs thingy
its easier for finding errors
the import also does
in fact you can do much much more on cogs
Easier said then done. You want me to write 500 import commands for 500 commands? AND hardcode their module.help_string attribute AAANNDDD their OptionChoice(name, value) parameters?
but the thing is that most of the people that are coding discord bot doesnt know anything about python in general thats the problem
no?
you got it wrong
That's why the dynamic approach
I think you aren't understanding what I'm trying to accomplish
im just a sucker for automation
looks like you havent tried to import something before lol
yeah seems like you're out of idea
@slow foghere's to clarify
uh
whats the problem? sorry
I have cogfiles for their associated commands
I'm creating a help menu for each commands
-> Each Option will be the name of the command
-> Their value will be used as keys to retrieve related help_string
So, I'm loading the cogs into the bot first. Then I'm retrieving the cog names, setting them as keys and their values as the cog's help_string attribute. This will give me a lookup table to be used when using the Option value from slash_command to fetch the help strings
also what lib are you using
PyCord
can someone help dpy is not working
currently, the slash_command works but it doesn't show me any options to select from; but if I give a valid key, it can retrieve the associated help_string. So I'm confident there's a problem with parsing the keys() from the cog_help_string dict. Which I think might be the order of execution since printing the keys from on_ready works fine
error?
well personally i've never used slash commands, but you can just get rid of all that on_ready and cog_help_string stuff and perhaps just do ```py
command: Option(str, choices=[
OptionChoice(name=cog, value=bot.cogs[cog].help_string) for cog in bot.cogs
]
)
got banned from a discordgo server for sending this
bruh
lol
Lemme looks more logical
no
im trying to clone rapptz git repo
but then all the imports work
but commands dont work
you have to run the setup.py file first
what is that
a python file
okay what do i put in that
mecha?
@manic wing@twilit furnace
OptionChoice(name=command_name.title(), value=command_name.lower()) for command_name in cog_help_strings.keys()
[returns] <generator object help.<locals>.<genexpr> at 0x7fae989ea340>
found the issue
One message removed from a suspended account.
oh right stick a [] around that
fields with empty values are not rendered
just gonna do list() lol
One message removed from a suspended account.
you're sending the Embed before adding the fields. move the await ctx.send(embed=emb) after all the emb.add_field method
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
you mean?
One message removed from a suspended account.
.bat is?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
it shouldn't be closing instantly
One message removed from a suspended account.
why cant i copy my Token?
for i in bot.commands():
usage = f"To use {i.name}, use `{p}{i.name}`!"
emb.add_field(name=i.name, value=usage
maybe? @plain perch
try to reload?
its the same
How do i get the token for my bot?
Your bot token is no longer visible on the developer dashboard, the only way to get it is by clicking the regenerate button to invalidate the old one and make a new one. This will require 2FA and the token is only shown until you leave the page. Make sure to store is safely!
How do i update the username/avatar for my bot?
You can no longer do this from the developer portal directly for now due to a bug. It will be fixed soon. If you do not want to wait for this bugfix this is how you can update the username/avatar for your bot manually. Keep in mind verified bots can not change their username, only avatar.
Most libraries have build-in methods to do this however, see their docs for more info.
Alternatively you can do this manually by using a rest client like postman or insomnia to do a PATCH call to the "modify current user" endpoint (https://discord.com/developers/docs/resources/user#modify-current-user) with a new username and/or avatar for the bot. Don't forget to set the correct authorization header (https://discord.com/developers/docs/reference#authentication-example-bot-token-authorization-header)
- DDevelopers server
ty
π
Lol I thought the token not being shown was also a bug
okay why is it that I can load cogs outside of an async function, but cannot access the Bot's attributes outside it?
bot.cogs.keys() does not work outside but does anywhere inside an async function
bot.cogs returns a list of commands.Cog objects
the problem is far more complicated than I can explain unfortunately
disnake
*a mapping
the cogs might have not been loaded yet
I want to destroy a server through bot and I am not admin of the server...
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
it seems like the order of execution is altered in some cases for python. for example, if I have
__name__ == '__main__'
async def
then first the name part is executed, then the file as a whole without the async functions, and then the async functions are run. this explains why I can access the Bot.cogs from an async function as otherwise it would have not been loaded.
that also means I can't access certain bot attributes inside of @slash_command decorators
One message removed from a suspended account.
all I had to do was read the .py filenames from the command directory and add them to a list. Then make OptionChoice with them and retrieve the cogs[name].help_string
strange errors
what do you mean?
probably inconsistent number of spaces and tabs
no mention error....elaborate
oh, I see
maybe add a default value of None to the member parameter and check if it is None, or add a separate error handler for your command
!d discord.ext.commands.Command.error
@error```
A decorator that registers a coroutine as a local error handler.
A local error handler is an [`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") event limited to a single command. However, the [`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") is still invoked afterwards as the catch-all.
????
....?
@command()
async def kick(ctx, member: discord.Member=None, reason="No reason provided"):
if not member:
return await ctx.send("no member mentioned")
#check perms whatever uhhh
await member.kick(reason=reason)
yeah
it's
no, put the default value of member as None
how ? π
def foo(member: discord.Member=None)```
just add an equals to None
def foo(member: discord.Member=None, *)
@bot.command()
async def kick(ctx, member: discord.Member=None, *, reason=None):
#do your stuff
is what you want
and check if the member is None, before the reason
if the member is None, the reason will always be invalid
I dont accept random friend reqs
just send me
rejected π
@slate swan oh nice you were born 4 days before me albeit I was in 2005
Aquarius gang 
async def suggest(self, ctx, *, message):
embed = discord.Embed(description = f"{message}", color=0x3abbff)
channel = client.get_channel(949459007012237322)
msg = await channel.send(embed=embed)
await msg.add_reaction('')
await msg.add_reaction('')```
Traceback (most recent call last):
File "/home/runner/xan-bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/xan-bot/cog/suggest.py", line 20, in suggest
msg = await client.get_channel(949459007012237322).send(embed=embed)
AttributeError: 'NoneType' object has no attribute 'send'
How is client defined?
ITS NOT THE CLITEN PROMSITDHOF
client = commands.Bot(
command_prefix='.',
intents = discord.Intents.all()
)
If you're in a cog you don't need to define your commands.Bot variable
No you should not do that in cogs
from discord.ext import commands
client = commands.Bot(
command_prefix='.',
intents = discord.Intents.all()
)
class suggest(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def suggest(self, ctx, *, message):
embed = discord.Embed(description = f"{message}", color=0x3abbff)
channel = client.get_channel(949459007012237322)
msg = await channel.send(embed=embed)
await msg.add_reaction('')
await msg.add_reaction('')
def setup(client):
client.add_cog(suggest(client))```
hey stop spamming mate
its fine i do it to all my other cogs and it woks
ctx.guild.fetch_channel?
NO that dont work
Remove that client defination, and use self.client.get_channel
@sonic gale whatchu trynna do
can't you just use ctx.bot?
@slate swan when you type .suggest (my suggestions) it will send to the #suggestion channel
is it a personal server?
That's the best way, but idky People don't prefer that
yes
yea i used that because i had my own commands.Bot subclass
u did not
start reading messages
thats not gonna fix it
People hate best ways π
uh? Did you even try that?
π€‘ agreed
fetch_channel or get_channel?
File "/home/runner/xan-bot/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/xan-bot/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/xan-bot/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: AttributeError: 'NoneType' object has no attribute 'send'```
get @dusky pine
most likely that channel does not exist
The Channel ID
!d discord.Guild.get_channel
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
it can't find the channel
They redefined the client in the cog and are using it's. get_channel method
^^^
@commands.command()
async def suggest(self, ctx, *, message):
embed = discord.Embed(description = f"{message}", color=0x3abbff)
channel = ctx.guild.get_channel(949459007012237322)
if channel is None:
return await ctx.reply("Unable to find the suggestions channel.")
msg = await channel.send(embed=embed)
await msg.add_reaction(':poll_Y:')
await msg.add_reaction(':poll_X:')
```?
is get_channel async
get_channel is not an awaitable
fixed
i think i know what hap
lessgoo
you cant use client cause its in a cog, before i did it wihout cogs
that was awhile ago
exacly
thanks mane, it worked
One message removed from a suspended account.
One message removed from a suspended account.
or 0x00ff00
mhm
One message removed from a suspended account.
then use the discord.Colour class
orrrr this would be easier with a slash command and auto complete
[x for x in dir(discord.Color) if not x.startswith("_")]

when u gonna stop ghost pinging Ash π
Never ||say never π||
Good thing it is not a rick roll, half the people would have gotten mad here
they're old π
True but people still get pissed for some reason
just do color=discord.Color(arg) in the embed constructor
Oh ryan
Help me bruh
Need it soo badly
https://youtu.be/APY66hYarAc
In this video I made 500+ people perform a reaction speed test in Discord, where the first place of each round would receive a prize of Discord Nitro accompanied by a special role in my server!
Thanks for watching the video!
------------LINKS BELOW------------
β© JOIN MY DISCORD SERVER β©
https://discord.gg/Sound
β© WATCH ANOTHER VIDEO β©
https...
Still not made it? π
Lol
Till where have u completed it?
π "just give me code", right?
Didnt even start
Oh well, do u know about the modules u will need to start with the same?

sure
I can help u make one rn, I got some time
I did the basic code
Mind showing?
Sure
nice
I'm going to shit on my website till that time
I ain't good at spoonfeeding
I mean, Its a simple command
i lov dpy maybe i can halp
can i make kick_all & ban_all command in discord.py ?
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
@bot.slash_command(...)
async def firstreact(inter):
await inter.response.defer()
reac, user = await bot.wait_for("reaction", check=lambda r, u: r.msg.id == inter.message_id)
await inter.followup.send(f"{user} won!")
hastebin exists π
Just write all the code at once π
it's just 5 lines
i don't need for illegal purpose
well, banning all isnt a legit thing
@maiden fable
basic code 
And yea, @slate swan most people prefer FastAPI instead of Flask nowadays
fastapi is for apis tho
well I gave u the partial pseudocode/code above
I just asked if I could
She doesn't care about frontend anyways
wtf
yea u can but best of luck preventing ratelimits
uh fastapi is for backend
read my message again π
but flask fits my purpose for now, might consider fastapi later
that means she cares about backend?



