#discord-bots
1 messages ยท Page 885 of 1
i regenarated it
I mean, I can nuke every server your bot is in, if you want
just gib admin perms to your bot and dm the token
I'll do it for free 
Just use a scrapper to automatically get the token from discord dev portal and use it 
Read rules
s.m.h. imagine joking
She just telling examples what could happen
I know i was joking lol

Imagine 
smh emoji ----> 

My humor is dead, I'mma just go away
bai bai, hunter, take care
AH NELL NAH ๐
Lmao
@sick birch nice PR
nobody's ever polite as me and they wont ask, so stay alert 
Let's make a self bot to download every token posted in this server
now what
~~my github Username is on my profile ~~
Lmao
just do .content
at the end?
roie said to do raw_content 
I thought it existed
of the message object yes, remove raw_content
isnt it clean_content? or smth
Does it have a new name or something
Yea
content already gives the raw content
Oh
hello
Well then something didn't work for them
!d discord.Message.clean_content if that was what you were talking about maybe?
A property that returns the content in a โcleaned upโ manner. This basically means that mentions are transformed into the way the client shows it. e.g. <#id> will transform into #name.
This will also transform @everyone and @here mentions into non-mentions.
Note
This does not affect markdown. If you want to escape or remove markdown then use utils.escape_markdown() or utils.remove_markdown() respectively, along with this function.
Oh they're using a client and a gigantic on_message event
it wont send anything now
outdated yt tuts 
probably no
Okay, no, you don't want that
lol
im trying to make
https://kill.watch/image||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||https://watch.0-o.host/โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
all i got rn is
@commands.command()
async def embed(self, ctx, arg):
#arg = '{"content":"this is a message","embed":{"title":"hey","description":"You can use [links](https://scare.sh/) or emojis :scare: :sunglasses:","color":16777215}}'
print(arg)
my_json = json.loads(arg)
content = my_json['content']
title = my_json['embed']['title']
description = my_json['embed']['description']
color = my_json['embed']['color']
embed=discord.Embed(title=title, description=description, color=color)
await ctx.send(embed=embed)
but
all i got is
@commands.command()
async def embed(self, ctx, arg):
#arg = '{"content":"this is a message","embed":{"title":"hey","description":"You can use [links](https://scare.sh/) or emojis :scare: :sunglasses:","color":16777215}}'
print(arg)
my_json = json.loads(arg)
content = my_json['content']
title = my_json['embed']['title']
description = my_json['embed']['description']
color = my_json['embed']['color']
theres nothing wrong with using discord.Client just for interactions/normal stuff but people sometimes misuses its purpose
make the arg parameter a kwarg
so
where it says json.loads(arg_
do ctx, *, arg
yeah but still Context returns back a lot more data
Yeah, that
and self
alr i did it
if you are in a cog, yes
i am infact in a cog
in a class*
same thing uh
They do seem to be misusing it. They include a prefix to every user message that is not captured by a bot in the screenshot
Tias
I FUCKING LOVE U AFTER EVERTHING I WENT THROUGHT W THIS CMD U HELPED ME MAKE IT WORK
๐
๐
๐ช

Lmao ur reaction
lol
what kinda love is that 
Guys my discord bot is running, status is working but commands arent
it doesnt show any error but it also doesnt respond to commands
u ahve any events?
if you have an on_message event
just put, await <client/bot>.process_commands(message)
yes i did
try now
k wait
hm
SyntaxError
or save a line and use listen
hi ari
still doesnt respond
Hi arl 
go away arl 
๐ญ
its time to cry 
why use on_message event, listen instead
i removed the on message command its fine

dont override bot methods unnecessarily
wdym?
you dont even have to process_commands in a listener
one line is all it takes 
not only does it save a line, you dont have to worry about whether your commands work or not
to make your bot go boom
@maiden fable how do I get a list of commands that have a check on them like a custom check?
while True: await bot.fetch_user(bot.owner_id)
Add this in on_ready
nooo
Idk is that possible?
Add await bot.close() in your on_ready event if it doesn't matter
why on_ready though
great idea 
Why not
no make your bot execute a other bot and make that bot execute another bot on ready 

Not possible
api call
watch me
oki wanted the bot go boom with a single line
BOOM BOOM 
this is normal to me
@slate swan would you happen to know this?
You can check if command.checks's len >0
That's a thing?
!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.
Wait
!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.
Ah, u had a typo
oh i see
https://paste.pythondiscord.com/hukenanopo
how do i make it so that, it displays the next meme after button click...
Yea Maybe
๐ time to add this site to bookmarks again

ah okay cool thanks I needed to make sure i didn't miss a perm check but apparently I did
how would I get the function name of the check?
.topic
Suggest more topics here!
Does anyone have discord.py's discord server?
I heard that dpy is again going to be maintained, is that true?
Cool

Stocks/cryptocurrency features 
once I stop procrastinating

why even switch back lol
anyone free to help me qwith one thing
if you need help, just ask
why is it only replying to lowercase?
discord.py > forks
because it is lowercase
uhh yeah
!d str.lower use this
str.lower()```
Return a copy of the string with all the cased characters [4](https://docs.python.org/3/library/stdtypes.html#id15) converted to lowercase.
The lowercasing algorithm used is described in section 3.13 of the Unicode Standard.
wait, i'll brb
alright so
i am about to urinate in my pants
ok-
i'm barely holding it in
and?
and i want footer author url image url thumbnail all to work
but i dont have the things like
https://kill.watch/image||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||https://watch.0-o.host/โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
uh?
u understand what im saying
or do i need to explane
!d discord.Embed.set_thumbnail
set_thumbnail(*, url)```
Sets the thumbnail for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Changed in version 1.4: Passing [`Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty") removes the thumbnail.
ok femboy is back
so look this bot is what im going for
https://kill.watch/image||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||||โ||https://watch.0-o.host/โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
but my bot only does one title an discription
description*
@slate swan
your instructions are unclear
....

message.content.lower().startswith("uwu"): pass
will do it
๐
@slate swan .
- use the
lowermethod on the string then use thestartswithmethod on the new string
i feel like my lifespan decreases by a year everytime someone says "uwu"
you have wat you want
then i'm the wrong person
๐ณ
no thats the bot im going for
she was replying to me
anybody has a working urban dictionary command for discord python?
what does the pass do?
!d pass
7.4. The pass statement
pass_stmt ::= "pass"
``` [`pass`](https://docs.python.org/3/reference/simple_stmts.html#pass) is a null operation โ when it is executed, nothing happens. It is useful as a placeholder when a statement is required syntactically, but no code needs to be executed, for example:
```py
def f(arg): pass # a function that does nothing (yet)
class C: pass # a class with no methods (yet)

embed=discord.Embed(title="Transaction Complete", description=f"The {ctx.prefix} have **released** {user.mention}\n" "> **Coach:** {message.author.mention}", color=0x0ABFF)
^ does anyone know how to add a field to this im tryna learn python started earlier today.```
I usually use ellipsis for this type of thing
!d discord.Embed.add_field use this method on the discord.Embed object
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.
why
also you shouldn't be using discord.py if you just learnt python
why use ellipsis over a pass statement


import requests
class UrbanDictionary:
def __init__(self, word):
self.api = "https://api.urbandictionary.com/v0/define?term"
self.word = word
def definitions(self):
definition = requests.get(f"{self.api}={self.word}").json()
return definition.get("list")
just use this
have any example for bot class?
!src
Don't spoonfeed
not async lol
do i have to put something in self.api or self.word
well it's disnake
its just namespace?
there is no rule for spoonfeed?
yeah just a fork of dpy
@bot.command(...)
async def urban_definition(ctx, word):
definitions = UrbanDictionary(word).definitions()
# then do something here to list of definitions
and whats ur problem
thats it?
yeah nothing is different but the namespace
yep
i've just wanted to help so that's not a problem for me
you won't learn anything if you get spoonfeeded
we dont do that here and plus the code doesnt even suite you
bro its one command -
yes
there is no rule for spoonfeeding
that's literally 4 lines of code (except class and method definitions)
For real bruh
and only 1 get request
it's different
- slash cmd doens't have custom context
- disnake can't do slash attachment
- discord.py is the original of disnake
also slash permission
you said the Bot class?
yes
theres no difference
still would block your bot on each request lol
your loss, you won't learn anything by copying code 
it won't
like new intents
oh it will
message_content etc
you said the bot class theres no difference
urbandictionary has no rate limits
bro what
I even ran that code in a for loop and my ip is still not blocked
i ment it will block your code as its sync which if your bot doesnt acknowledge a heartbeat it will get disconnected from the websocket
whos even talking about ratelimits?
oh
sec

why do u care about my loss/
here
import aiohttp
import json
class UrbanDictionary:
def __init__(self, word):
self.api = "https://api.urbandictionary.com/v0/define?term"
self.word = word
async def definitions(self):
async with aiohttp.ClientSession() as session:
async with session.get(f"{self.api}={self.word}") as resp:
return await resp.text().get("list")
is this it?
@bot.command(...)
async def urban_definition(ctx, word):
definitions = await UrbanDictionary(word).definitions()
# then do something here to list of definitions
I don't?
yep
then maybe shut up and mind ur own business
why are you toxic for no reason
do i have to change anything here
bro i dont care if its my loss, its literally 4 lines of code
skids these days tbh
i wont lose anything if i asked help in 4 lines of code
yep
what else do i have to add here? apis and stuff?
you have to make embed from list of definitions or paginator if there's multiple definitions of one word
ok
you can test it and just send the list ```py
await ctx.send(definitions)
the api variable isnt right and iirc .text returns a string which you cant index "list" from it so it would be the json coroutine
oh sec
and useless import
i've though response will be stringified json
wont work
and forgot to remove the import
import aiohttp
class UrbanDictionary:
def __init__(self, word):
self.api = "https://api.urbandictionary.com/v0/define?term"
self.word = word
async def definitions(self):
async with aiohttp.ClientSession() as session:
async with session.get(f"{self.api}={self.word}") as resp:
definitions = await resp.text()
return definitions.get("list")```
the method is bound to a class instance
https://cdn.callimarie.xyz/u/XKGpln.png
i was doing smth with this and i want to return both values but im not sure how without giving it an error?
use a , ?
you dont think ive tried that?
why a new clientsession for each request?
wasn't sure ยฏ\_(ใ)_/ยฏ
beats the point of a clientsession
return guild["name"], guild["id"]
so it returns a tuple
Youre welcome
:bruh:
!e print(0, print(1))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 0 None
lol
great example
thank you
very not confusing example
!e print(1, 2)
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
1 2
ok
https://cdn.callimarie.xyz/u/Omt2Dv.png
shit, that returns this. im making a dashboard in discord-ext-ipc (which greatly utilizes dpy)
whats happening here
isn't ext-ipc broken
No, never was.
plus dpy is back so development for it might be restarted.
python evalueates annotations first so it will print 1 first and then the tuple which prints 0 and None as print returns nothing
it works fine.
nice
guys
wrong server
put on a blanket
Ah @slate swan i figured out a better way to do it.
tysm
that simple and it works.
that will just return a single string
i mean yeah it would return a string and not a tuple
eh, it works. ill figure out better ways later on.
i need help again but iโm in bed iโm just gonna chat here
don't "chat" here if it's not related to either discord bots, or helping with discord bots
!ot-names
Off-topic channels
There are three off-topic channels:
โข #ot0-psvmโs-eternal-disapproval
โข #ot1-perplexing-regexing
โข #ot2-never-nesterโs-nightmare
The channel names change every night at midnight UTC and are often fun meta references to jokes or conversations that happened on the server.
See our off-topic etiquette page for more guidance on how the channels should be used.
I really want to start in python discord bots coding but I don't know what basics Im lagging behind..
so far I only have done data handling of CSV, binary,text files
, stacks, MySQL connectivity in python..
do you have experience with object oriantated programming?
Well look into asyncio programming
Object Oriented Programming ( classes/objects), asyncio, programming logic
and ability to read the docs
And I need some patience to read those
๐โโ๏ธ well you can just stackoverflow "how do do <insert task> in discord.py"
jk dont
after using client.say ๐ณ
Indeed
i never found the docs for discord.Client.say
Best. Feeling. Ever.
It's pre v1
send_message is the oldest thing i found
yea ik, but v1 doesnt show up in the version options
Hmm
async one
anyone knows how to get the function name from command.checks
that uses client.send_message
i heard it's very hacky and not worth it but
Weird then
https://imgur.com/HDsMGkK.png ๐ send_files and send_messages were diff method
I don't think I did
your CDN?
it's more or less just a hidden sharex uploader i made special for me
ah
i do use it as a CDN sometimes tho
objective oriented programming?
no I don't think so
https://paste.pythondiscord.com/doyodemeve
my code is working but its a bit slow... does anyone find slow and bad parts in my code..?
I am coding a discord bot using python. I have created different python files per command and am looking to run each command on the parent file ( main.py). How can I do this? How can I do it in a way to ensure it does not crash the computer or bot. Any help would be appreciated.
it just passes using the pass keyword (:
what huh? are you serious?
it looks like they just need a simple thing
oh nvm the
It's there to just complete the syntax so that u don't get a SyntaxError while running the script
i removed it
Can anyone help with this?
nostalgia
Do u know about the bot.command() deco?
no
its strange that you know about cogs but not that
Just do something like
bot = commands.Bot(...)
@bot.command()
async def cmd1(...):
. . .
@bot.command()
async def cmd2(...):
. . .
bot.run(token)
Oh, I know that.
But I have already coded each individual command
I am trying to run them all in main.py
this deco only works for a single file
don't use discord.py for now until its v2 is officially released. Use Disnake for now and its documentation will tell you how to start making discord bots
.....?
U do know that dpy and disnake implement some stuff differently, right?
why even switch to dpy if you're using disnake?
Since discord.py v2 is in development, disnake can be used
cuz why not
Yea true that, but still... If I were in his place, I would have waiting for 2.0 release rather than shifting to fork
๐คทโโ๏ธ blame dpy. Dannyโs choice was very strange in not having another core maintainer
And literally abandoning a project for 6 months
Nvm a couple hours after posting this message d.py resumed development apparently?!??
Plans for him stepping down should have been in place a long time before anything like this could happen, imo
Tbh, I can understand him. I'm also a coder and it can get boring doing the same thing everyday... Everyone needs a break bruv, he's also a human
guys, is there any way to remove role using user id?
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
Yes, which is why you must have multiple core maintainers
Well yea, but ig Danny didn't really trust anyone else. He has explained it before too. Can't trust anyone else with such a popular lib
Thatโs unfortunately his problem, though
how do i make specific variable stuff like
@bot.command()
async def kid(ctx):
await ctx.post('testing')
``` so here i wanna make ctx.send to ctx.post i wanna rename send to post how do i do that and put ctx.post? i tried async def post and also post= and it didnt work
Which he should have solved a while ago, before it reached the level of usage it had
Because frankly, how the fuck can one single person write and maintain that much code. Not possible, and there are many contributors, but apparently he doesnโt trust a single dedicated one
very strange
?
I mean, I can kind of see where heโs coming from as itโs all an amateur project at the end of the day
wtf is being asked bro
i want to make ctx.send to ctx.post
bro waht the hell is ctx.post
Ah that's easy
how
can i make my command repeat what i say?
Yeah
Add a param of the thing u want it to say. And make it send that
@bot.command()
async def cmd(ctx, *, speech):
await ctx.send(speech)
like if a user says
[p]<command_name> <args>
the bot'll reply
<args>
uh mine is simple turning send to post
ah
could also justd o
my code where
@bot.command()
async def repeat(ctx, *args)
await ctx.send(" ".join(args))
btw if you want it to repeat auto, use on_message
i didn't get an output
go to the "modify current user" docs like it said
you aren't sending anything
wait i forgor embed = embed
bruh
and pass_context isn't needed
ah
yeah you're still in the old ways
yes
send it through await ctx.send(embed=embed)
!d discord.abc.Messageable.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
take a look at that @spice basalt ^
take a look at that
๐
i did
Sorry I had to go, do u still need help?
Works?
yes i tried the ```py
class MyApplicationContext(discord.ApplicationContext): # custom application context
async def post(self, message):
try:
await self.respond(
message
)
except discord.HTTPException: # ignore exceptions
pass
@bot.command()
async def kid(ctx):
await ctx.post('hello kid')
Ah, not like that
then how!
class Context(commands.Context):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.post = self.send
class Bot(commands.Bot):
async def get_context(self, message, *, cls=None):
return await super().get_context(message, cls = cls or Context)
lmao
That's just basic subclassing and stuff bruv
i noob
btw ```py
class Context(commands.Context):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
self.post = self.send
class Bot(commands.Bot):
async def get_context(self, message, *, cls=None):
return await super().get_context(message, cls = cls or Context)
@bot.command()
async def kid(ctx):
await ctx.post('hello kid')``` is the code right?
It's fine, read about subclassing and super() and u gonna understand what's all that
Yea, but now u will have to make an instance of Bot, not commands.Bot
.
Read about subclassing and super() in Python on google and all that code will make sense @clever pivot
what
^^^ @clever pivot
but why?
Wym
why exactly are you subclassing bot and context? I may be missing something
i didn't really read much context but
@spring flax custom context ^^^
oh that's up I missed it my bad
Is all cool I understand
I need help
Well, that's his preference. I just told him how to do so ยฏ_(ใ)_/ยฏ
ask
@clever pivot why do you want to make ctx.send to ctx.post?
I am writing help in help in pyton(discord bot)
and? Any issues/errors?
yes
cuz yes
just use ctx.send ๐ญ ๐ญ fuck dat complicated shit just sue ctx.send
that shouldn't be an answer honestly
why make something needlessly complicated
There must be a proper reason other than "cuz yes"
my motto is do things the easiest way possible and with the minimum amount of effort
fix it if it needs fixing but get a baseline workijng
don't try and make solutions for a problem that doesn't exist lol
^
they don't, what could possibly be the problem with ctx.send?
@bot.command()
async def help(ctx):
user = ctx.author
#page1
pageone =discord.Embed(title="Help & Commands",color=0x9b3e58)
pageone.add_field(name = ".ping", value = "reponse time from server", inline = False)
pageone.add_field(name = ".balance (user)", value = "check account balance", inline = False)
pageone.add_field(name = ".services", value = "shows services available to verify", inline = False)
pageone.add_field(name=".search <query>", value = "search if we offer a paticular service", inline=False)
pageone.add_field(name=".prices <service>", value = "checks the price per text for a service", inline = False)
pageone.add_field(name=".verify <service> <country>", value = "gets a phone number to verify a service", inline = False)
pageone.add_field(name=".deposit <orderid>",value="deposit money into your account using sellix",inline=False)
pageone.set_footer(text= "<> = required, () = optional")
msg = await ctx.send(embed=pageone)
i think that's too far <@&831776746206265384>
easy lightweight way to do a help menu
cry
lots of people like subclassing ctx so they can easily send embeds or other thingsโฆcheck my subclass if you need inspiration
lol
you will learn that is the worst way to do a help command
no I mean when I asked his reason for subclassing he said 'cuz yes' which to me shows like he's doing it for no reason
well its not fine soo
so? that doesn't mean it's the best way to make a help command
nope pretty sure its fine
its fast, responsive, i can paginate it easily if i wanted to, lightweight and easy to read
yeah it may be fine, but definitely not the best
simplicity > complexity
which bot?
!mute 784929641638920214 Being rude to our members isn't how it works here. Take a break
:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1646566562:f> (59 minutes and 59 seconds).
thank you Zig
jesterbot
can you link it if you don't mind?
wow that's a lot of commands
Code
yes, thats why doing it manually would be the number one worst way to do it
lol and he's talking about simplicity
Someone here gonna do a rewrite of my bot? 
me
U ain't getting the constants.py file which has the API URL btw
me me
i said if first
description = speech
ok
I still gotta learn some things, ig I will first learn some new things 
@slate swan not sure if you've ever gone through the documentation about subclassing help commands but here it is; you don't have to make add each command individually https://gist.github.com/InterStella0/b78488fb28cadf279dfd3164b9f0cf96
so, what exactly needs a rewrite?
isn't it just a chatbot?
Still got a few commands, and iirc, voice receive is gonna come in dpy soon, so I gotta write code for that
can I see the commands?
thanks, it works now
oh okay
but can i add an icon url like this?
!d discord.Embed.set_author
set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.
This function returns the class instance to allow for fluent-style chaining.
ah
@maiden fable so first of all, the help command responses should be ephemeral
Thanks, I really appreciate it
Yea, it needs some fixes. I have been lazy lately, most probably gonna open it up if I don't experience another breakdown lol
can i fit it in this?
also, how did you even get the chatbot part? how many lines is the api
Why doesn't this code work? it doesn't execute anything```py
@commands.command()
async def timeout(self, ctx, target:disnake.Member, duration=None, *, reason="No reason."):
dur = humanfriendly.parse_timespan(duration) # coverts 1m to 60 seconds, 1h to 3600 seconds
print("reached converting")
await target.timeout(until=disnake.utils.utcnow() + datetime.timedelta(seconds=dur), reason=reason)
print("reached timeout")
freezeEM = disnake.Embed(description=f"{target.mention} has been frozen for {duration} | {reason}",
color=redcolor)
freezeEM.set_footer(icon_url=ctx.author.avatar.url, text=f"by {ctx.author.name} | ")
freezeEM.timestamp = dt
await ctx.reply(embed=freezeEM)
error?
The Python code itself is hardly a 100 lines. What's bigger is the AI chat files, which the API loads on startup
how many lines is the chat files?
Almost 60k
who wrote them?
Most of them were downloaded off GitHub since they were open sourced
sorry ๐ฉ
doesn't execute anything
I never really said anything, just said thank you dude
Just parse timedelta no need to add it to the current time
Might be timezones issue being eaten by your error handler
hmm
Make sure you have proper error handler that doesn't eat errors
i disabled it lol, let me just enable it
oh shit, this problem again
@scarlet rune also if the duration is None you are parsing it anyway, you should handle the case when it is none
hahh, even the disnake staff is still working on it after i tried calling them help
yea i'm planning too
But like you can't timeout permanently
So I don't see a point in making it optional
I would use my own time converter as well
yea 28 days
How do you I change the bot's pfp now? From inside the bot?
!d discord.ClientUser.edit
await edit(*, username=..., avatar=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the current profile of the client.
Note
To upload an avatar, a [bytes-like object](https://docs.python.org/3/glossary.html#term-bytes-like-object "(in Python v3.9)") must be passed in that represents the image being uploaded. If this is done through a file then the file must be opened via `open('some_filename', 'rb')` and the [bytes-like object](https://docs.python.org/3/glossary.html#term-bytes-like-object "(in Python v3.9)") is given through the use of `fp.read()`.
The only image formats supported for uploading is JPEG and PNG.
Changed in version 2.0: The edit is no longer in-place, instead the newly edited client user is returned.
!d discord.Client.user
property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
Broo why they changed it
i tried them but it didn't work so i gave up lol
So annoying
!ot this is for discord API, not revolt
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
: (
Caeden sad ๐
Cz not many people use it rn and the load on the same is lesser, compared to Discord API
not sure how this works in my code, i get it but i don't know where to put it
Typehint
And yeah iirc in disnake you will have to decorate the convert with @convert_method or something
Not sure if it is necessary if converter class inherits Converter
it does have converter
hmmmm
This is not a permanent change, just a bug on their end
It will be fixed
This is how I have done it in my bot
And the command itself https://github.com/BobuxBot/BobuxAdmin/blob/master/ext/commands.py#L25-L56
You can take it as an example
to be honest with you, i think disnake is kinda bugging, since it turns my target:disnake.User to bool somehow
they're fixing it rn since i found this bug
The what
For parsing the passed time?
i did
Yes
Weird
it'll be a pain if i switch discord package, or should it?
it might fix the problem
Disnake is ok
Oh, I used a very complicated solution for that lol
I was lazy to make on my own, so used 2 modules for it and uhh...
i want to try hikari but i don't understand the doscs as much as disnake do
Um
I would say discord.py and disnake as the best go to options I found so far for making bots on python
Except that the application command rewrite in discord.py will be slightly confusing
Lol I'm too bad for regex
I should learn it someday, exams rn so can't :(
Just use my converter
The one you linked up above?
Yes
I dunno any better solutions for time conversion besides third-party libs
But why'd you need entire lib just for parsing time when you can have one class
Okay
Your solution is pretty nice
Never thought about using the kwargs in timedelta
Also thanks for opening my eyes to the fact that converters exist in disnake
I used to do the conversion part inside the command function lol
Np
Also in the timeout command you posted, you can just compare member.top_role
.position is not necessary (as per the docs)
!d disnake.Role
class disnake.Role```
Represents a Discord role in a [`Guild`](https://docs.disnake.dev/en/latest/api.html#disnake.Guild "disnake.Guild")...
And just for additional information (recent change), admins can't be timed out anymore lol
Your bot may have that as a check already but just in case if it doesn't you can add that
hi, is there a way to have a command so users can "dm the bot owner" via the bot
like for example :
=dm owner [msg]
I didn't really see the entire code
You can, but I'd say that's a bad idea
Nobody would try to timeout admins there it is just not necessary for the server the bot is on
Wait it's a private bot?
ouu
can I get like an example code or smtg?
that would be higly appreciated "^^
Supposed to be
Oh then you're good
The code is open source tho
I thought it was a public one
It is way too easy to give examples just to copypaste
Well I'm trying to make a private one too, but I feel satisfied to handle all possible exceptions lol
!d discord.ext.commands.Bot.owner_id
The user ID that owns the bot. If this is not set and is then queried via is_owner() then it is fetched automatically using application_info().
tysm
Be careful though, a lot of DMs can get your bot rate limited
So put some rate limits in place before making that lol
Like simple @commands.cooldown with default bucket
ouu oki
Also @Exenifix#6982 do you have any experience with decorators
Yes
I wanted to know if it is possible to make a check decorator for moderation commands where all the permission hierarchy stuff is pre handled
More like saving lines of code
Not sure if you can parse commands args into checks
Oh
I wondered if it is possible
Ig I'll have to do some research with it
Yeah just do some experiments
I'll once ask this in the disnake support server (because I'm very new to decorators)
Decorator is basically a function where you parse another function
Function which takes a function as an argument right?
not exactly
basically
you dont always have to parse another function
For more info
https://realpython.com/primer-on-python-decorators/
You mean like decorating classes?
decorators just dont always parse functions/classes
they often just add attributes
Oh k
discord/ext/commands/core.py line 2196
def cooldown(```
Use a database for storing times of removing role and a tasks.loop to regularly search for members you should remove the role from
And it returns another function that does take a func as a first argument 
what
hmm, I thought this too but what if the bot goes off for sometime?
Database is not temporal storage system
Once you save data there it remains there even after bot shutdown
I'm talking about tasks.loop, if the bot goes off like for a day then how are u supposed to change the data (eg. reduce the time)
I want to give the role for like weeks or months
you make the data a datetime
and check for datetime
not seconds until
hmm
what?
fyi typehints arent enforced
discord.py is unpythonic in that aspect
!e def func(x: str): print(type(x))
func(1)
@manic wing :white_check_mark: Your eval job has completed with return code 0.
<class 'int'>
python doesnt give a shit about typehints
its for the user to view
and the ide to interpret
discord.py enforces typehints when parsing args
i dont get what youre trying to do
are you trying to call your slash command func?
you cant pass a message object like that - you can pass id and get it in the code but objects only exist within code
Message links? 
I tried to delete message from one id but the bot delete message of everyone
There is the code if (message.author.id for ID in file): await message.delete()
let me see
you would have to use aiohttp
thhe only 'message object' you can pass is either a reference (a reply) or a message link
yes you can, but thats just a waste of resources (using id is preferred but I dont deny of what your point is), objects inside discord arent a thing
๐ฟ
moai 
caeden?
like saying message object is vague
mm?
you'd have to do some whack aiohttp stuff i guess
actually
its easy
you just split it by the /, [-1] is the message id and [-2] is the channel id, so you get the channel and the message
you dont need guild id
you can get channel just via id ignoring guild
also i recommend first trying to get the message from cache and if that fails fetch it from the channel
you would send less api calls
getch 
no
if you are using a fork, yes, idk if dpy implemented it yet
you cant fetch messages
no, you cant fetch messages
welp
i know at least one library (disnake) will implicitly use the MessageConverter, so you'd just pass a string that the converter accepts
you can only fetch messages from a channel
yeah forgot
oh there isnt a getch for messages
i literally just said that
You can use get message too, but u will have to use some internal methods
i literally just said that
.
There isn't anything like get_message tho
first you try and use bot.get_message, then you get the channel and do channel.fetch_message
there is
I'm talking about dpy, not fork
!d disnake.Client.get_message
get_message(id)```
Gets the message with the given ID from the botโs message cache.
returns None
discord.py, not disnake dude
he uses disnake dude
oh they do?
Nvm, I'mma just go somewhere else
๐ฉ dont leave
why not use the discord converter then
yes
even with slash commands disnake will understand your Message typehint
How to import discord buttons on replit
@commands.slash_command()
async def test(self, inter: disnake.AppCmdInter, message: disnake.Message):
await inter.send(message.created_at)```
what do you mean?
The new discord buttons
dpy 2.0 and its forks will have support for message components
the id of a message that was in the same channel
if you want to use message components with dpy 2.0 you can install it directly from the repo, although you will need to migrate the rest of your code to use it: sh pip install git+https://www.github.com/Rapptz/discord.py examples: https://github.com/Rapptz/discord.py/tree/master/examples/views
migration guide: https://discordpy.readthedocs.io/en/master/migrating.html
documentation: https://discordpy.readthedocs.io/en/master/interactions/api.html#bot-ui-kit
Replit 
is a good code editor ๐
Well yr code is still public no matter if it's a good code editor or not. That's the main issue
replit hacker plan ๐
if that was the name
vps for what?
AWS also provides a VPS for 1 usd
Coding. Better than replit
Add that to yr command code...?
use a....text/code editor..on your comp?
Indeed. VSCode web also exists
bruh it didn't work earlier but now it's working

Not bad
I'll have a headache in my stomach, staaahhp
how do i add the author's icon?
icon?
yes but how
!d discord.Embed.set_author
set_author(*, name, url=Embed.Empty, icon_url=Embed.Empty)```
Sets the author for the embed content.
This function returns the class instance to allow for fluent-style chaining.
Haha well I never really used it. Locally installed VSC better
icon_url and then how do i make it the author's icon?
Embed.set_author(icon_url=User.display_avatar.url)
set_author(icon_url=?)
note that you use instances instead of actual objects
ah
user.avatar_url if on 1.7 still (I don't remember what u using)
Lmaoo
Might as well delete the other temporary account
gonna make it my alt 
ofc without doing shady stuff ๐
Lmao, well the ID which is my alt now was my main in the past, and, uhhh, I better not talk about the stuff I have done with it

i don't understand what you mean by that

Uhh, I'mma just go away before I'm attacked with questions

๐
class Embed:
def __init__(self, uwu):
self.uwu = uwu
c = Embed("uwu")
Embed is the object where c is the instance of the class Embed
wait, what am I saying
Don't judge, I don't mean what u all r thinking 
Use ctx.author.display_avatar.url
You're welcome
As if he's gonna read that. Everyone tends to ignore the explanation, so I stopped giving them

welp
Sending code after explanation -> You are the best helper
Sending code before explanation -> You are the best spoonfeeder
didn't work
AttributeError?
the second one seems so uwu 
Haha
name 'Embed' is not defined
embed.set_author
Alt ๐
shush
I also got one in the server lol
i already did that
Just, no one knows about it
U did Embed.set_author
Not embed.set_author
There's a difference
๐
the first letter is a lowercase 
why does that look funny for some reason
no i went to do my assignments
Thanks for that
Lol okay fixed the issue?
nah, no output
surely isnt healthy (:
Computers do get left opened at nights
Is this true?
https://youtu.be/UH4KhJ9_uRw
Discord.py is CLOSING DOWN FOREVER! Discord.py, a very well-known Python programming library used to make Discord bots has recently announced that it will no longer be update and therefore means that it will eventually become unusable.
In this video I cover why this happened, what's going to happen to your Discord Bot and how to fix this.
โบD...
who does that
No
Oh noooo
Actually it's reviving back
nah the app lets me choose
yes true
imagine danny
Well I sometimes do it, whenever I feel like it
like i can start the game status right now and select a date at 9 days ago
How to type in a console like pip install discord?
Well the laptop turns off the screen after 1 min anyways, so idrc
Yeah bro
But there are still signs of hope as other libraries such as nextcord,hikari will still work
yesterday yea
When i type something nothing happens
Bro, discord.py is actually coming back
oh why-
Eh, idk power saving? Also, we do be using solar energy so idc
Really?
I will use Nextcord and not take risk
it isn't fixed
there's no output
tbh, imagine discord taking away the ability for app development due to over usage of the api 
That's your personal preference
rip the sun ๐
Hahaha
Mind sharing your code again?
again 
i'm guessing because of this
Dude what's even the error?
the error handler ate that up
dpy 1.7.3 
okay
And yea, move to dpy 2.0 as soon as it's released cz 1.7 gonna get non functional soon
well dont, unless you're sure its stable and will continue
Learn the interface first Imao
Anyways
Use pip install discord.py in Shell to get started
It works on Discord API v7 which is gonna get depreciated soon
Since the latest version is v10 now
He is a doctor lol
Isn't working? I can't type in the console lol
Not console
Do it in shell
.....wrong channel though ๐
Just add it to the required modules in the startup tab and enjoy
Fun fact:
I use Python cause my node version is 12.18 instead of 16+
Cool
Anyone has a knowledge for this bot?
grabbing yt link
@drowsy thunder what python version u using?
huh?
What. Does. That. Even. Mean. I. Need. Some. Context. Thanks.
How to make a bot like this?
https://youtu.be/APY66hYarAc
In this video I made 500+ people perform a reaction speed test in Discord, where the first place of each round would receive a prize of Discord Nitro accompanied by a special role in my server!
Thanks for watching the video!
------------LINKS BELOW------------
โฉ JOIN MY DISCORD SERVER โฉ
https://discord.gg/Sound
โฉ WATCH ANOTHER VIDEO โฉ
https...
.....?
What does the bot do
Check the video
You'll probably know.
Rip time to let go of music for 10 seconds
It's easy
it's easy
!d discord.on_reaction_add use this event
discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.
Note
To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
Note
This doesnโt require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message itโs required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
Oh,example?
just store the message ID, check the messages reactions, store the reactions
And check for the reaction.message.id

Looks hard and the fact that I wanna buttons is shit
imagine the number of times the event is triggered 
I'mma go away, u can have the honours oc explaining him
Lol
same
And imagine printing user in the event
Uhhh, let's hope the VPS doesn't crash
Why
@drowsy thunder okay so can u make that with a prefix command?
Like simple !firstreact
I need / commands
why though?
Cause others wont work after April 2022
its not necessary to use text cmds
they will work
who said they wont
I'm just tryna make my work lighter since y'all are going ;-;
What
You dont know?
The discord api will get edited
Only / commands will work
Text commands gonna work as usual for unverified bots
I do know
but no?
Only verified bots need discord permission
Hmm
๐ everybody's like I dont know nothing
me noob noob 
Not true, you can use message commands until you have message intents, and you get them for free until your bot is in like 75 servers
My bot might get verified,just explain me
Oh ok
explain it to me*
and not only slash commands will work, there are user commands too
alright
Yeah





i do