#discord-bots
1 messages Β· Page 1018 of 1
tru
these files are allowed
okimii help pwease
Cuz ppl usually send offensive mp3/4
not everyone
it's fine
on_ready is an event where it triggers when the bot is ready to run
!resources i recommend you get to learn python first and then oop as discord.py and its forks are advanced libraries
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
a function that gets triggered when the clients cache has been populated and is ready*
yes
welp, time to spend 5-10 hours of my life I'll never get back... see ya on the other side boys
more like 5-7 months
ποΈποΈ
I learned python a while back, just forgot it cause of a lot of java coding
have you worked with object oriented programming?
java is one of the most extreme cases of a completely object oriented programming language ποΈ π ποΈ
ah i didnt know, then it will be a bit easier all you have to learn is syntax and async programming and a bit of other stuff!
welp I shall do my best, thanks for all the help, and if I manage to keep the motivation for this I will update you when I get it 
i belive in you!
Yes
i like c# more than java XD
How to add emote reaction to a bot?
Like I have a bot which when a user sends hello , it reacts to the MSG by an emoji π
Are you sure you are not bully Maguire ?
await message.add_reaction("π")
yes
with the context object!
await ctx.message.add_reaction("π")
is the right one for his situation
What if on message event
What if the emote is in only in my server
check the guild id
!d discord.ext.commands.Context.guild
Returns the guild associated with this contextβs command. None if not available.
The guildβs ID.
Ok
Like this one
get_emoji(id, /)```
Returns an emoji with the given ID.
Changed in version 2.0: `id` parameter is now positional-only.
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...
Or just use a str representation of the custom emoji
you can aswell yeah
name:id iirc
What can be used to identify users across chats, user_id is constant right ?
yes user ids are unique hence why they are called snoflakes
Alr thnx
Why snowflakes
because snowflakes are always unique
Ohh
you never see identical snowflakes
if you get snow at a time of the year go outside and see the snowflakes and youll see how none of them are the same
FINALLY
How can i get a single channel from the list of channels
its just a list of objects?
list_of_channels[index]
you would index them or just use iteration
?
fixed the seg fault
the what
segmentation fault
how can i get total members of a guild ?
mhm ic
!d discord.Guild.member_count
property member_count```
Returns the member count if available.
Warning
Due to a Discord limitation, in order for this attribute to remain up-to-date and
accurate, it requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be specified...
Did you get python to segfault lmao
how to use a animated in embed ?
when i type <:name:id> it dosent work
nah cpp, i had to write that code in python then translate it again to fix it, sux
Ok I was about to say how did you manage to segfault in python
i think i have seen seg faults in python
But could be achieved via ctypes bullshittery
from ctypes, yeah
Pointers are scary π³
^
ok
delete_after
just search that on Google that's it
nope
ohh
then
do u want the users message to be deleted?
or the bots cooldwon message
alr
ohh
hmm
giv a min
rn does this error handler work
show the whole event
and the embed
yes
just a line above
umm
commands.Cog.listen?
ukw
update, I got my bot to call my friend short
I consider this a huge success
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.
dammm that is truly a sucess
i made it so that whenever someone mentions my name it reacts with skull
await ctx.message.delete()
is it possible to get the bot count and human count of a guild?
ig it's checking whether the use is a bot
user*
how can i do that?
ugh
or maybe a doc?
nvm
I'll send u the docs
!d discord.User.bot
Specifies if the user is a bot account.
......
i dont want to check if the user is bot
ig now u shud use for loop to check it
i want the count of bot and humans
yes
i understand
what I'm saying is
membercount gives both bots and members
and there isn't a doc for seperating to my knowledge
You need to filter out bot.users then call len
yes
!d filter or you can also use sum
filter(function, iterable)```
Construct an iterator from those elements of *iterable* for which *function* returns true. *iterable* may be either a sequence, a container which supports iteration, or an iterator. If *function* is `None`, the identity function is assumed, that is, all elements of *iterable* that are false are removed.
Note that `filter(function, iterable)` is equivalent to the generator expression `(item for item in iterable if function(item))` if function is not `None` and `(item for item in iterable if item)` if function is `None`.
See [`itertools.filterfalse()`](https://docs.python.org/3/library/itertools.html#itertools.filterfalse "itertools.filterfalse") for the complementary function that returns elements of *iterable* for which *function* returns false.
Anyway I can find the list of reactions in a particular msg?
Like for this msg , it prints "reactions -> (now here dustbin emote)"
true win
Any help sir?
!d discord.Message.reactions
Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
Umm, even though my extension was loaded my bot says cannot find command.
Why is that?
is it possible to get count of users who have admin perms? in a guild
if ctx.message.channel == discord.channel.DMChannel wonβt work. Use if not ctx.guild or if isinstance(ctx.channel, discord.DMChannel)
any help?
!d discord.Member.guild_permissions
property guild_permissions```
Returns the memberβs guild permissions.
This only takes into consideration the guild permissions
and not most of the implied permissions or any of the
channel permission overwrites. For 100% accurate permission
calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for")...
can a bot generate guild invite from which the user left with uses = unlimited expires after = unlimited
A bot can make a invite from a guild so maybe?
Try it and see
Can't guarantee cause i don't experiment that much anymore
What would even be the purpose of the invite
Can you please tell me how to display all warnings?
You send the message during every iteration, you probably just want to send it at the end. So you might want something like
embed = discord.Embed(...)
for x in y:
embed.add_field(...)
await inter.response...
embed.set_field_at(name='Creators', value=f'``Lucifer & Clone ``', inline=False)
Like this?
No that won't do anything
So sir?
my_string = "[My link](https://google.com)"
Can you write for me i am dumb π@slate swan
I literally wrote it above
Try to put what's in the "" above in your field value
Thanks you so much
My link?
That would be Derek_xD or Soul_xD in this example.
[Derek_xD](https://google.com)
Like this
Hmm
What is noob.com?
The URL
is to put a hyperlink, clicking on the blue text is like clicking on this: https://google.com
Hmm
So you can put, for example, your GitHub URL
Ohhh
But how put discord url?
Bro
Just copy paste the link
Hmm
Ok
Or for your user profile,
https://discord.com/users/922819802194673674
Thx
Wow cool
server_ids = [123, 345, 567, 789]
url = f"https://api.nitrado.net/services/{server_ids}/gameservers/games/players"
response = requests.get(url).json()
print(response)
When anyone gets second, can someone show me how to filter multiple the four {server_ids} through one URL.
Rather than making multiple different URLs.
um how do u remove that embed
Unless the api supports that it isn't possible really
If the api supports one id at a time you won't be able to add multiple
<url>
Got it, would that be the way to do it normally if it allowed it then?
I tried it that way, it didn't work lol
Thx
nah that won't work
The api needs a single id not a list of them
so you gotta choose an id rom the list then format it into the url and send the request
@slate swan
Ahh, alright.
Do you have any suggestions on how to compact it more?
I have 12 different server_ids I'd need to put through the URL
Nope. Only other solution is sending 12 individual api requests

So, like this?
server_id_1 = "123"
server_id_2 = "345"
url_1 = f"https://api.nitrado.net/services/{server_id_1}/gameservers/games/players"
url_2 = f"https://api.nitrado.net/services/{server_id_2}/gameservers/games/players"
response_1 = requests.get(url_1, headers=headers).json()
response_2 = requests.get(url_2, headers=headers).json()
print(response_1, response_2)
That looks painful to even look at
Idk if I did that right
Unless the api has an endpoint that allows you to put multiple ids like ?id=[1,2,3] etc then u gotta do them individual
Your indentation is not correct according to the other code.
No need to mark as spoiler by the way.
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
Make sure you read and apply these indentation levels correctly.
for id in ids:
url = f"https://api.nitrado.net/services/{id}/gameservers/games/players"
response = requests.get(url).json()
print(response)
time.sleep(some amount of seconds)
If the api has a cooldown (it most likely does) I'd suggest you add a time.sleep() between each get request
Would be {id} in that case
ri ri
Okay, let me try that π
I'm kinda new at this, just got the basics down
Considering it's for a bot - I would make the HTTP request asynchronous and use asyncio.sleep instead of time.sleep, so that you don't block your other things
https://discordpy.readthedocs.io/en/stable/faq.html#what-does-blocking-mean
https://discordpy.readthedocs.io/en/stable/faq.html#how-do-i-make-a-web-request
Doubt that's for a bot
Oh, it is. It's a large project
π then again
In that case it would not be the right channel.
A project I can't even get the foundation of
Then u gotta use async requests m8 mb
So, if I'm understanding it right
Just add a list above it ids = [1234, 12141, 1412341]
Right
I've never used a for-loop with a list before, that's why I was wondering 
How do I know which select option was selected? I'm subclassing discord.ui.Select and using it's callback
interaction.data
It saved me like 60 lines of code
The callback should accept the interaction as an argument and you can access the selected option from interaction.data
That's standard for the avg d.py fork
!d discord.ui.Select.callback
await callback(interaction)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
The callback associated with this UI item.
This can be overridden by subclasses.
!d discord.Interaction.data
The raw interaction data.
If you use it correctly yes but u gotta rmr that this is an api ur using
Don't get yourself banned
Now time to sleep adios
thanks!
Nighty night, I'll do my best. Lmao
pls send documentation
how can i get a channel like the current channel no need to mention it
Is there a function for "display_banner"?
wdym?
like im making a lock channel command...and i want to eliminate the need of mentioning the channel
when i run !lock the bot locks the channel in which this cmd was run
no need to mention a channel
Use ctx for that.
you can get the channel by using ctx.channel
If you don't know how, I can help you
yes pls
How to solve this?
await asyncio.sleep(amountOfSeconds)
await asyncio.sleep(60)
as he said
@commands.command()
@has_permissions(administrator=True)
async def lockdown(self, ctx):
role = 934391119041687593
overwrite = channel.overwrites_for(role)
overwrite.send_messages = True
this is my current code (not complete ofc)
i just need to eliminate the need of mentioning the channel
60 is good?
its 1 min
What are you trying to do?
hmm
and it depends on the cmd
await asyncio.sleep(10) correct?
yup
^^
@shell wing
@bot.command
@has_permissions(administrator=True)
async def lock(ctx):
role = 934391119041687593
channel = ctx.channel
ah cool
i want eval code anyone?
You can just use ctx.channel instead of channel. CTX is the CONTEXT. You can get every info of the command of of it.
ctx.author = the member who sent the command
ctx.message = the message of the command
ctx.channel = the channel of where the command sent
ctx.guild = the guild of where the command sent
You have to use ctx very often in those use cases. Especially when using commands like these
So I wanted to code a slash commands bot. And it kinda works. The bot only catches up the first two slash commands but idk why it doesnβt catch up the others although the code is nearly the same as command 1 and 2.
Can you show the code?
ye wait a sec
sure take ur time
getting this error while creating a sticker: Error while creating sticker: 400 Bad Request (error code: 50046): Invalid Asset
this is my code:
file = disnake.File('./temp_sticker_file')
try:
await inter.guild.create_sticker(name=sticker_name, emoji=sticker_emoji, file=file, description="test")
await inter.send("Created sticker.")
except Exception as e:
await inter.send(f"Error while creating sticker: {e}")
any idea what i am missing?
can confirm ./temp_sticker_file is valid
is it an image file?
yeah
if so add the extension at the end ./temp_sticker_file.png
hmmm
and if it is greater than the emoji size limit, like 250 kb or whatever, it won't work
so make sure it fits that
@quaint epoch Only 14 y/o! wow respect man
im actually 13, legally
my b day is on 28 oct, so it rounded it up
Oh I see
how to write number of people with status
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'Image' has no attribute 'open'
e.g. online
You mean the membercount of the guild?
Oh
are you using PIL.Image?
yea
!d PIL.Image.open
PIL.Image.open(fp, mode='r', formats=None)```
Opens and identifies the given image file.
This is a lazy operation; this function identifies the file, but
the file remains open and the actual image data is not read from
the file until you try to process the data (or call the
[`load()`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.load "PIL.Image.Image.load") method). See
[`new()`](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.new "PIL.Image.new"). See [File Handling in Pillow](https://pillow.readthedocs.io/en/stable/reference/open_files.html#file-handling).
yes
it, should work
Wait I had a piece of code for that one. It's kinda old tho, but should work
only I need the number of people with a certain status
ok
send the full traceback
specifically the line it occurs on
ok
Ignoring exception in command smash:
Traceback (most recent call last):
File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/runner/mv/cogs/image.py", line 186, in smash
smash = Image.open("Slap.jpg")
AttributeError: type object 'Image' has no attribute 'open'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/mv/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/mv/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: type object 'Image' has no attribute 'open'
@commands.command(name="smash")
@commands.cooldown(rate=1, per=3.0, type=commands.BucketType.user)
async def smash(self, ctx, user: Optional[Member]):
user1 = ctx.author
user2 = user if user else user1
smash = Image.open("Slap.jpg")
asset1 = user1.avatar_url_as(size=256)
asset2 = user2.avatar_url_as(size=256)
data1 = BytesIO(await asset1.read())
data2 = BytesIO(await asset2.read())
pfp1 = Image.open(data1)
pfp1 = pfp1.resize((200, 200))
smash.paste(pfp1, (600, 70))
smash.save("Slap.jpg")
pfp2 = Image.open(data2)
pfp2 = pfp2.resize((200, 200))
smash.paste(pfp2, (150, 58))
smash.save("Slap.jpg")
await ctx.send(file=discord.File("Slap.jpg"))
from discord import Client, Intents, Embed
from discord_slash import SlashCommand, SlashContext
bot = Client(intents=Intents.default())
slash = SlashCommand(bot)
@slash.slash(name="test")
async def test(ctx: SlashContext):
embed = Embed(title="Embed Test")
await ctx.send(embed=embed)
@slash.slash(name="test")
async def test(ctx: SlashContext):
embed2 = Embed(title="Embed Test")
await ctx.send(embed=embed2)
@slash.slash(name="test")
async def test(ctx: SlashContext):
embed2 = Embed(title="Embed Test")
await ctx.send(embed=embed2)
bot.run("discord_token")
So Iβm not on my pc rn. Cant show my code but itβs nearly like this
kek gimme a bit my parents need something
guild = bot.get_guild(IDHERE)
statuses = [
len(list(filter(lambda m: str(m.status) == "online", guild.members))), # Gives the membercount of users ONLINE
len(list(filter(lambda m: str(m.status) == "idle", guild.members))), # Gives the membercount of users IDLE
len(list(filter(lambda m: str(m.status) == "dnd", guild.members))), # Gives the membercount of users DO NOT DISTURB
len(list(filter(lambda m: str(m.status) == "offline", guild.members))) # Gives the membercount of users OFFLINE
]
Ignoring exception in on_message_delete
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 251, in on_message_delete
await sleep(60)
NameError: name 'sleep' is not defined
yhx
you can't name the commands the same
Ye ofc
await asyncio.sleep(60)
yw
oops
I just copy and pasted the first one. Commands are different in my code
hm okay..
Well.. I gotta see the original code to help you.
tell me if it worked, the code is kinda old so I wanted to know if it works
replace the file urls with "./Slap.jpg"
from asyncio import sleep
although i just import the module entirely, since there are a lot of attrs i use
!codeblock
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.
File "main.py", line 252, in on_message_delete
del snipe_message_author[message.channel.id]
KeyError: 970213202078085181
you can't name the functions and commands the same name
the key doesn't exist
try printing out the dict before doing that, then show it here
nope, none work
so old

its like 128k in size
hmmm
ποΈ
time to get some docs
its still the same
the error?
docs = love
!d disnake.Guild.create_sticker
await create_sticker(*, name, description=None, emoji, file, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Sticker`](https://docs.disnake.dev/en/latest/api.html#disnake.Sticker "disnake.Sticker") for the guild.
You must have [`manage_emojis_and_stickers`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_emojis_and_stickers "disnake.Permissions.manage_emojis_and_stickers") permission to do this.
New in version 2.0.
aha
same error
that's strange
@client.event
async def on_message_delete(message):
snipe_message_author[message.channel.id] = message.author
snipe_message_content[message.channel.id] = message.content
await asyncio.sleep(60)
del snipe_message_author[message.channel.id]
del snipe_message_content[message.channel.id]
``` correct?
π
yes correct
yea
won't work then
ohk
do import PIL
ty
then replace all your Image.open parts with PIL.Image.open
Ignoring exception in slash command 'stickersadd':
Traceback (most recent call last):
File "/home/gwl/.local/lib/python3.10/site-packages/disnake/ext/commands/slash_core.py", line 597, in invoke
await call_param_func(self.callback, inter, self.cog, **kwargs)
File "/home/gwl/.local/lib/python3.10/site-packages/disnake/ext/commands/params.py", line 778, in call_param_func
return await maybe_coroutine(safe_call, function, **kwargs)
File "/home/gwl/.local/lib/python3.10/site-packages/disnake/utils.py", line 561, in maybe_coroutine
return await value
File "/home/gwl/pritam/code/python/yadps-chan/src/yadps/commands/cogs/admin/emojis.py", line 60, in stickersadd
await inter.guild.create_sticker(name=sticker_name, emoji=sticker_emoji, file=file, description="test")
File "/home/gwl/.local/lib/python3.10/site-packages/disnake/guild.py", line 2542, in create_sticker
data = await self._state.http.create_guild_sticker(self.id, payload, file, reason=reason)
File "/home/gwl/.local/lib/python3.10/site-packages/disnake/http.py", line 420, in request
raise HTTPException(response, data)
disnake.errors.HTTPException: 400 Bad Request (error code: 50046): Invalid Asset
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/gwl/.local/lib/python3.10/site-packages/disnake/ext/commands/interaction_bot_base.py", line 1332, in process_application_commands
await app_command.invoke(interaction)
File "/home/gwl/.local/lib/python3.10/site-packages/disnake/ext/commands/slash_core.py", line 606, in invoke
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50046): Invalid Asset
i want eval codes anyone plz
did you await it?
what do you mean?
yeah
as in the eval command to run code through discord bot?
try this~
use regex to get anything between code blocks and use subprocess or something to get output of eval
My on_member_join isnβt working
No errors in console
have u enabled intents? and enabled them in ur code?
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
await guild.create_sticker(name='name_here', description='sticker made by bot', file=discord.File('./image.jpg'))```
use jishaku if you want a private one
what about emoji
idk about that
idk too
ok thx sir
else you would have to use an external sandboxed environment
cough cough snekbox cough cough
yea, snekbox is one of the options
ValueError: read of closed file what does this mean? i get this when i try to send the file to the channel
file = disnake.File('./temp_sticker_file.jpg')
await inter.send(file=file)
yea so sending the file works, its a valid file
really?
!d disnake.File
class disnake.File(fp, filename=None, *, spoiler=False, description=None)```
A parameter object used for sending file objects.
Note
File objects are single use and are not meant to be reused in multiple [`abc.Messageable.send()`](https://docs.disnake.dev/en/latest/api.html#disnake.abc.Messageable.send "disnake.abc.Messageable.send")s.
oh kek
try uploading it manually
on it
for whatever reason, i cant upload it, i do everything fine, the upload button doesnt work
the problem was in the image after all
AttributeError: βMemberβ object has no attribute βauthorβ
The command I use
@client.listen(βon_member_joinβ)
async def on_member_join1(ctx):
channel164 = client.get_channel()
await channel164.send(fβ{ctx.author.mentionβ, delete_after=3)
I got id in the client.get_channel
on_member_join is not a command, it is an event, and it not takes ctx as argument
!d discord.on_member_join
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") join or leaves a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
member.mention will work?
author is a member object that context use as a parameter, so type(Context.author) == type(discord.Member)
how would i make a command on my discoed bot that tested the internet speeds using https://www.speedtest.net/apps/cli and returned everything but the result link, isp, server
type(discord.Member) cursed
i can't find any docs from ookla on how to use it in code
what library you using?
in or out of a cog
Isn't it just member.mention
Bruh it doesn't metter the error is that he is using a member object like a context object 
π¦
Oh yeah i forgot i need to ask for your opinion
Hahahaha
i don't want to sponfeed them but they need to learn discord.py
How were you going to spoonfeed
Yeah i feel the same but what is the use to know if that is inside a cog or the library he is using? i mean, on_member_join is still the same for every package
πΏ
Yeah and the error isn't even related to cogs
in or out
what?
Why do you need to know if it's in or out of a cog the error isn't related to cogs
because what they sent wasn't in a cog and wasn't right at all
Yeah focus on the error part
they have py @client.listen(βon_member_joinβ) async def on_member_join1(ctx): channel164 = client.get_channel() await channel164.send(fβ{ctx.author.mentionβ, delete_after=3)
it don't work like that
Being in or outside of a cog is unrelated
it works like this
if you know that it isnt a cog, why'd you ask?
@bot.listener()
async def on_member_join(member):
channel = bot.get_channel(id)
await channel.send(f"Welcome {member.mention} to {member.guild}! Enjoy your stay!")```
The error isn't related to cogs
listen exists, and an event is never called like that
dude
events and listeners are not the same
you can use a listener even outside a cog
there i fixed it
What?
nope, it is bot.listener
I'm right
@Bot.event
async def on_member_join(member: Member):
...
@Bot.listen("on_member_join")
async def uwu(member: Member):
...```
Async
yeah phone
i want to make a project with you Ash

so we can call all the functions uwu
@client.listen(βon_member_joinβ)
async def on_member_join1(member: discord.member):
channel164 = client.get_channel()
await channel164.send(fβ{ctx.author.mention}β, delete_after=3)```
that how it should be right
and classes
and variables
and all the files
all the folders
aww, that would be so uwu, i love it
No
how to make the bot stream?
not possible
!d discord.Member
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User")...
well i use cogs
status stream
and we will create a repo on github named uwu
!d discord.Streaming
class discord.Streaming(*, name, url, **extra)```
A slimmed down version of [`Activity`](https://discordpy.readthedocs.io/en/master/api.html#discord.Activity "discord.Activity") that represents a Discord streaming status.
This is typically displayed via **Streaming** on the official Discord client...
lovely
how would i make a command on my discord bot that tested the internet speeds using https://www.speedtest.net/apps/cli and returned everything but the result link, isp, server can't find docs any where
and inside of the readme we will have len("uwu".encode('utf-16')) MB of uwu written in it
you can't make a command to find someone's latency
no no no no
it would show the bots current network speed not a discord user
well it is an app, so you have to find a way to open the app and execute the test and then read from it
it is not related to d.py also i think that it will be a pain in the ass
I want to get a large data of all cricket players, can I get it?
I am developing a discord bot so I'm asking you guys
well it just needs to run output and d.py sends the info back
it runs with a command line message called speedtest

https://www.geeksforgeeks.org/test-internet-speed-using-python/ this should be using that speedtest.net, and explains how to use it with python.
Maybe
You should still ask somewhere else other than here
Only ask here if you have actual problems with discord bots code
k bro
fun
ok
Download is16335108
Upload is 3417004 bit/s how do i make it megabytes/s
we can't read that
uh
!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.
.
i dont want to share Β―_(γ)_/Β―
why sends images then
find the emoji and add it π€·ββοΈ
something realted you ur giv
bru
me need custom emoji
ye in giv what
then make it π€·ββοΈ
idk......
buttons
π nice
.
you only need to have an administrator
he mean
ban members etc
yes
ye
i can't see it
Lol
well, if the bot has permission to create roles, then it can create those roles that do not have permissions such as administrator, server management
Hey how can i edit a channel?
No the perms
yea
how do you devide a number by 1 million in a f string
?
wrong syntax
@commands.command()
async def speedtest(self,ctx):
await ctx.channel.send("testing please wait")
await ctx.channel.send(f"{ctx.author.mention} Download is{round(st.download() /=1000000.;)} Mbps \n Upload is {round(st.upload() /=1000000.;)} Mbps")
how is it right?
this is invalid round(st.upload() /=1000000.;)
here is my code
@bot.command()
async def serverinfo(ctx):
emb = discord.Embed(title=f"Information about {ctx.guild.name}", colour = discord.Color.light_grey())
emb.add_field(name="Members:", value=f"<970598094129496085>Total: **{ctx.guild.member_count}**")
emb.add_field(name="By Status:", value=f"Online: ")
await ctx.reply(embed=emb)```
how do i fix it st.upload/st.download gives out a number then needs to devide by 1000000
st.upload() / 1000000
Hey, how can i edit channel perms?
await channel.edit(..., overwrites=...)
you first have to get the channelperms
@potent spear
no idea, I don't use v2+ stuff (anything button related and later)
i use round and it makes whole number how do i get it to leave 2 decimal places?
round(..., 2)
@bot.command()
async def serverinfo(ctx):
emb = discord.Embed(title=f"Information about {ctx.guild.name}", colour = discord.Color.light_grey())
emb.add_field(name="Members:", value=f":members_total:Total: **{ctx.guild.member_count}**")
emb.add_field(name="By Status:", value=f"Online: ")
await ctx.reply(embed=emb)```
do u want emoji?
yes
..
Thx
πΏ
where error?
πΏ
lol
you didnt closed the > i guess
What happened
i need emoji
Guys, I have a question, how to do the bot, who will delete any discord invite links
I don't think u can have an emoji in a field value @slate swan
I have bot who is deleting bad words
make a list of banned links
ok
!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...
Not my bot
@client.event
async def on_message(message):
if any(word in message.content.lower() for word in ["lol", "haha"]):
await message.delete()
I have this
how did uou copy the id of the emoji?
do like this ?
@client.event
async def on_message(message):
if any(word in message.content.lower() for word in ["lol", "haha", "discord.gg"]):
await message.delete()
id?
doesn't matter, field values and names can have custom emojis too
Yea
ok
the 97055540.. thing
@bot.command()
async def serverinfo(ctx):
emb = discord.Embed(title=f"Information about {ctx.guild.name}", colour = discord.Color.light_grey())
emb.add_field(name="Members:", value=f":kiff: Total: **{ctx.guild.member_count}**")
emb.add_field(name="By Status:", value=f"Online: ")
await ctx.reply(embed=emb)```
where is the mistake?
is that a custom emoji
yes
custom emojis need to be formatted like <:emoji_name:emoji_id>
brackets not showing
here
try that see if it works
Umm, this message might be a bit long, but it explains my problem in detail, so bear with me please.
Is it animated?
no
So my problem is I keep getting
bot_ = Bot(
File "/Users/inheritanc-e/Desktop/The_Rationals/new_rationals/bot/bot.py", line 27, in __init__
self.pool = Connection(self.loop).pool
File "/Users/inheritanc-e/Desktop/The_Rationals/new_rationals/bot/db/connection.py", line 29, in __init__
self.pool = self.loop.run_until_complete(self.create_connection_pool())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 622, in run_until_complete
self._check_running()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 582, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
in my connection class for my database there is:
def __init__(self, loop):
self.loop = loop
self.pool = self.loop.run_until_complete(self.create_connection_pool())
i supply the pool for the connection class in another class which is a subclass of discord.ext.commands.Bot. There I have:
def __init__(self, *a, **kw) -> None:
super().__init__(*a, **kw)
self.http_session = aiohttp.ClientSession()
self.loop = asyncio.get_event_loop()
self.pool = Connection(self.loop).pool
And in my main file, through which I am running the bot, the code is as follows:
async def main():
bot_ = Bot(
command_prefix=("|"),
case_insensitive=False,
allowed_mentions=AllowedMentions(everyone=False),
activity=discord.Game(name=f"Commands: {Rationals.prefix}help"),
intents=intents
)
await load_all_extensions(bot_)
await bot_.start(Rationals.token, reconnect=True)
asyncio.run(main())
I don't understand why I keep getting that error, because I am suppling the same asyncio connection db and the bot (or I think I am).
how about self.pool = self.loop.run_until_complete(self.create_connection_pool) instead of self.pool = self.loop.run_until_complete(self.create_connection_pool())
is this the right ID
I get the same error nonetheless
maybe look at nest_asyncio not too sure
https://stackoverflow.com/questions/46827007/runtimeerror-this-event-loop-is-already-running-in-python
https://medium.com/@vyshali.enukonda/how-to-get-around-runtimeerror-this-event-loop-is-already-running-3f26f67e762e
https://github.com/ipython/ipython/issues/11338
hmm, I'll do that ig. Thanks!
Does anyone know how I can make a slash command only respond to the user like if I type /test it will say hi but only that user can see hi
And then it says dismiss message
no sadly that's not possible
what library are you using ?
those are called ephemeral messages btw
So await ctx.send(βtestβ, ephemeral=True)
ok yeah I was wrong you can
You can only send an ephemeral message as a response to an interaction, eg. as a response to a button click or a slash command using interaction.response.send_message("Text", ephemeral=True)
uh you can only send ephemeral messages when responding to interactions like slash cmds, so use interaction.response.send_message
syntax depends on what lib you are using
Ok
is it value and name?
no, text
Total, members, bots
My discord bot stops working after 6 minutes of usage, i can use commands 2-4 times but then it just wont respond back to any command anyone know why?
are you closing the bot startup file?
Itβs says itβs wrong
what library?
how about await interaction.response.send_message("you are verified", ephemeral=True)
discord.py does not have slash commands how do you have that?.....
A third party
thats what i asked, what is it?
they're using the master branch of d.py and that has slash cmds
nvm
definately not, they say that they use a 3rd party library and discord.py's slash commands dont work like that...
totally not dpy app command
discord_slash.
Why would you still use a third part library 
cause outdated tutorials and thats what i found on google~
π₯² and why even discord_slash when the devs migrated to interactions.py
That is correct
It's await interaction.send(...)
It's just that, as the error says, it's not ephemeral=True but hidden=True
how to make it?
bro
we have told u like 5 times
total, members and bots in Members
len(guild.members)
3 values ββto 1 name
?
hmmhmhmh
I can't formulate a thought
how to do it?

oh god, i've only done a modal in disnake once before
i have not done even once
This is a short video showing you two ways of using Discord's new modals system with Disnake.
Read description for links!
----------------------------------------ΒΒ---------------------------------------Β-Β--
Need Help?
Require help with your code? Why not head on over to our dedicated support discord where you can receive only the best suppo...
this video was great help
i found this website
uh wait
what part are you stuck on
wait
what you've done looks good so far
its inter.response.send_modal
yeah it's got a special thing
ayo th is this
This a new discord feature?
yeah, its been like a few weeks since its out
!d code
@commands.command()
async def play(self, ctx, *, song=None):
if song is None:
return await ctx.send("You must include a song to play.")
if ctx.voice_client is None:
return await ctx.send("I must be in a voice channel to play a song.")
# handle song where song isn't url
if not ("youtube.com/watch?" in song or "https://youtu.be/" in song):
await ctx.send("Searching for song, this may take a few seconds.")
result = await self.search_song(1, song, get_url=True)
if result is None:
return await ctx.send("Sorry, I could not find the given song, try using my search command.")
song = result[0]
if ctx.voice_client.source is not None:
queue_len = len(self.song_queue[ctx.guild.id])
if queue_len < 10:
self.song_queue[ctx.guild.id].append(song)
return await ctx.send(f"I am currently playing a song, this song has been added to the queue at position: {queue_len+1}.")
else:
return await ctx.send("Sorry, I can only queue up to 10 songs, please wait for the current song to finish.")
await self.play_song(ctx, song)
await ctx.send(f"Now playing: {song}")```
I am getting this error whats the problem?
my slash commands just randomly stopped showing? any idea?
Hey there, interaction.guild is not working when I use buttons.
Please help.
full error?
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeβs robots.txt file; (b) with YouTubeβs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
!d disnake.Interactionguild
!d disnake.Interaction.guild
property guild```
The guild the interaction was sent from.
show code and traceback
probably the buttons were used in the DM with the bot
!d discord.Embed.set_thumbnail
set_thumbnail(*, url)```
Sets the thumbnail for the embed content.
This function returns the class instance to allow for fluent-style
chaining.
Changed in version 1.4: Passing `None` removes the thumbnail.
or if you were talking about the eye....
how to make eye
even though this is against the TOS, but youtube has already removed the feature to see the number of dislikes due to their own rewind being the most disliked
Grow it
eyes dont grow
Hello anyone
You can
It's a 2 person job and takes about 9 months
Steal them
From the blind
They already can't see
Might aswell take them
Then steal from children
Or from the elderly
Already lived a good life and seen a lot of things
Take em
!d discord.Guild.icon
property icon```
Returns the guildβs icon asset, if available.
guild.icon
Fast
thx

nop
?????
guild.icon_url?
no
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Umm, what is this saying?
I didn't find anything called Shard ID in developer portal
emb.set_thumbnail(url=guild.icon.url)?```

hex
define guild
lmao
how
guild = ctx.guild or smthing
https://paste.pythondiscord.com/wahebiguju This code will not work can someone help me
what is not working
you need to decorate the on_message
commands.Cog.listener("on_message"); async def my_on_message(self, message:)
the class ur using doesn't subclass from commands.Cog
^ you want something like class Levels(commands.Cog)
new errors is progress
you cant expect us to mindread your problem and magically know all the correct solutions
Damn, even replit isn't that bad
its worse
Antartica level of ping
https://paste.pythondiscord.com/kudekosume Is that right now?
do you think i hold the record of highest bot ping?
mars level*
nah voyager does
Imagine a discord bot hosted on voyager
now we wait
https://paste.pythondiscord.com/kudekosume Is that right now?
And it just sends out data and pictures
You just sent that 1 minute ago
It exhausted all it's power trying to get a low ping
haha
True but my @commands.command() async def level(self, ctx, member: discord.Member = None): Doesnt seem to work
discord.ext.commands.errors.CommandNotFound: Command "level" is not found
Then why say is that right?
Are you on discord.py 2.0?
The latest version yes
@jade tartan it's async
The setup version is async
And add_cog is a courotine now
!d discord.ext.commands.Bot.add_cog
await add_cog(cog, /, *, override=False, guild=..., guilds=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a βcogβ to the bot.
A cog is a class that has its own event listeners and commands...
Also that's a horrible way to storing data for a long time
Even for a small leveling system
Where does that go under?
What?
yo how do i skip default role?
Just make your setup function asynchronous
where i paste my code?
And make your add cog a courotine
!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.
if role == member.guild.default_role:
...
``` or ```py
for role in member.roles[1:]: # skip the first element, which is the default role
...
https://paste.pythondiscord.com/How do i get the song name that is played
Fuck
I was going through the docs
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeβs robots.txt file; (b) with YouTubeβs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
On my code where does this go?
Iβve got txt of user ids for verify for command but I wanna check make it so it doesnβt make duplicate user ids
It doesn't go anywhere
yeah i was wrong, i forgot to put else π
Then why did you tell me this? "And add_cog is a courotine now"
Because it is
how to make verification level?
What
Just make your setup function asynchronous cause add_cog is a courotine now
What is a verification level
when creating a server, you can specify the level of verification
Oh that
if it is high, then you need to have mail
class discord.Guild```
Represents a Discord guild.
This is referred to as a βserverβ in the official Discord UI...
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Ummmmm, but I have enabled privileged intents explicitly from the developer portal, so why am I getting this error?
!d discord.Guild.mfa_level
The guildβs Multi-Factor Authentication requirement level.
Changed in version 2.0: This field is now an enum instead of an int.
Maybe this?
second
What did you enable?
!d discord.VerificationLevel
Ah i see
thats what I did
What did you enable in the developer portal
!d discord.VerificationLevel
class discord.VerificationLevel```
Specifies a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild")'s verification level, which is the criteria in
which a member must meet before being able to send messages to the guild...
I'll keep that name in mind
Since you did All()
You'd have to enable message content too
In the portal
But it won't be enforced till August 31, 2022
so what do I do?
set intents.message_content = False?
you can either add member and presences intents as True to .default() or set message_content to false from .all()
should work :3
how can i get the amount of messages ever sent in a channel?
how to write the number of channels on the server?
using pycord, tryina make the bot be able to list invites to all servers its on.. failing lol
invites = []
for guild in bot.guilds:
for c in guild.text_channels:
if c.permissions_for(guild.me).create_instant_invite:
invite = await c.create_invite()
invites.append(invite)
break
what am i doin wrong?
i have a discord bot that uses interactions but it does not show up in the list with the slash commands even if it runs
!d disnake.Guild.invites
await invites()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Returns a list of all active instant invites from the guild.
You must have [`manage_guild`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_guild "disnake.Permissions.manage_guild") permission to use this.
@pseudo portal
whered i do this π
!d discord.Guild.channels
property channels```
A list of channels that belongs to this guild.
use len on this
break will break your loop and invite for only server will be generated
thats what's happening right?
ooh i thought so only does one invite per server
and howd i finish the loop? an await?
!d disocrd.Client.get_emoji
No documentation found for the requested symbol.
you don't loop thru the channels , just use the 0th index of guild.text_channels
i have a discord bot that uses interactions but it does not show up in the list with the slash commands even if it runs
where write it?
wherever you want to use the emoji~
global commands take upto an hr to get added on the Discord interface
how to set image as attachment
sorry im pretty confused π
here's what i got:```py
invites = []
for guild in bot.guilds:
for c in guild.text_channels:
if c.permissions_for(guild.me).create_instant_invite:
invite = c.create_invite()
invites.append(invite)
break
await send(file=discord.File("path to file"))
use the 0th index
!e print([1,2,3][0])
@slate swan :white_check_mark: Your eval job has completed with return code 0.
1
!d attachment
Qt Style Sheets support various properties, pseudo-states, and subcontrols that make it possible to customize the look of widgets.
@bot.command()
async def serverinfo(ctx):
emb = discord.Embed(title=f"Information about {ctx.guild.name}", colour = discord.Color.light_grey())
guild = ctx.guild
list_of_bots = [bot.mention for bot in ctx.guild.members if bot.bot]
emb.add_field(name="Members:", value=f"""
Total: **{ctx.guild.member_count}**
Members: **{len([Member for Member in ctx.guild.members if not Member.bot])}**
Bots: **{len(list_of_bots)}**""")
emb.add_field(name="By status", value="""
Online:
Offline:
Do Not Disturb:
Idle:""")
emb.add_field(name="Channels:", value=f"""
Total:
Text:
Voice:""")
emb.add_field(name="Owner:", value=f"{ctx.guild.owner}")
emb.add_field(name="bot.get_emoji(970653782444744744)Verification Level:", value=f"d")
emb.add_field(name="Created at:", value="None")
emb.set_thumbnail(url=guild.icon_url)
await ctx.reply(embed=emb)```
i dont get it, can u not just do <:NAME:ID> for emojis in embeds?
second
that wasn't working for them
is it on a server the bots on? and if animated add a:
and, if the emoji didn't exist for bot, it would simply appear as None instead of its name.
oooh
oops
kaif, does the bot have external emojis permissions in the server?
and f i just realised im facing the same issue
he admin
the emojis used to appear till tomorrow, now it does not
you use translator?
what kind of translator?
oh, I'm just from Ukraine and my English so bad
:3
how do I make a command that will add forbidden words to a json file ??
do you know how to make word filter?
that is, which line of code is responsible for adding it?
@swift crane
well, my type is working right now. So
if {i.lower().translate(str.maketrans('','', string.punctuation)) for i in message.content.split(' ')}\
.intersection(set(json.load(open('cenz.json')))) != set():
await message.delete()```
here I want to be able to add certain words to this json file myself
so how can it find bad words?
i want to put words in list
and if any msg contains it
make bot to do thomeshing
Starting to look a bit esoteric \π
!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...
with open('tbl.json') as f:
data = json.load(f)```
@supple thorn What 's this for ?
I can't use json files
@supple thorn I don't need an event
What?
I'm not saying that to you
hey quick question I just created a slash command(using discord-slash) in a cog that is in a different file then the main but it's not working it's not shown or called when I do the command
#Slash.py
from discord.ext import commands
from discord_slash import cog_ext, SlashContext
class Slash(commands.Cog):
def __init__(self, bot:commands.Bot):
self.bot = bot
@cog_ext.cog_slash(name="slash", description="first slash command of this bot")
def _slash(self, ctx: SlashContext):
ctx.send("Slash")
def setup(bot:commands.Bot):
bot.add_cog(Slash(bot))
I'm saying it to nikita
Why use a 3rd party lib?
Discord.py has slash commands so why not use it?
Wha??????????
where how?
Yes
so...
when was this update??
i can't find if word is in list
It's in discord.py 2.0
What
Just check if the message content matches any item inside your list
i have word list
If it does then do what you want to it
so how do I update it to that the usual way or other way?
github
pip install -U git+https://github.com/Rapptz/discord.py
Also
Note that discord.py has breaking changes
when will this be pushed to pip
Well minor
badwords = ["bla", "blu", "ble"]
@bot.event
async def on_message(msg):
if badwords in msg.content:
await ctx.message.delete()



