#discord-bots
1 messages · Page 743 of 1
async def stat(ctx, reason):
r = requests.get(f"https://api.hypixel.net/player?uuid={reason}&key=0f4686d5-5696-4b6e-843e-79932a76fbdc", headers={'content-type': 'application/json'})
await ctx.send(r.json()["record"]["owner"])
really bye guys 
@slate swan go sleep smh we'll see you tomorrow probably idk I don't frequent this channel much
bye
doesnt return anything
u stucc in this channel
yes
lmfao
im a general here so yeah
yes they are
this channel is active
@tender estuary
aint nobody gonna let u go
I spend my time in the disnake server lel
me lol
Try yourselves first brother
or #dev-contrib
yeah ive seen you ;))
async def stat(ctx, reason):
r = requests.get(f"https://api.hypixel.net/player?uuid={reason}&key=api", headers={'content-type': 'application/json'})
await ctx.send(r.json()["record"]["owner"])```
i dont think this is general guys
this is call bot help for a reason
mini not funny
please spend some time in that help channel you help rly well

called*
PLEASE HELPPPP
🕴️
⛹️
omg
I will pong you the next time someone asks a question /j
disnake server is scary theyre so smart it scares me😔
how do i eat a hamburger
!ot before we get captured
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
as a disnake contrib: no we are not
A beese churger?
gogogogo ot2
.topic
Suggest more topics here!
yes🏃
another language tbh
go here omg
ive made a programming lang in python
gay meter from dankmemer
but i forgot how to use the programming lang
lmfao
economy system but i have to stop procrastinating😠
you can do that later
yeah
you mean terminal os?
@slate swan I will pong you in disnake on help questions /srs
termux bahahaha
if you don't go sleep
linux terminal improved
i dont use linux
kinda gay bro
no need to be insulting people for an operating system they don't have.
uh fine but im not smort so %5 percent of the questions will be answered 
anyone know any module I could use to make actual bootable iso with python
bro i use mac 💀
is that a threat👀
today is a funny day
no
bro, your a savage for insulting yourself
lets be real I stayed up until 10 am today so uh
windows is great screams in windows 11
windows 10*
nice one
there's something called opinions btw
my toaster OS is great.
#code-of-conduct
im pretty sure it says that they respect different view of stuff
my toilet has a os
• Being respectful of differing viewpoints and experiences
this
two can play that game, linux very g-
linux not very good? thanks for telling me
you said nope to what i said so that means linux is not great or good
wrong channel btw
I totally forgot this was discord bots
It is great.
you can hek in it
i thought this was the dpy server
great
people in the dpy server are scary
why is everything in this channel funny
¯_(ツ)_/¯
(╯°□°)╯︵ ┻━┻
because u are in it
y e ||boo|| s

ai text gen
im leaving in ||never gonna|| sike ||never gonna give you up||


bye(really this time)
ayo-
Delete that before an admin slaps you-
Can you just go and not come back a second later
!ban 535319856913055744 troll
:incoming_envelope: :ok_hand: applied ban to @silk nest permanently.
yea fuc-
smh it smells like poo in here
lol
@client.event
async def on_message(message):
if message.content.startswith('test'):
channel = message.channel
await channel.send('Say hello!')
def check(m):
return m.content == 'hello' and m.channel == channel
msg = await client.wait_for('message', check=check)
await channel.send('Hello {.author}!'.format(msg))
if I said that to anyone else... lmao
How to make it so it pings the author, instead of only saying their tag
author.mention
wait why was he banned
Kk
msg.author.mention??
also don't use .format
can you just use a command instead of an event.. this is outdated
Oh wait
I already told him to, seems like he ignored
@client.command()
async def ping(ctx):
await ctx.send(f"{ctx.author.mention} heylloi!")
That's all you need tbh
misleading command name 
I could have used test, dog, cat, neptune or really anything
just wanted to show command decorators are a thing
yes, I wasn't being serious
what do you mean "drop"? that word has varying definitions
like a giveaway drop
just nvm
Kinda ironic with your name lol 😂😆
well his name trolls himself so xD
There's actually no way to do that , but you can get the checks u added on the command
!d discord.ext.commands.Command.checks
A list of predicates that verifies if the command could be executed with the given Context as the sole parameter. If an exception is necessary to be thrown to signal failure, then one inherited from CommandError should be used. Note that if the checks fail then CheckFailure exception is raised to the on_command_error() event.
what will the display be
how to make my bot mark an image from link "spoiler"
wher code
repl
w h e r e c o d e
wot
send ur full code
k
🤷♂️ see full tutorial, don't skip anything
also why pfp-
Is there a way I can add a time limit to the wait_for() function?
For example, if the user fails to give a value within a particular amount of time, it'll execute another set of statements.
!d discord.File.spoiler
Whether the attachment is a spoiler.
There is a timeout kwarg.
The error that is raised if timeout is passed is asyncio.Timeout error
Do I just simply add it as **timeout?
in the check
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
reason: str```
yes
okay
mhm
And since we don't know how the JSON looks like, nobody can help unless you send it.
But when using .json()
You will somewhere need [0]
where do i put
Before, between or after ["record"]["owner"]
Because as I said, we don't know how the JSON looks like.
let me try all 3
So we can't really help correctly.
send it here
no
No
then what is the json
Print r.json()
Well, UUID is wrong
what do i do then
Which means, the UUID you give when making the request is malformed. Fix that.
Give valid UUIDs and format them correctly.
!d uuid.uuid4 use this if not using it before to create UIDs
hey , in my music bot , when i add songs to q, if a song is being played currently, its voice starts to break. after some time voice become ok.
anyone know why does this happen?
uuid.uuid4()```
Generate a random UUID.
No.
This won't help at all.
Wait, UUID means game ID?
Minecraft UUID
Ahh sorry about that then. I don't play MC so didn't have any clue
Should I recieved asyncio.Timeout when I put it in a try-exception block?
No help with music bots, sorry
Yes
dc8e9a5f-12e2-4928-bd92-c4131b291f26 this is a UUID example
Gotcha
5687da32-6999-429c-bb7d-2006907ec995
Not 5687da326999429cbb7d2006907ec995
how to delete channels by specifying names?
Mojang's API should still perfectly understand a trimmed UUID
It's not working for me oof
I'm not sure, are you querying api.hypixel.net/player ?
await ctx.send("reply with e or commit die")
def check(m):
return m.content() and m.channel == ctx.channel
with await bot.wait_for('message', check=check, timeout=10) as msg:
try:
print(msg.content)
except Exception:
print(msg.content)
traceback.print_exc()
My code
That's very wrong
how
The key is a hypixel API key you need to register for, not the players UUID
Nothing's wrong.
{reason} is the UUID, they just copied it
Can someone help?
What is the problem?
The key is valid, see by yourself.....
I am not able to use the wait_for() function properly
except asyncio.TimeoutError
Lemme try that
does anyone know if on_guild_update is triggered when a user stops boosting a guild
!d discord.on_guild_update
discord.on_guild_update(before, after)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild") updates, for example:
• Changed name
• Changed AFK channel
• Changed AFK timeout
• etc...
and don't use the with statement,
so whats my problem please tell me
A new boost is not a change to the guild.
Why do you use with? just do msg = bot.wait_for(#your stuff here)
instead put wait_for inside of the try block, just before the print
Okeh
but premium_subscription_count changing doesn't trigger that?
for me?
You need to learn to stop mass pinging. People won't help you.
Remove :str, it's not needed.
still nothing
have u figuired out the [owners][record]
thing i gave u the documentation
player?uuid= is the ? needed
The URL you're trying to parse doesn't give any owners nor record fields.
So even when you get the parameter to work, it won't do what you want to do.
he's talking about 'records'
this?
And that's why I'm saying.
The JSON doesn't give such information back.
@client.command(name="stat", aliases=["stat_test"])
async def stat(reason):
r = requests.get(f"https://api.hypixel.net/player?uuid={reason}&key=0f4686d5-5696-4b6e-843e-79932a76fbdc", headers={'content-type': 'application/json'})
print('line one called')
print(r.json())
is there anything wrong here also im using disnake
does using disnake change anything
At least nothing in owners
Which doesn't even exist
this is a very confusing endeavor, he should tell us which data exactly he aims to extract from the json response
It would be ["player"]["stats"]["Bedwars"]["practice"]["records"]
ii want to start simple and just extract lets say the play bedwars stats
one thing
i just want to extract one
Well, which one.
stats
Stats is vague....
ok then player
The API gives lots of information
"Bedwars":{
"packages":[
"leaderboards_resync_mar_2021"
],
"bedwars_boxes":17,
"first_join_7":true,
"Experience":81745,
"games_played_bedwars_1":595,
"eight_two_winstreak":0,
"_items_purchased_bedwars":12634,
"beds_lost_bedwars":422,
"coins":30686,
"deaths_bedwars":1970,
"eight_two__items_purchased_bedwars":6673,
"eight_two_beds_lost_bedwars":262,
"eight_two_deaths_bedwars":1066,
"eight_two_entity_attack_deaths_bedwars":424,
"eight_two_entity_attack_final_deaths_bedwars":155,
"eight_two_final_deaths_bedwars":269,
"eight_two_games_played_bedwars":298,
"eight_two_gold_resources_collected_bedwars":5429,
"eight_two_iron_resources_collected_bedwars":43326,
"eight_two_items_purchased_bedwars":6969,
"eight_two_losses_bedwars":277,
"eight_two_resources_collected_bedwars":49563,
"eight_two_void_deaths_bedwars":614,
"entity_attack_deaths_bedwars":759,
"entity_attack_final_deaths_bedwars":254,
So just saying "stats" or "player" doesn't give us what you want to know.
lets say when the player last logged in
["player"]["lastLogin"] returns a timestamp, 1641889126926 -> <t:1641889126>
good but mymalformed uuid still doesnt work
are you sure you're passing the uuid correctly
does it look correct
you really shouldn't do everything on the URL of the requests, it complicates things
hey can anyone help me i m making a dc server spammer
Well, like that it doesn't since it's an f-string.
!rule 5 @slate swan
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
damn u really memorised the rules

happens so often we all remember it
i wanna import tkns from a txt file
Yes it does.
how can i
?
<@&831776746206265384> can you explain to @slate swan that asking for help about spammers/nukers using user tokens is not allowed and should not be discussed here, thanks :)
oops
I don't think you needed to ping the mods for this..
Yes I did.
Again? After they said "oops" and I linked to the rules.
Repeating myself won't help.
ok yea i understand
do you mind answering this please? @slate swanAlso I'm sorry for the ping
anything i can do to fix my program
well, I'd need a user to boost
It's r.json()[...]
@slate swan
- We're not going to help you with a selfbot
- Please change your banner and profile picture to something safe-for-work
But I guess it should, because Called when a Guild updates and premium_subscription_count is an attr of guild
How about just r.json()
Seems like nothing is found, so the JSON is different.
how can i fetch a message by it's id
!d discord.TextChannel.fetch_message
await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
i got it
@green bluff what status code does it return
If it is not 2xx (should be 200 if everything is totally ok) then there's an error and you most likely need to get text of the return
Also you really should use aiohttp in async functions
The invocation context is always the first argument
why variable called reason, wen its an user id
and yea no ctx at all
oh well reason is his ctx lol
@green bluff yeah you forgot to include ctx and you were parsing it as a user id
I was wondering something
if I give this information with password
then can anyone access this database?
Hello, in some serious need. Hoping i can pick someones brains about a issue im having
how could i retreive the guild ID from a custom function in discord.py
I have no way of passing the guild ID through the function either as the function gets called straight away soon as the script starts and then continuously loops
You need a variable that refers to the guild. If you have the name of the guild or a channel, even a member, you can get the guild object from that
Does discord bot on dpy or its fork require any ports opened for work
Could you show how it looks like in code? We can't understand much of just description and suggest a normal solution
that isnt how you set up cogs
how then
should i replace cog in the fifth line with commands.Cog
Commands.cog to commands.Cog
its not working bro
You leaked your token
Lets see your code
You're missing a :
You're missing another : on line 6
the error goes to line 7
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
Line 7 needs to be indented 2 levels
bruh, else needs to be unindented
kos omak
please dont spoonfeed
ok
Hmm?
any idea why this says extension example could not be loaded?
Main file -
import disnake
from disnake.ext import commands
import os
bot = commands.Bot(command_prefix = "?")
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
bot.load_extension(f'{filename[:-3]}')
and the cog is
import disnake
from disnake.ext import commands
class Example(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def ping(self, ctx):
await ctx.send("Pong!")
def setup(bot):
bot.add_cog(Example(bot))
Do you use any load command?
I didn't, when I started the bot, it raised that error
bot.load_extension(f'{filename[:-3]}')
look at this line and make sure it's correct 
it looks right, what's wrong?
It's cogs.{filename[:-3]}
^
You need to load from the cogs folder, therefore the prefix.
@slate swan hey do you know do I need to open any ports on the firewall (it blocks all connections from unlisted sources and to unlisted ports) for the bot script to work or it just needs internet access?
How di I make my discord bot show that box?
I heard I have to use embed but I have no knowledge on how to do it
!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
https://python.plainenglish.io/send-an-embed-with-a-discord-bot-in-python-61d34c711046
This could also help you
probably because you passed in a name parameter in the decorator although your function name is enough for it to be recognized as the command name.
i've attempted making a decorator and using a function's name is pretty cool
and I have another problem, I cant use (name = "help"), it says the function help already exists. but I have not used it anywhere else
remove name="help"
function name
ohhh
the function name is what's required for the command name
Don't make a hard coded help command, instead subclass it
^
read pins for further information on subclassing help commands
You see... I started programming bots not long ago and I learnt from like 4 yt videos so subclass, cogs these are big words for me
If you do wish to waste your time, you would have to remove the help command in the bot constructer
well, do you know the basics or indermediate levels of python?
!d
#bot-commands
ok
Hey @crisp bloom!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
oof
!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.
use this website
Hey @crisp bloom!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
i have code, how can i cog?
i suggest using a .env for storing the token but it's kind of hard to explain how to make a cog
Cogs are a very important part of discord.py which allow you to organise your commands into groups - not to be confused with actual command groups, which will be explained later in the tutorial.
Check this out
.ini works too
i guess so
dude it still gives me the same error
thanks
@crisp bloom i dont understand what you put in the link
its connect 4
an example of something I made
probably one of my hardest
i dont play c4 (connect4)
never?
never played it
ok another thing I made was a program that solved right angled triangles for you using trignometry
nice
I literally encrypted my token 
alrighty... I seem to have gotten this
not exactly ogranized 😂
how do I like space them out?
what
(embed=embed_name)```
huh?
last line of your code
the await message.channel.send?
yes
It actually showed nothing
!d discord.Embed
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
because your help command is still dpy's help command
and don't use on_message
I guess u are following old tutorials
so I need async def on_message?
No
how to make the bot send a message when a specific word is said in a embed??
Use the commands framework
u use on_message and check if word is in the content, send the embed if it is
I guess bots aren't triggered by another bots and users cannot send embeds in their messages
Like the bot triggers but there is error
are u trying to look for a word in an embed? or send an embed after looking for a word
what are you making
Look for a word in an embed
of whom?
Like when you give money in dank memer there is a embed sent i want my bot to reply money sent
ah, explain it properly
Ohk
are you making a command with embed as response?
Noo
then?
my bot is broken I think
with such way you can't make your bot get triggered by other bots, it needs quite hacks
aah ok ;((
but my bot still replies with this crap
u didn't read what I said
^
ure gonna have to change the help command in the bot constructor
you can disable it too
You need to remove the default help command before making a custom one
and there's no problem in this command tho
bot.remove_command('help')```
and I put that here?
this command don't have any problem
where do I put this
anywhere above your new help command
where would be the best place to learn discord.py
anyone want a script that converts a list of swears to enhanced swears for better detection?
i just finished it and thought it would be cool
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
Regex
wuts dat
re
ah
alr
but im sticking to my form of swear detection because it is definitely better
I doubt it
wanna see the list of swears it created?
Regex will always be superior to manual searching
Regex is slow
You can just tokenize the sentence then use fuzzy searching
Better imo than regex here
There is just to many swear patterns for regex
@quaint epoch mind showing what u doing?
do you want to see the set of swears my script created?
but do you know regex?
!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.
Then stop forcing other people using it
Its better doe
Bro, he was just suggesting
the list of swears is soooo big, pydis paste tool doesn't support it
Hahaha just skip the list of swears then @quaint epoch
Damn
2 months for me
I am very persistent 
Wait, BTW what kinda patterns u talking about?
What I suggested is pretty effective and fast
Sure it is
Regex patterns, E.d (\d)+
O
I don't see why someone will completely censor their members with 99999 "swearing" words lmao
Cringe servers be like you say fuck you get muted
Facts
Tbh I use regex for detecting invite links
There is useful
And u say duck or frick just to express yourself and not get muted in a normal convo only to see people reporting u to mods cz u r tryna evade the system 😐
What's your Python version?
Yeah that would be a good use for regex because a url has a PATTERN swears are harder to pstternize
Windows 7 
And what's your dpy version?
Haha Windows 7 are rare nowadays, yea
Cause its a security risk
It's not that bad to react like that
As if people like my parents care
!d discord.version
discord.__version__```
A string representation of the version. e.g. `'1.0.0rc1'`. This is based off of [**PEP 440**](https://www.python.org/dev/peps/pep-0440).
...
Wait, anyways, just reinstall dpy @slate swan
discord.__version__```
A string representation of the version. e.g. `'1.0.0rc1'`. This is based off of [**PEP 440**](https://www.python.org/dev/peps/pep-0440).
What if he can't run code
i don't see how you can create a pattern for swears lmao, i mean you can but it will take an horribly long time and it's worthless, people will always find new ways to swear, meanwhile a discord invite link has the same basic pattern
You have to make regex patterns for every swear, which is my point earlier and why regex would be bad for filtering swears
Me who only searches for discord.gg/ in the message content instead of using regex for discord invites 
Instead just tokenize the sentence, then use fuzzy searching
!d difflib.get_close_matches
difflib.get_close_matches(word, possibilities, n=3, cutoff=0.6)```
Return a list of the best “good enough” matches. *word* is a sequence for which close matches are desired (typically a string), and *possibilities* is a list of sequences against which to match *word* (typically a list of strings).
Optional argument *n* (default `3`) is the maximum number of close matches to return; *n* must be greater than `0`.
Optional argument *cutoff* (default `0.6`) is a float in the range [0, 1]. Possibilities that don’t score at least that similar to *word* are ignored.
The best (no more than *n*) matches among the possibilities are returned in a list, sorted by similarity score, most similar first.
that's interesting 
It is blocking though, so in an asynchronous enviourment your gonna want to run in executor
still works if you put the https?
it has 4 different filter levels, low, medium, high, and extreme (the one im talking abt is extreme) so you can change it
low just blocks very basic swears
!e
print("discord.gg/" in "https://discord.gg/python")
Sure
medium is a good amount detection, the kind that comes with profanity filter modules
@maiden fable :white_check_mark: Your eval job has completed with return code 0.
True
Okay I'm used to my bot's eval, sorry
nice, does it use snekbox?
so, is it sandboxed?
huh, mine is for anyone
Would this also print True if the string was scrambled
Scrambled?
I might just be looking at this from a C language perspective though
what, you have an eval command for everyone ?
Since strings are char arrays
await ctx.guild.edit_role_positions() docs want me to pass a list n positions, but how i just put 1 role at top?
yes, like @unkempt canyon
Ah. Mine isn't like that
alr
if your eval command is not good you might risk other people steal your token
!e ```py
a = "rab"
print(a in "bar")
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
False
hmmm, alr
ok nevermind kek
Ah that way
Was looking at it differently
I guess then u gotta use split() and then check if each alphabet is there in a single word (totally not a good idea)
hello i need some help
Sure
@client.command(aliases=['user','info'])
@commands.has_permissions(kick_members = True)
async def whois(ctx, member : discord.Member):
embed = discord.Embed(title = "User info of"+ member.name , description = member.mention , color = discord.color.cyan())
embed.add_field(name = " Member's ID", value = member.id, inline = True )
await ctx.send(embed=embed)
!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.
@client.command()
async def email(ctx, sender, recipient, subject, *, body):
global address, password
if "`" in body:
body = body.strip("`")
message = MIMEMultipart()
message["From"] = sender
message["To"] = recipient
message["Subject"] = subject
message.attach(MIMEText(body, 'plain'))
address = sender
dm = await ctx.author.create_dm()
await dm.send("Send me the password for your email.")
msg = await dm.wait_for("message", check=ctx.author)
password = str(msg.content)
embed = discord.Embed(title=f"From: {sender}", discription=f"""To: {recipient}
Subject: {subject}
Body:
{body}""", color = discord.Color.blue())
await ctx.send(embed=embed)``` What am i doing wrong
globals 😐😬
can someone check this
!botvars
Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"
@bot.command()
async def get(ctx: commands.Context):
"""A command to get the current value of `test`."""
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
"""A command to set a new value of `test`."""
# Here we change the attribute to what was specified in new_text
bot.test = new_text
This all applies to cogs as well! You can set attributes to self as you wish.
Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!
please use f strings
What's the issue with this
oook
Also your indents
It doesnt
So basically @stable berry, you can't use Color.cyan
^
If you want to use cyan color , just use 0x<hex for cyan color>
What's the issue bruv
im trying to get the thing to ask for the password in dms, and wait for the response
then ill add code for deleting both messages
well i cant do that in dms oops
^
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
can anyone explain this error?
yes, but how do i wait for a message in dms only?
so that should be my check param right?
Yeah but this one is not full
@commands.command(name="queue", aliases=['q'])
async def queue(self,ctx):
vc: wavelink.Player = ctx.guild.voice_client
queue = [track for track in vc.queue]
qstr=str()
for idx, i in enumerate(vc.queue, start=1):
to_add = f"{idx}.{i.query if isinstance(i, wavelink.PartialTrack) else i.title}\n"
if len(qstr)+len(to_add) > 2000:
#await ctx.reply(qstr)
qstr= ""
continue
else:
qstr += to_add
length = len(qstr)
embeds = []
for i in range(length):
embeds.append(discord.Embed(title=f"{len(queue)} Songs Playing", description=qstr))
paginator = DiscordUtils.Pagination.CustomEmbedPaginator(ctx, remove_reactions=True)
paginator.add_reaction('⏮️', "first")
paginator.add_reaction('⏪', "back")
paginator.add_reaction('🔐', "lock")
paginator.add_reaction('⏩', "next")
paginator.add_reaction('⏭️', "last")
await paginator.run(embeds)
i got this code fo now but wt happens is tht it jus sends the last embed....and wen i react it does not change the embed to the prev or next one or wtsoevr...help plish
Only for private channel message waiting
Using isinstance is better ngl
!d discord.DMChannel is a class
class discord.DMChannel```
Represents a Discord direct message channel.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the channel’s hash.
str(x) Returns a string representation of the channel
is there any problem in this
embed.add_fields(name = "ID", value = member.id, inline = True )
bcs its showing syntax error in this line
field*
i checked with field also but its still showing error
It's enum comparison isn't it
Your method is different but I don't really see what is better in it
You need to str() member.id
Probably
!d discord.Embed.add_field
add_field(*, name, value, inline=True)```
Adds a field to the embed object.
This function returns the class instance to allow for fluent-style chaining.
thanks
I swear this was working before
It deletes the users message if its all caps
but it randomly stopped working
there is no error message so there isnt a mistake
@crisp bloom wdym it stopped working
Stopped responding to literally everything?
Or stopped deleting caps messages
^
was the message all capped
Could you give an example of cap message that was supposed to be deleted but wasn't
!e
print('SUP'.isupper())```
@vale wing :white_check_mark: Your eval job has completed with return code 0.
True
Could you copy that message content
anyone here good at implementing email api into a script? i need help replacing one in something i have
wdym
If it's API and not a module and you just need to make a proper request I can help
wtf is this... <disnake.ext.commands.context.Context object at 0x7f95024f9a90> Command raised an exception: AttributeError: 'str' object has no attribute 'id'
await ctx.guild.create_role(name=role, color=self.colors[role], hoist=False, reason="Cause bad-ass bot")
positions = {role: 3}
print("Trying ordering")
await ctx.guild.edit_role_positions(positions, reason="Ordering...")
Btw try printing message.content and the condition
it complaing about ```py
positions = {role: 3}
await ctx.guild.edit_role_positions(positions, reason="Ordering...")
role is a string
can anyone help me with my discord bot?
when i put my filter word script my other commands wont work anymore
Seems like your role is str
Maybe you want to get a role object from ctx.guild.create_role that you called above
Not sure what do you mean, most likely you are missing process_commands in on_message event. Better use a listener or put that to the event
!d
discord.ext.commands.Bot.process_commands
await process_commands(message)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.
By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.
This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.
!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...
Still not getting this 🥲
Better this
embed.add_field(*,name = "ID", value = str()member.id, inline=True )
Not like this lmao
ok so like i suck
str(obj)
Me new
Ok
Could you show your code please? More exactly on_message
Sorry if i am irritating anyone
You are not dw
no you're not
ok ill try that
It's better practice to use listeners rather than to overwrite events
embed.add_field(*,name = "ID", value = str(member.id), inline=True )
await ctx.send(embed=embed)
Is this ok ?
* ?
This is what I did for a profinaty filter, I made a separate file with a million swear words, then just checked if the users message contains any word that matches with the one in the file
It is usually used to separate keyword-only arguments, it can't be an argument parsed to a function
O ok
It means all arguments after * must be kwargs
so like now nothing works
@onyx coral show new code
Thanks @vale wing it worked
i was
No
Cause bot.event gets triggered whenever someone sends a message
@bot.event overwrites the internal event function of the bot, @bot.listen() does the same purpose but doesn't overwrite it and there can be several of them as well
Just add it as in the example @onyx coral
this is how I do it
so like would i type in @bot.listen on_message()?
It is a good way but look at what I said
you need to process the command
@onyx coral this ^
await bot.process_commands(message)
using process_commands inside a listener will make all the commands run twice
@crisp bloom don't confuse people please
Yeah you shouldn't use it inside a listener, that's why listen > event
ok
@slate swanlisten('on_message')
@crisp bloom do you want me to explain why is @bot.listen() better and how to use it? It could improve your code btw
What
sure
so would i need to remove anything
It should be
@bot.listen('on_message')
async def message_controller(msg):
... #your content?```
oh
this still doesnt work bruh
thx
The main advantage of listen is you can create multiple of them and they all will be called once the event occurs. Also you don't need to, for example, do process_commands in on_message. You use it like
@bot.listen('event_name')
async def func(...):```
I see...
i got it fixed np
Like
@bot.listen('on_message')
async def automod(msg): ...
@bot.listen('on_message')
async def xp_controller(msg): ...```
I am trying to make a button attach to an embed. I've seemed to be able to make buttons attach to a normal message with this:
###############################
#--- testbutton command ---#
@bot.command()
async def hello(ctx):
await ctx.send("hello", components = [
[Button(label="Hi", style="3", emoji = "🥴", custom_id="button1"), Button(label="Bye", style="4", emoji = "😔", custom_id="button2")]
])
# button1 reaction
interaction = await bot.wait_for("button_click", check = lambda i: i.custom_id == "button1")
await interaction.send(content = "Button clicked!", ephemeral=True)
# button2 reaction
interaction = await bot.wait_for("button_click", check = lambda i: i.custom_id == "button2")
await interaction.send(content = "penis", ephemeral=True)
but I can't seem to figure out how to make it go into an embed. anyone know how to help?
yeah was just a str needed object
help please((
prefix is not defined
How to fix this?
!d discord.Embed and embed param in send
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
are you on dpy 2.x
.url instead of _url try
ok letme try
@vale wing can u check once again
embed.add_field(name = "ID", value = str(member.id), inline=True )
im asking your discord.py version , now what ide you are using
Seems valid
user.avatar.with_size(128) @slate swan
🥲 But idk why it's still showing invalid
I tried putting discord.Embed and await ctx.send(embed=embed) but that just sends the message in a embed without the buttons attached.
Errors?
components param?
I forgot how to check it?
You are using discord_components aren't you
It's just showing error syntax - invalid syntax
3rd party library
discord.__version__
DiscordComponents(bot)
It is probably in the different line I don't see any invalid syntax
yes
Ok works now thanks
Ok but its showing in that aprticular line wait sending u the whole cmd
Sorry, I can't help with that library much, also I suggest to use a fork of dpy or even dpy 2.0, it is much easier
Can you tell me how to fix it?
you are using dpy 2.0 consider reading the migrating docs
i need to get the user by userid which is in embed footer. how do i do that?
just use the embed kwarg?
whats dpy 2.0? ive been using the same dpy for likea few months now. when was 2.0 released?
Hey has anyone used the nextcord .py scheduled guild events stuff yet
Discord.py 2.0
A while ago alpha version was released and now support of it is ended
Check pins to know how to install it
Check your private messages
!d discord.Client
so is dpy 2.0 better than normal?
class discord.Client(*, loop=None, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.
A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
@vale wing
@commands.has_permissions(kick_members = True)
async def whois(ctx, member : discord.Member):
embed = discord.Embed(title = member.name , description = member.mention , colour = discord.colour.hex#00FFFF())
embed.add_field(name = "ID", value = str(member.id), inline=True )
await ctx.send(embed=embed)
I can't help many people at once wait a bit pls 🙂
discord.py is discontinue consider moving to nextcord or disnake
I'm attempting to make a discord events bot using nextcord.py/dpy and the discord official events but I'm having trouble with entity_type as its giving me an error type error str doesn't have attribute value and im confused about this
here is my command
@client.command(name='rp' ,help= 'creates an event')
async def rp(ctx, name=None, time =None, reason = None):
#external =
channel = nextcord.utils.get(ctx.guild.channels, name = 'roleplay-sessions')
await ctx.guild.create_scheduled_event(name=name, channel = channel, start_time = time, description = reason, entity_type = 'external')
Sorry for the large message
Need to see code
@vale wing thanks for the help i appreciate it. my other cmds now work
full?
i guess
it has buttons , select menus etc , with a better and easier way
Yeah error is discord.colour.hex#00FFFF(), just put 0x00ffff instead of that
but is dpy 2.0 discontinued aswell?
ofcourse , use a fork instead
It is, but there are maintained forks
Ook thanks i asked bcs it was not showing
yes since last year august
https://pypi.org/project/disnake
https://pypi.org/project/nextcord
some popular ones
then how are buttons able to be implemented in code with dpy?
use discord-component or upgrade to v2
anything better or prefered? between disnake and nextcord
Nextcord is great to use and easy to transfer existing code to
Have u used the function for scheduled guild events yet
I’ve been bashing my head over it
ive moved to hikari , so i didnt tried anything new in discord.py forks
You haven't defined prefix, so it doesn't know what to put between {}
try reading the docs mb :p
I HAVE 😭😭
is it added on the pypi version? ill test it
hello what funny dpy/disnake discussion is going on
why should one use a fork instead of 1.7.3 + 3rd party lib for components
I can’t figure out entity_type argument
Probably
Here my code
https://nextcord.readthedocs.io/en/latest/api.html#nextcord.ScheduledEventEntityType
, it can either be nextcord.ScheduledEventEntityType.stage_instance or .voice or .external
u need to use the class
!d nextcord.ScheduledEventEntityType.external
The event is happening elsewhere.
Thought so
I’m such a idiot
@blissful bone pass this there
Thank u thank u my friend
There's a class
ja nje panjmaju ruski
The quality of your screenshot is very low. You should upload your code on https://paste.pythondiscord.com and send the link here.
What discord python library should I use?
disnake is the most widely used at the moment.
hey, im trying to install and use ffmpeg to play sounds in a discord bot, but no matter what I do, i keep getting error messages saying it isnt installed. does anyone know what to do?
👍
does anybody know how to give someone a specific role when they press a button?
How can I make it so you can parse a discord.Member object or just anything else as a Union if I'm correct, I've got here but unsure how to do what I mentioned.
(ctx, option = None, member: Union[discord.Member = None, ]):
why?
Have you first defined your embed before adding footers?
Function
@client.command()
async def reg(ctx, id:int = None):
if id is None or id < 1000000000 or id > 999999999:
embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
await ctx.send(embed=embed)
try:
await reg.reset_cooldown(ctx)
except:
pass
elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() is None and c.execute(f"SELECT idd FROM faceit WHERE idd = {id}").fetchone() is None:
c.execute(f"INSERT INTO faceit VALUES ({ctx.author.id}, {id}, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0)")
conn.commit()
guild = client.get_guild(930223951190298685)
calibr = guild.get_role(930354136824807434)
try:
await ctx.author.add_roles(calibr)
except:
pass
embed = discord.Embed(title='Вы успешно зарегистрировались!', color = 0xfffafa, description=f'Ваш ID в игре Standoff 2 - {id}.')
embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
await ctx.send(embed = embed)
elif c.execute(f"SELECT id FROM faceit WHERE id = {ctx.author.id}").fetchone() != None:
embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: Вы уже зарегистрированы под ID - {c.execute(f"SELECT idd FROM faceit WHERE id = {ctx.author.id}").fetchone()[0]}.')
embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
await ctx.send(embed=embed)
try:
await reg.reset_cooldown(ctx)
except:
pass
elif c.execute(f"SELECT idd FROM faceit WHERE idd = {id}").fetchone() != None:
embed = discord.Embed(title='Ошибка при регистрации!', color=0xfffafa, description=f'Причина: На данный ID уже зарегистрирован пользователь {client.get_user(c.execute(f"SELECT id FROM faceit WHERE idd = {id}").fetchone()[0])}.\nЕсли этот ID принадлежит вам, то сообщите в администрацию.')
embed.set_footer(text=f'Запросил {ctx.author}.', icon_url=ctx.author.avatar_url)
await ctx.send(embed=embed)
try:
await reg.reset_cooldown(ctx)
except:
pass
You need to define your embed. Do this by doing embed = discord.Embed(title=None, description=None)
The None can be changed as it' a placeholder for example.
Put that above before referencing.
what this line?
You can't add a footer to an embed which doesn't exist.
i'm paste a code
After your line if id is None or id <... you need to define embed as you got told.
oh,i'm stupid
hi, does anyone know why this doesnt work? the problem is that the bot is supposed to send the first embed that says you havent picked a number, the bot is supposed to send that embed when nr is None but it doesnt do anything at all.
So if I do my command ?dice but will send the first embed called error
# Gamble
@commands.command()
@commands.cooldown(rate=1, per=4)
async def dice(ctx, nr: int = None, bet: int = None):
user = ctx.author
users = await get_bank_data()
n = random.randrange(1, 6) # Where does it start and end
# Errors
error = discord.Embed(title=f"Dice_Error {frameinfo.lineno}",
description="You must pick a number between 1 and 6", color=discord.Color.orange())
high_error = discord.Embed(title=f"Dice_Error {frameinfo.lineno}",
description="The number is too high, it must be between 1 and 6",
color=discord.Color.orange())
low_error = discord.Embed(title=f" Dice_Error {frameinfo.lineno}",
description="You must pick a number between 1 and 6", color=discord.Color.orange())
# Bet Errors
bet_none_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
description="You must place a bet, ur poor fuck", color=discord.Color.orange())
low_bet_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
description="The lowest amount you can bet is 10$, bet 10$ or more. Fucking stop being poor idiot",
color=discord.Color.orange())
high_bet_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
description="You cant bet more than 10000$., u wish u had that luck huh?",
color=discord.Color.orange())
poor_bet_error = discord.Embed(title=f"Bet_Error {frameinfo.lineno}",
description="You don't have that much money in your wallet. Fun fact, u are poor",
color=discord.Color.orange())
# Win or lost
lost = discord.Embed(title=f"Sorry man, the dice landed on {n} and u lost {bet} coins", color=discord.Color.red())
win = discord.Embed(title=f"CONGRATS MF, the dice landed on {n} and u won {bet * 3} coins",
color=discord.Color.green())
print("Dice")
if nr is None: # You didn't pick a number
return await ctx.send(embed=error)
Well, you need to check first they didn't picked a number, not at the bottom.
Oh wait, it's just embed definitions, my bad.
yea....
Other commands work?
yea other commands works just fine
there is much more to do that I didnt show, I thought the rest wasnt so important to this problem
and the weird thing is that this command have worked perfect before, but it was a while ago and now it just doesnt work
And you have made changes since yes?
The only thing I can think about rn that I have changed is that I have now cleaned up the code in different files, instead of having it all in same python file
What's frameinfo.lineno may I ask?
no, it just shows the code's number in the line
Ok.
@surreal sierra is it added to bot's commands or is it inside of a cog
it is added to bot's commands
K
But in a cog?
Wait a second.
no?
It's in another file.
If you're not using a cog I mean wait..
Should it not be @client.command() or whatever your client is defined as?
Yep
Or @bot.command
Try to add self before ctx in the parameter list of the function.
They are not using cogs tho.
hello
@surreal sierra do you have global error handler set up
Then you can't move your command to a different file.
why not
!d discord.ext.commands.Bot.add_command
add_command(command)```
Adds a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") into the internal list of commands.
This is usually not called, instead the [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.command "discord.ext.commands.GroupMixin.command") or [`group()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.group "discord.ext.commands.GroupMixin.group") shortcut decorators are used instead.
Changed in version 1.4: Raise [`CommandRegistrationError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandRegistrationError "discord.ext.commands.CommandRegistrationError") instead of generic [`ClientException`](https://discordpy.readthedocs.io/en/master/api.html#discord.ClientException "discord.ClientException")
I had that first, but it just gave me errors, I have it in different files like u see here. The command is in casino.py and I have added all commands to the bot
im trying to download a video using youtube_dl but i cant install ffmpeg. does anyone know what to do? thanks :))
F
!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)
dude , just use cogs instead of that
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
^
I'm confused. My Bot has a "kick" command in a cog and a error handler for permissions, .. I just started it and why does it send the error message TWICE. I even made a print in the error handler and it did only trigger 1 time
you have the bot running twice maybe
I've reset the token too
Most likely you just have another handler
The on_message event is not even in my code :/, couldnt find a duplicated handler
can you show the error handler code?
@commands.Cog.listener()
async def on_command_error(self,ctx, error):
if isinstance(error, commands.CommandNotFound):
return await self.create_embed(ctx,f"Couldn't fint the chosen Command","Missing Permissions")
if isinstance(error, commands.MissingPermissions):
return await self.create_embed(ctx,f"You don't have enough permissions","Missing Permissions")
if isinstance(error,commands.BotMissingPermissions):
return await self.create_embed(ctx,f"The Bot needs the **{', '.join(error.missing_perms)}** Permissions","Missing Permissions")
print(error)
