#discord-bots
1 messages Β· Page 1006 of 1
@bot.command()
@slate swan
Np bro
ok so
send ss
@bot.command()
@commands.has_permissions(administrator=True)
async def clear(ctx, amount: int):
await ctx.channel.purge(limit = amount)
await ctx.send(f"Suscessfuly deleted {amount}")
@flat solstice u been typing for a wile everything good??
So I set a lot of my embed colours very dynamically, take this voice state update event for example```py
@Cog.listener()
async def on_voice_state_update(
self, member: Member, before: VoiceState, after: VoiceState
):
embed = Embed(timestamp=datetime.utcnow())
if before.channel is None: # Example of a positive log
embed.colour = Colour.dark_teal()
if after.channel is None: # Example of a negative log
embed.colour = Colour.dark_magenta()
yeah had to grab some examples and then reformat them, fun stuff right
alr cool man
Sorry man i can not help you with this one i am not familier with the packages u r using!
it's just standard discord.py but cool, thanks for taking a look
No problem bro i will have another look to see if i missed anything
Yeah bro I'm so sorry that I cannot help you, please forgive me.
np
thanks
Do you have anything else i might can help with?
U got a rough example of what ur talking abt?
If you mean transfer the on_voice_state thingy into an class that subclasses discord.Embed then no
You'd Have to subclass Cog and I think that's a global listener so having multiple of it across different classes might be problematic
yeah, I have this 'basse' class for all of my log embeds which ensures they all have a timestamp even if i don't declare it, I'm thinking of subclassing embed again and doing a similar thing but for the colourpy class LogEmbed(Embed): def __init__(self, *args, **kwargs): if "timestamp" not in kwargs: kwargs["timestamp"] = datetime.utcnow() super().__init__(*args, **kwargs)
but since, as seen in my previous example, I set the embeds colour so dynamically I'm not sure if it's possible, or even worth it, to make something likepy class PositiveLog(Embed): def __init__(self, *args, **kwargs): if "colour" not in kwargs: kwargs["colour"] = Colour.dark_teal() super().__init__(*args, **kwargs)
these answer your questions/concerns
Hi everyone how is today?
yeah I'm doing good today, how about you
im alr
I'm trying to code a discord bot with discord_slash library for Slash Commands. I want the bot's slash commands to work on any guild that it is in. How do I do this without needing the guild id?
If someone where to add my bot to their server, it wouldn't work unless the id was added to the code, which isn't ideal, the bot should just work when added.
Or is there a client event that can be configured for when the bot joins a new server, and I can modify my guild_ids array?
I can help you but i would have to use the disnake lib
To make /commands in every server.
Discord.py (v2.0) supports slash commands now.
I would recommend checking it out.
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.
What is UserWarning
It sends the same thing, but twice
Why don't use ctx.author?
Just use ctx.author
is there a way to either have a task wait until the previous iteration is finished or have more than one iterations go at the same time?
LoL
Maybe coz you have defined two embed with same name and yeah if it works it will send 2 embeds that the user was banned @slate swan
Maybe You Can Send The Another Embed To The user who was banned
Hey sorry just got back. Did you get through?
ohh
Nope I didn't get any further responses from anyone after I replied to you
Yea that makes sense I've been doing something similar
But shouldn't PositiveLog work fine?
This looks fine though
Try Using The Command
If Any Error Then Get Back To Us
Did You Try?
Show The Ss Where Your Code Is @slate swan
@slate swan remove the name='ban'
Yes
This should work fine m8 if you want to inherit the timestamp thingy you added just inherit LogEmbed instead of discord.Embed ya dig
pls don't past my code in python server
Wait What
π€£ π€£ π€£ π€£
Need proof??
π since I can't add reactions
No its not the area of judge 
Anyways he is my friend and all i ask is for him not to send it
Ohk
no no I just found it funny
No Need
btw in the future it's good to add a quick try/except block to catch when member.ban throws a HTTPException or anything
lmao what
Can someone help me setup a auto recover
Any reason this beats discord_slash?
discord_slash doesnβt support discord.py v2 iirc so it will be outdated soon
Will it break old bots?
Or just not support newer functionality
The latter

Gotcha
is there something weird going on with prefix commands ?
Faster, more optimized, less resources required to run it, and more supported.
none for me
or are you asking about a certain bot?
weird... I reset the bot token and re-added and then the command starts working again. before that it kept saying message content intent wasn't enabled (despite working for months)
just wondering if they made message intent not available by default or smth
You will probably have to manually add the intent
Once you do so, you can verify by running the bot & seeing or printing dict(Bot.intents)
discord.py version?
disnake 2.5.0a4185+geaf04e49 lol
at least that's what pip list says
just wondering if they made message intent not available by default or smth
It wouldn't make sense to default the intent, this is becauseMESSAGE_CONTENTintent is privlleged
Discord itself just hasn't started enforcing it yet
they're disabled by default
Yo greyblue92 in discord bots
hey guys out of curiosity i was wondering if the python discord bot is made from discord.py
Yes
It's made with discord.py
cool
Also there are some forks like disnake
it would be pretty funny if it was made with discord.js or something
use it for objects, they is for humans
it's
he said python discord bot 
and yes, we use discord.py though briefly we were on disnake until dpy's unarchival
i mean they are only mentioning the python bot
ah ok
anyone here know anything about remote connections and stuff with python
no, not rlly sorry
U can ask on #python-discussion
neither do i but im trying to make a chat room thing
i made a help but it seems i am being ignored
I think that question is suitable for #networks
ok thanks
hi
or they just don't know how to help you
Ok π
thats more likely cokecane
You should be checking out websockets then
https://datatracker.ietf.org/doc/html/rfc6455 Heres a good read
The WebSocket Protocol (RFC 6455)
thats ipc stuff right
are websockets and sockets the same?
seockets?
Skev come #ot2-never-nesterβs-nightmare
k
yes i know
ok then
i was wondering who steve was
There is a decent amount of difference, which is mostly out of scope here so I once again, recommend reading the RFC https://datatracker.ietf.org/doc/html/rfc6455
The WebSocket Protocol (RFC 6455)
Auto correct
I see
who is good with python
i like to think i am but in reality i havent used it in a while
whats your question
yeah no i have no idea lol
im mainly only good with discord.py or just random basic stuff
What i want is like how dank memer it would say "you got a alert by the devs type pls alert to read it" how do i do that
how to add 2 numbers
ans = num1 + num2
or first buy a computer, then install python
like how exactly dank memer does it?
if that doesnt work throw some parentheses somewhere in it
.kinda
or are you going to send that message to their dms
num1 not defined
yh
num1 = 1 num2 = 2
you could have a database with everyone's info and have piece of data called SeenAlert that's a boolean and just have that be False every time you make the global alert message
how i do that?
is it possible to do neural networks in python
if it's false then show the message then when they see the message make it true
thanks
can u help me out with thee code

and just don't show the message for anyone in the database that has the bool as True
Surprisingly a lot of neural network & data-science is done in python
i got no idea wat u mean
Considering the speed of python after all
you know what python is missing? the ability to auto declare stuff set in environment variable.. i think php actually has that
interesting
it is the most recommended language for data science and neural networks
as i've been told
speed π
I guess the speed is negligible then?
Bruh that was a joke
I mean, if your data set is that large anyways you will probably be using some cudas
so can somone help me i need sleep soon
its ok, so was that
i gave you the idea work with it
huh
you already have a idea on how it works
not rlly lol
now you just have to code the logic behind that idea
it's just a boolean that does different things based on what's if it's true and false
ok
I'm not sure about disnake 
no worries, it was just curiosity more than anything - thanks :)
yes
Quick example?
class NewInteraction(disnake.Interaction):
async def send(self, defer, **kwargs):
if defer:
await self.response.defer()
await self.response.send_message(**kwargs)
disnake.Interaction = NewInteraction
hi
hello sparky
hello π
gtg classes
Here the functionality of the current disnake.interaction would be gone though right
hey raven π
no
Subclassing copies all the inherited class's objects into the new class (unless you overwrite them in the new class)
im in past
Also, what the best way to stop the bot from running
bot.close()? I don't really know
await bot.logout() should work
Disnake?
am i able to do this? async self.api.start_loop()
bc i keep on geting SyntaxError: invalid syntax
what's that for
await self.api.start_loop(), async is for creating async functions
how do i set views work only 1 time
oooo ok
disable it after receiving a response
docs pls
wait
use interaction_check, check if the view has been used before
so i will need py async def api(): await self.api.start_loop()???
Don't think it's there, not documented
example pls?
idk whats self.api?
Do you still want the program to continue?
It's for a library don't worry about that part
that method has been renamed to close I think
Nope
yes
I haven't been coding bots for a while 
exit() should also work
Okay yeah you're right
class MyView(View):
used = False
async def interaction_check(self, interaction):
if hasattr(self, 'msg') and self.used:
for item in self.children:
item.disabled = True # what hello said earlier
await self.msg.edit(view=self)
@button(label='yo')
async def yo(self, ...):
self.used = True
view = MyView()
view.msg = ...
okay
class DiscordListsPost(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.api = discordlists.Client(self.bot) # Create a Client instance
self.api.set_auth("top.gg", "token") # Set authorisation token for a bot list
async def func():
await self.api.start_loop()``` I know this isn't right so could someone help me out?
the api function is overwriting the api attribute, doing await self.api would call the method
so just this?
no, you can't await inside an normal method do ```py
async def start(self):
await self.api.start_loop()
cls = DiscordListsPost(bot)
await cls.start() # this must be inside an async function
define the embed variable before sending it, put the embed = ... above the ctx.send(embed=embed)
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: too many values to unpack (expected 1)
(BAD AT JSON)
a = discord.Embed(title="Hi")
code
new_dict = [message.id] = list
logs1.update(new_dict)
show full error
Ignoring exception in command g:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\core.py", line 169, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\hp\Desktop\bot\giveaway.py", line 143, in giveaway
new_dict = [message.id] = list
ValueError: too many values to unpack (expected 1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\bot_base.py", line
570, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\core.py", line 920, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\commands\core.py", line 178, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: too many values to unpack (expected 1)
you can't do that
what're you tryna do
im trying to put value a list
new_dict = [message.id] does that already
H?
h?
put embed = discord.Embed(title='Help !', description=f'Les commandes enregistrΓ© sont :') above await ctx.send(embed=embed)
im trying to do
logs1[message.id] = list
but this doesnt work
ryuga suggest me to use update
so
what's the list anyways
if b == 1:
list = [newDate,b11,a11,winlimit]
else:
list = [newDate,winlimit]
str int and all
1st str then all int
that would work if logs1 is a dictionary
logs1 is json
with open("giveawaytime.json", "w") as f:
json.dump(logs1, f)
why do list and not [] though
with open("giveawaytime.json") as f:
logs1 = json.load(f)
for loading
for dumping
wdym?
bro
put that embed var above ctx.send
embed has to be above await ctx.send(embed=embed)
SyntaxError: 'await' outside async function (api.py, line 22)
anyone
this
await can only be used in async functions
so async await self.api.start_loop()
try it out
SyntaxError: invalid syntax (api.py, line 22)
so
class DiscordListsPost(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.api = discordlists.Client(self.bot) # Create a Client instance
self.api.set_auth("top.gg", "token") # Set authorisation token for a bot list
async def func():
await self.api.start_loop()```
iirc when your bot gets verified
π₯²
but no, hunter doesnt have it
you can't get it anylonger
that used to be a thing like 1.5yrs ago l
π₯²
oh yeah
that guy didnt know how to code and he has that badhe
"early" verified developer badge
idk why im making bots
too much free time to kill?
@sly hamlet which lauguage do u code before python
in the start, they didn't check your bot while whitelisting, it just simply needs to be in 75 servers thats it
πΆ
imagine having that badhe
flex
Java?
!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
The same way everyone else got it when it first came out
pfffttt, why're you making such a big deal out of it?
sad life
π₯²
anyone
anyways, what would go Better with a help command? a paginated view with cogs embeds or a select menu with cogs options?
select menu
now I regret opening echo bot's dashboard
..
select menu, pages are kinda weird to use
mhm true
i mean mix
like moderation menu
i initially made it like r danny's help command
and utility menu
AttributeError: 'Bot' object has no attribute 'slash_command'. Did you mean: 'add_command'?
tf is this
you can select different categories from the select menu and not go through every page looking for the specific options like a paginator
which library?
oh hm, that makes more sense
pycord
πΆ
from universe import pycord , discord
pycord + discord = "discord.py"
never used pycord so uhh
eito help me
anyone
what the hell is this
idk
trash code :b
you are already putting the message id in the list, and setting it to a list again*
plus you are updating the json file with a list instead of a dictionary
uh how do i fix it
show your code again
with some more lines
ill tell u what i want to do
logs1[message.id] = list
with open("giveawaytime.json", "w") as f:
json.dump(logs1, f)
something like that
logs1 is?
and what is message.id?
since its an integer and json cant have integer keys
with open("giveawaytime.json") as f:
logs1 = json.load(f)
it store as str
then typecast the message.id to an str first, then set a valid value for that and not a data type object
wdym by valid value?
did you define list as a variable ?
ye
uh why?
is it when you read the data or try to insert?
dumping(insert)
try changing the var name from list to something else and print it before dumping
uh ok
imagine
IMAGINE
It would overwrite the built in
LIST CLASS
TF
@slate swan btw there is no need to change that to str
it auto change it to str
change the list too, and nice indents
doesnt do that for me at least, but okay
very
hm understandable
still....an average person got 4 spaces as indents so....
im not an average person π
imagine error
json.decoder.JSONDecodeError: Expecting value: line 1 column 25 (char 24)

@slate swan
... π
huh
i thought u r calling me.. nvm
eito's here, he will help you
CHANGE UR NAM
Show json data
HE*
Problem in there
{"968715269822369803": [
that's all?
ye
a json is expected to have some value.. what is the value it? lmao a list? not even closed..
and it is also expected to have curly brackets on both the "ends"
can ya just come vc? lmao π i'm feeling lazy to text today
wait
ok
let me wear my headphones
tell me the languages that u know lmao
ok say something
more words
π
that feeling when I joined the vc and you both left
π i'm so sorry
we in DM call rn :'/
nah its okay, but the timing was just too right lmao
um hi
π oh gawd
um hello
π
Lmao
send an ss of your json file if there isnt any private stuff in there
Wait
mhm
back @slate swan @slate swan
{"968715269822369803": [
You need to close the brackets
wdym by closing brackets
yes, Your Highness.
wait
shit that recorder only record games
json before
json after
cuz of
logs1[message.id] = noobvar
with open("giveawaytime.json", "w") as f:
json.dump(logs1, f)
OK?
so close those brackets and try again
wait
its not by default
this code run and
what was in your list again? and what was the datatype of those?
this happend and throw the error
str int int int
hm ic
let me print the list real quick
sure
IMAGINE
[datetime.datetime(2022, 4, 27, 10, 23, 29, 165235), 1, 1, 3]
let me change it to str
nvmd i solved my error by myself
lmao
π
sheesh
@slate swan amazing asuna pfp π
thanks
I know that thanks looks awkward but thats all i have
question, anyone know how I could play music from a soundcloud link?
iirc you cant, and it would break their TOS most probably if you did
IIRC sc allows streaming music
You can, but breaches their terms of service
There is almost no streaming platform allowing such things
How is it breaking tos if it has an option to download tracks directly on the site?
Those who allow it are most likely not so big and their music choice is small
There is a difference between user interaction and automating things
true.
Just like website scraping most likely is against terms of services of multiple platform
Yet the data you get is the same you could get with a normal user
only if you have a license
it says it's legal if it's used for personal use.
And where
Also, Discord bots is not personal use so yeah
That would already be a no go
not if its just me int he server?
Then how about using their actual player
(iii) You must not use any Content (other than Your Content) in any way that is designed to create a separate content service or that replicates any part of the Platform offering. (iv) You must not employ scraping or similar techniques to aggregate, repurpose, republish or otherwise make use of any Content.
to create any kind of alternative digital content service, including: any service that aggregates and streams User Content from multiple users into an on-demand listening service, or any playback experience which aggregates and streams User Content with content from other service
Ah I see,
For me SoundCloud's stance is just like YouTube - ask them directly if you're unsure
how
any idea why my commands don't work? it loads all the cogs and all but commands work (2.0)
Im new to discord.py 2.0 so I don't know if im doing something wrong
show the cmd?
all cmds don't work
Pretty sure they have a contact email and/or form
Do you have an on_message event? @midnight gorge
if any service allowed doing that, it would shut down since it would bypass the ads and people would make seperate applications which queried the api and played songs from there as a result depriving the organization of ad revenue
nice?
no
use buttons, they are easier to click
(wrong timestamp)
no reactions look better
yeah buttons would be more uwu
Then without code and potential errors we can't make a guess, we also can't see your screen to get this information manually 
for that i need to save and all + in reaction u can simply leave the giveaway by unreacting
any kind of webscrapping / automation is against their Tos
true, reactions are better now that I think of it
Actually you should more likely take a look at the API terms
Which has
to create any kind of alternative digital content service, including: any service that aggregates and streams User Content from multiple users into an on-demand listening service, or any playback experience which aggregates and streams User Content with content from other service
In its "do not" list
mm yeah i was looking the general tos
why this returns Nonetype?
msg = self.bot.get_message(id)
with valid id
Message is not in cache
oh ye
m = get_message() or await fetch_message()
okay
thanks :D
Or if you use a different library it might have something like getch_message
getch
i use disnake π
disnake only has getch_user iirc
Yeah it doesn't have getch_message
who's?
its a TextChannel method
It does
It's not on bot
..
It should be done on a channel like object
i dont have channel but :<
!d disnake.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://docs.disnake.dev/en/latest/api.html#disnake.Message "disnake.Message") from the destination.
SoundCloud, and most music streaming services
~do i need channel for that ? thats the only way?
Yes
uh
what library are you using?
disnake π
!d disnake.Client.get_message
get_message(id)```
Gets the message with the given ID from the botβs message cache.
If you have a Context object you can use it on that one
doesnt work
you just need the id
no cache
There is caching issues
ohh
Read above....
well then fetch it?
Read again above
lol
hi, am a disnake dev.
The reason getch_user can exist is because getting the user from cache and fetching the user from the api both require only the user ID
In the case of Messages, those are stored in the cache by message ID. But to fetch them, the channel ID is also required. For this reason, we (or anyone else) are unable to make a reliable getch_message method.
Literally repeating 
maybe store the channel id with the message id or if you have a better way
do you have the channel id?
ye im doing that
Brave Browser π
Yeah, the methods themselves are self-explanatory about why that wouldn't work
ok (i did that 1 ping )
you said it here, and I wanted to clarify why no one else has it
Ok
Oh hi arl
hello hunter
ez
noobvar = [str(newDate),b11,a11,winlimit,message.channel.id]
;-;
now i need to add it all over
I found a race condition in interaction responses last week @maiden fable
Cool
all dpy based libraries are affected unless they already patched it
O
Hi, friends!
BTW did u think bout the views thing? @vast gale
what views thing
hm just fetch it with the http then ```py
msg = await bot.http.get_message(channel_id, message_id)
@vast gale Has no roles!, Yay
weird how they named it get, even tho its an api get request
Making Select.values return SelectOption instances
Shouldn't always make API calls either way
ok
that won't be a full message instance
self.bot.fetch_channel(channel).fetch_message(id)
No
!d disnake.PartialMessageable
class disnake.PartialMessageable```
Represents a partial messageable to aid with working messageable channels when only a channel ID is present.
The only way to construct this class is through [`Client.get_partial_messageable()`](https://docs.disnake.dev/en/latest/api.html#disnake.Client.get_partial_messageable "disnake.Client.get_partial_messageable").
Note that this class is trimmed down and has no rich attributes.
New in version 2.0...
why
Because cache exists and has a clear use
using the http client is undocumented and could change at any time
that sucks 
Hi!
It is you again
if you want a message from just a channel id and message ID you can use an annoying chain of code that should have a way to simplify it but uh
π
message = await bot.get_partial_messageable(channel_id).fetch_message(message_id)
gimme a minute
well as many people already told ```py
get the channel
c = bot.get_channel(c_id)
#and fetch the message
msg= await c.fetch_message(id)
okay so get_channel relies on the cache, but if the cache doesn't exist then you would want to use get_partial_messageable
lol
nvmd
):
alr
inarguable
guess who i am?
]
uh
i thought eito changed his name again
someone who failed to copy the actual avatar
lemme fix thatt lol
lol
Please change your nickname and display avatar back to normal
who else
i have not added that
if someone deletes the channel or msg ;-; its pain
the future of this world
Hi
hey sparky
Hey
bro, why?
huh?
woah a jet plane just fly above my house
nice
heyo
hi
stop
me
yes
ok
!ot and grow up :exit:
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
change ur nick
I, uhhh, stop spamming u both
- pfp
no sorry
ill spam ur dms
@slate swan @eager bough ??
And the other is Krypton
lmaoo
do it! π
no lol
!mute 857785190625181698 π
:incoming_envelope: :ok_hand: applied mute to @eager bough until <t:1651038084:f> (59 minutes and 59 seconds).
thanks :D
Who then?
lmao
DeepSleepMusic
we'd rather you let us know
alr
just some random person, having bot dev badge doesn't mean its Krypton π
lol
they have bot dev badge?
Hey guys! Did something change with Discord's Embeds? I can't use them for some reason.. It doesn't give me an error but the message is not being sent..
I have checked everything. Using Discord.py 2.0 btw
apparently yeah
who
Didn't see he had a bot dev badge
Was just a random guess
so if you use get_channel, that relies on the cache. Using get_partial_messageable will always give you a channel to work with, whether it exists or not.
From these, you can use fetch_message()
Using that, you can limit it to just a single api request to determine the following
- the channel exists and you have access
- the message exists and you can read it
Show code
nope, embeds are still same
strange..
wo
give me a sec
π€
also i can provide more help in discord.gg/disnake if you want it @slate swan
Mb mb

the server's help channels are dead
Wouldn't that count towards intentionally advertising another server
that server is specifically for disnake help, and there would be other core devs to help you out if they miss out
uwu
@blissful lagoon
@bot.command()
async def banner(ctx, user: discord.Member = None):
if user != None:
try:
user = await bot.fetch_user(user.id)
except:
pass
try:
banner = user.banner.url
embed = discord.Embed(title="Banner", color=0x2c2f33)
embed.set_image(url=banner)
embed.set_author(name=f"{user}",
url=f"https://discord.com/users/{user.id}",
icon_url=f"{user.display_avatar}")
await ctx.send(embed=embed)
except:
await ctx.send(
f"{ctx.author.mention} this user does not have a banner.",
delete_after=15)
:<
owo
stop
it worked before but not anymore I don't get it..
@blissful lagoon he's back
!mute 690812216009818112 π
:incoming_envelope: :ok_hand: applied mute to @plucky swan until <t:1651038386:f> (59 minutes and 59 seconds).
:(
Wrong one

um how about getting back to topic
do you have an error handler?
on_error/on_command_error event
why ppl bullying me :<
That's eating all the errors
hi
Wait a sec I think I found the problem..
not again
!mute 853271972657758228 π
:incoming_envelope: :ok_hand: applied mute to @fierce sand until <t:1651038581:f> (59 minutes and 59 seconds).
ban
icon_url in set_author needs to be a url not an Asset
he will come back >:(
the error can be UserNotFound too
on the off-chance that this isnt the same person: stop or we're going to assume you are
tldr the bots we use in disnake to provide support aren't here
How can I connect to a voice channel?
πΆ
!d discord.VoiceChannel.connect
await connect(*, timeout=60.0, reconnect=True, cls=..., self_deaf=False, self_mute=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish
your connection to the voice server.
This requires [`voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
im guessing ctx.voice_client is deprecated now
no, it's still there
why? @slate swan
why jets are flying above my home
you from ukraine?
just curious
voice_client.play deprecated?
no india
play(source, *, after=None)```
Plays an [`AudioSource`](https://discordpy.readthedocs.io/en/master/api.html#discord.AudioSource "discord.AudioSource").
The finalizer, `after` is called after the source has been exhausted
or an error occurred.
If an error happens while the audio player is running, the exception is
caught and the audio player is then stopped. If no after callback is
passed, any caught exception will be displayed as if it were raised.
still there lol
ded chat
poster/banner for my discord bot 
that looks awesome
TypeError: 'ReactionIterator' object is not iterable
Thanks sifte 
code
Game and a.... discord bot?
dsd = [users.id for reaction in msg.reactions if reaction.emoji == '\U0001f389' for users in reaction.users() if option == 1 for i in await msg.guild.invites() if i.inviter == users and i.uses < number]
ah
Uh
uhhh
Sparky?
Yes, runs about 1-4 FPS depending on how fast you click
full error with traceback?
uh wait
@slate swan can u use a simple for loop and see which line is erroring out?
@vast gale not documented?
um wait ill share full traceback
who what where
async for users in await reaction.users()
async for *
Unhandled exception in internal background task 'timer'.
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38\lib\site-packages\disnake\ext\tasks\__init__.py", line 157, in _loop
await self.coro(*args, **kwargs)
File "c:\Users\hp\Desktop\bot\giveaway.py", line 46, in timer
await self.endgiv(keys,a[1],a[2],a[3],a[4])
File "c:\Users\hp\Desktop\bot\giveaway.py", line 18, in endgiv
dsd = [users.id for reaction in msg.reactions if reaction.emoji == '\U0001f389' for users in reaction.users() if
option == 1 for i in await msg.guild.invites() if i.inviter == users and i.uses < number]
File "c:\Users\hp\Desktop\bot\giveaway.py", line 18, in <listcomp>
dsd = [users.id for reaction in msg.reactions if reaction.emoji == '\U0001f389' for users in reaction.users() if
option == 1 for i in await msg.guild.invites() if i.inviter == users and i.uses < number]
TypeError: 'ReactionIterator' object is not iterable
Isn't it the same as the AsyncIterator that is documented?
ok
prolly
How to make this output shows in single line only?
if i["address"] in self.currently_down:
downtime = str(timedelta(seconds=self.currently_down[i["address"]]))
embed.add_field(
name=f"{i['name']} ({i['type']})",
value=f":red_circle: {i['address']} ({downtime})",
inline=False,
)
else:
embed.add_field(
name=f"{i['name']} ({i['type']})",
value=f":green_circle: {i['address']}",
inline=False,
)
await ctx.send(embed=embed) ```
pretty sure no iterators are documented except for AsyncIterator
Yeah that's the only one
I think what you're asking would be adding two fields and making the value of both an empty string
And have them inline
name and value will always be in different lines
any other way so they can be in the same line?
nope
you cant do that
use the embed description
oh yeah do that
Or two fields inline...
and use the bold styling
erk... thats gonna make me sad... 
?
Fields appear on the same line so you put half on the first and half on the second
Then make the value an empty string
you could use the embed description
i'll try
@bot.slash_command(guild_ids=[961585785226821703])
async def joined(ctx, member: discord.Member = None):
user = member or ctx.author
await ctx.respond(f"{user.name} ist beigetreten am / um : {discord.utils.format_dt(user.joined_at)}\r\n"
f"Account erstellt am : {discord.utils.format_dt(user.created_at)}")
pycord before anyone is asking...
Whats wrong
no errors but its not working
π
hey can someone help me with this, for some reason im only able to get the output from the reaction by the person who sent the message below is my code
`usernames = []
@bot.command()
async def e(ctx, user, reaction):
tick = 'β
'
user.author.id
i = len(users)
message = await ctx.send("input field")
await message.add_reaction(tick)
def check(reaction, user):
return user == ctx.author and str(
reaction.emoji) in [tick]
while True:
reaction, user = await bot.wait_for("reaction_add", check=check)
if (str(reaction.emoji) == tick):
user_data = ctx.author.id
await ctx.send(f"add user id {user_data}")
if user_data not in usernames:
usernames.append(user_data)
await ctx.send(usernames)
print(usernames)`
error?
back
How to make sure that the author's message is not deleted and he reply
example:
idt it's possible
with purge
I don't understand a little
can you edit my code?
@bot.command(aliases=["ΠΎΡΠΈΡΡΠΈΡΡ"])
@commands.has_permissions( administrator = True, manage_messages = True )
async def clear(ctx, amount: int=None):
emb = discord.Embed( title = 'Clear', colour = discord.Color.light_grey() )
await ctx.channel.purge(limit=int(amount))
emb.add_field( name = 'Cleared messages :', value = amount )
emb.set_footer( text = 'Channel was cleared administrator {}'.format( ctx.author.name ), icon_url = ctx.author.avatar_url )
await ctx.send( embed = emb )
No need to use int(amount) just use amount
And we don't edit code for you, what do you want to get and what do you have right now?
I have a working cleanup code
but i want it not to delete the author's post
and answered it
Hey im having an issue with my bot not responding to messages, but everything looks fine on the code end and the dev portal end, would I ask here?
Yes
Add a check to compare the message ID
See the documentation for an example for a check
!d disnake.TextChannel.purge
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have [`manage_messages`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_messages "disnake.Permissions.manage_messages") permission to delete messages even if they are your own. [`read_message_history`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.read_message_history "disnake.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting botβs messages...
thx
what need past at check?
check=......
needs to be a function which takes message as an argument
def check(msg: discord.Message):
return <condition>``` or simply a lambda function ```py
check = lambda msg: <condition>
Ok so basically I've been having this weird issue where my bot wont work with commands anymore, just client events. Not only that but I've also reset the token (changed it in code as well) and un-invited and re-invited the bot to the server, no luck. I've checked for residual python processes on my computer and nothing popped out that was suspicious. I also restarted PC and IDE. Do note: The bot stopped working after a 24 hour active time total and 1 PC shutdown.
wait, so, you didnt anything to your bot and it just stopped working out of the blue
Mhm.
I fixed it, a command was having issues and console didnt tell me
what library are you using
& did you recently update
I fixed it, one of the commands was having an issue and the debugger didnt tell me
excercise1='a'
excercise2='b'
excercise3='c'
Use_for = excercise1 or excercise2 or excercise3
excercise="".join(random.sample(Use_for))
@client.event
async def on_message(message):
embed = discord.Embed(
title="**__Random Excercise:__**",
description=(excercise),
color=0x260af3)
embed.set_thumbnail(
url="https://cdn.discordapp.com/attachments/968378382595272714/968754973217263646/unknown.png")
if message.content.startswith('.excercise'):
await message.channel.send(embed=embed)
Error:
ine 62, in <module>
excercise="".join(random.sample(Use_for))
TypeError: Random.sample() missing 1 required positional argument: 'k'
what to do?
What tutorial did you find it in
I have seen same dumb code yesterday
What the hell are you even trying to do
I took only the beginning, everything else is by myself
Please answer my question I wanna find that tutorial and invalidate it
and it work
Even the code style is bad
i want it to generate a random "excercise"
second
!d random.choice
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
!e
import random
a = ["yes", "no", "hohoho"]
print(random.choice(a))```
@vale wing :white_check_mark: Your eval job has completed with return code 0.
hohoho
check dm
can random only be used with numbers?
choice can be used with any sequence
a ok
made a few changes, code looks like this:
excercise1='a'
excercise2='b'
excercise3='c'
Use_for = [excercise1,excercise2,excercise3]
excercise=(random.choice(Use_for))
@client.event
async def on_message(message):
embed = discord.Embed(
title="**__Random Excercise:__**",
description=(excercise),
color=0x260af3)
embed.set_thumbnail(
url="https://cdn.discordapp.com/attachments/968378382595272714/968754973217263646/unknown.png")
if message.content.startswith('.excercise'):
await message.channel.send(embed=embed)
no errors
Oh god why make a list of variables
use_for = ["a", "b", "c"]```
im gonan replace those variables with bigger texts
And yeah you should probably learn other way of making commands
Idek what tutorial to recommend
It can't always reply with a
always
Oh hold up
@crimson compass you need to call random.choice every time you want a new value
In your code you call it only once
oh
where else should i call it
In your event that gets executed every time
In your on_message ofc but for god's sake don't make commands like this
bot = commands.Bot(command_prefix=".")
@bot.command()
async def exercise(ctx):
...```
They have a good guide
Which explains different things in more details than copying
I could only recommend https://tutorial.vcokltfre.dev but it is about forks
A tutorial to help you make better Discord bots.
Hi, I have the following code in my on_ready event, but the bot still doesn't change presence when I start it, why? ```py
await client.change_presence(
activity = discord.Activity(name = "this is the name",
url = "https://replit.com",
type = discord.ActivityType.custom,
state = "this is the state",
details = "this is the details",
timestamps = {"start": 1650430240, "end": 1681966240},),
status = discord.Status.idle
)
It change to idle mode, but not the activity.
import discord
from discord import app_commands
from discord.ext import commands
class Test(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
super().__init__()
@app_commands.command(name="nab")
async def nab(self, interaction: discord.Interaction) -> None:
await interaction.response.send_message("Hello", ephemeral=True)
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(Test(bot))
How to sync this bruh
bot.tree.sync(guild=...)
@random yacht_commands need to be synced using that?
import discord
from discord import app_commands
from discord.ext import commands
class Test(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
super().__init__()
@app_commands.command(name="nab")
async def nab(self, interaction: discord.Interaction) -> None:
await interaction.response.send_message("Hello", ephemeral=True)
@commands.command()
@commands.is_owner()
async def sync(self, ctx):
await self.bot.tree.sync(guild=927234027277135923)
await ctx.reply("Done")
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(Test(bot))
this works?
every discord.Object is just a class with an ID inside of it
Hi, why doesn't this come up as a game on my bot when I run it? ```py
await client.change_presence(
activity = discord.Activity(name = "this is the name",
url = "https://replit.com",
type = discord.ActivityType.watching,
state = "this is the state",
details = "this is the details",
),
status = discord.Status.idle
)
!d discord.Object
class discord.Object(id)```
Represents a generic Discord object.
The purpose of this class is to allow you to create βminiatureβ
versions of data classes if you want to pass in just an ID. Most functions
that take in a specific data class with an ID can also take in this class
as a substitute instead. Note that even though this is the case, not all
objects (if any) actually inherit from this class...
oh
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50001): Missing Access
uh
The bot has admin perms but it shows this error
It is missing access to the resource
I assume the bot can't create slash commands in that guild ID or it simply is not in the guild you're trying to create commands in.
done and now it synced successfully but commands arent showing up
Hello, my discord bot has some problems setting a custom status.
Here is the code:```py
client = commands.Bot(intents = discord.Intents().all(),
activity = discord.Activity(name = "this is the name",
url = "https://replit.com",
type = discord.ActivityType.watching,
state = "this is the state",
details = "this is the details"),
status = discord.Status.idle)
and here is the result:
Shouldn't it say something about "this is the state", "this is the details" and "https://replit.com". Also, why isn't it in IDLE?

rich presence doesnt work for bot apps
^
Same for custom status like users, you can see it here for more information https://github.com/discord/discord-api-docs/issues/1160#issuecomment-546549516
So what can a bot have in it's status? Just a name and a type?
type, name, status
nah ive seen it before with a game somehow
and url
coded in python
you sure?
yes.
because it works
ehhh anythings possible but i couldnt tell you it somehow was
No it's not, the API blocks you from doing it
damn that sucks i saw it π
Imagine that guy hacked API π³
unless its add to server no
then he would be pro π³
Very
From https://stackoverflow.com/questions/59126137/how-to-change-discord-py-bot-activity
# Setting `Playing ` status
await bot.change_presence(activity=discord.Game(name="a game"))
# Setting `Streaming ` status
await bot.change_presence(activity=discord.Streaming(name="My Stream", url="my_twitch_url"))
# Setting `Listening ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="a song"))
# Setting `Watching ` status
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="a movie"))
just make sure to define "my_twich_url"
that i dont know but, you also have to experiment for urself lol
Can normal users have buttons in their status?
Yes
Yes
how
Not related to Discord bots, however you can use libraries such as pypresence etc.
rich presence
!pypi pypresence
youtube ig
Is that for discord bots or for users?
youtube doesn't have any relation to discord-
Use logic
users (since bots dont have rich presence)
Users, as you asked
imports
I can proudly say I never watched a single youtube tutorial about python programming π
i tried it sucked lmao, i basically went to the end and skidded the code π it didnt work either
π€
but im pretty new to discord.py but picking up on it quickly
why do i get this error?
If you know Python, you know how to read a documentation and errors, discord.py is not rocket science
Show the entire error so that people can help
lotta lines man
thats the discord's internals
nah really?
yeah
dang i knew that lol
...
πΏ
tbh discord.py and related forks have one of the best documentations i've ever seen
How do you define embed
django has better docs
and the forks have good docs cz dpy have those
I still can't figure out wth is django for but this is not bot related so yes
Websites
me who still cant find differences between Flask and FASTAPI
Dude π
Flask and FastAPI are nowhere close
facebook too
Ik
There are lots, Instagram and Spotify are also with Django
It's supposed to be something deeper
facebook is a mix of languages
nvm, fastapi just saves time anyways
Never knew
they've even made a compiler for PHP to run it faster
Let's stop this before we get warned
lets go finally got my anti spam to work
How
checking for consequent message, i'd guess
Yes i know
I just like seeing how people fixed their problems
I have AI antispam π
Sadly I'll have to shutdown it soon because no hosting service
How did you install discord.py
pip install discord
Make sure you have discord.py 2.0
yeah i tried but same


