#discord-bots
1 messages · Page 656 of 1
Well yea that's true
theres no need to call it ctx, its like calling self FUCK
!e class x:
def init(FUCK): print(FUCK)
x()
@manic wing :white_check_mark: Your eval job has completed with return code 0.
<__main__.x object at 0x7fbbd1ec0eb0>
😐
@livid hinge
!d discord.on_member_join || ctx is for commands, discord.Context, not an event that passes discord.Member
discord.on_member_join(member)``````py
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.

when people ask for help now, im going to give them the most esoteric answer.
ok idiot ¯_(ツ)_/¯
let's use _
!mute 298043305927639041 2d You've been told to be mindful of your language and about our expectations on how members are supposed to behave. Please re-re-read our #code-of-conduct , if you haven't already.
:incoming_envelope: :ok_hand: applied mute to @manic wing until <t:1638953275:f> (1 day and 23 hours).
Let's not make that event
really dude???
he said it first
;-; why drama literally every other day here
???
Not saying to u
Just a general thing
Nvm I better not fuel the argument here sorry everyone
!mute 656073353215344650 1D Name calling isn't appreciated here, even if you didn't start it. You should know this by now. If you have an issue with a member, DM ModMail. Re-read our #code-of-conduct .
:incoming_envelope: :ok_hand: applied mute to @boreal ravine until <t:1638867117:f> (23 hours and 59 minutes).
Yea
Do tasks work with slash commands
Yea ig
@bot.command()
@commands.has_any_role('Bot Developer', 'staff')
async def warm(ctx, member: discord.Member):
Warmed = discord.Embed(title=f"{member} has been warmed", description=f"{member} has been warmed", color=discord.Colour.yellow())
await ctx.send(embed=Warmed)
``` for some reason when i run my bot this command won't work
one second ill try doing ctx: commands.Context
that won't make a difference.
Prob the has_any_role part
or maybe their server roles
Wouldn’t it be command not commands
Excuse me, I want to ask, if you want to count the number of announcements, which channel do you use?
theres no attribute for that
use ctx.guild.system_channel ?
Get the channel and count the messages lol
iterate through guild.channels then use isinstance()
oh, number of announcement message?
ohh
yeah this then
but my other commands use commands
oke
Do u have the api link for that decorator
my guy broke an elbow the reason why it's commands is because of from discord.ext import commands
and idk wtf an api link is ¯_(ツ)_/¯
????
So u don’t know what ur doing
Make a list of words then use it on that
Well not randint
Idk I’ve only used random once
!d random.choice
Just use randint then use the number as an index
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").
Is there a way to duplicate command, but have them do different things in different channels
Obviously I could put two big if statements, but yeno
loop over all the guilds text_channels and check if its a news channel
Why not just name them differently
Because the names are perfectly suited for the task
Which is
if you really wanna do that shit, make on_message event listeners
how do i get the guild's members listed in this format: ```py
Member#1234
Member#1234
Member#1234
Member#1234
Member#1234
cast the member object to str
Just make a for loop then put new line
After each member
map(function, iterable, ...)```
Return an iterator that applies *function* to every item of *iterable*, yielding the results. If additional *iterable* arguments are passed, *function* must take that many arguments and is applied to the items from all iterables in parallel. With multiple iterables, the iterator stops when the shortest iterable is exhausted. For cases where the function inputs are already arranged into argument tuples, see [`itertools.starmap()`](https://docs.python.org/3/library/itertools.html#itertools.starmap "itertools.starmap").
and what, just invoking other commands?
check if the message content is the command, then check the channel, and invoke the command according to that
No one knows how to use tasks bru
another way would be to just check ctx.channel and do the code according to that using if statements or match-case if python 3.10
yeah.. would just be massive commands then
you can make them differently then just invoke them manually
mhm I think I'll do that, just in the other if statement just invoke the other command if its in the other channel
guys in a on_member_join event i should do member.kick() or member.guild.kick()?
thanks
i am making a alt detection bot thats why working on some timeout code
havent coded bots from 2 months and became rusty
I wanna setup random answering in my bot. What should i do?
Me too
maybe use prsaw lib
!pypi prsaw
@bot.command(aliases=["regdb"])
async def registerdb(ctx):
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel
try:
await ctx.reply("Enter your in-game name!")
msg = await bot.wait_for('message', check=check, timeout=60)
ign = msg.content
await ctx.reply("Enter your in-game Uid!")
msg = await bot.wait_for('message', check=check, timeout=60)
uid = msg.content
await bot.db.execute("INSERT OR IGNORE INTO users (user_id, uid, ign) VALUES (?,?,?)", (ctx.author.id, uid, ign))
await ctx.send("Registered")
except asyncio.TimeoutError:
await ctx.send(f"{ctx.author.mention} this process has timed out! Please use the command again if you wish to register!")```
• I have this command that should insert the Users and the uid and ign
• It gives no errors and i have raise error in my error handler
• it sends the message "Registered"
• After all this the issue is that it does not insert the things needed
Holy...
?
That was too long
once one of my on_msg event was 100 lines long lol
ehh
or maybe 200
db queries are long usually
does it matter....?
no just it took some time lol
My small brain cant handle this lol
One thing.
i solved it,,
U didn't do cursor,commit or whatever that is called
you dont commit the database
^
YES i FIGUReD IT OUT AFtEr 30 mins
ggs
Hahaha
Damn your name tho
Never heard of discord_webhooks package
Same
Sounds like another shitty package
File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 124, in on_command_error
raise error
File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type
@bot.command(aliases=["unregdb"])
async def unregisterdb(ctx):
await bot.db.execute("DELETE FROM users WHERE user_id = ?",(ctx.author.id))
await bot.db.commit()
await ctx.send("Unregistered")```
@tawny arrow are you sure you want to use that current package for webhooks?
Seems like it's asking for a string but id is int
id is an int..
its asking for a str but got an int?
Yea
check the type of the column
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 521, in unregisterdb
await bot.db.execute("DELETE FROM users WHERE user_id
= ?",(ctx.author.id))
File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 184, in execute
cursor = await self._execute(self._conn.execute, sql,
parameters)
File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 129, in _execute
return await future
File "C:\Python310\lib\site-packages\aiosqlite\core.py", line 102, in run
result = function()
ValueError: parameters are of unsupported type
The above exception was the direct cause of the following
exception:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 124, in on_command_error
raise error
File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995, in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: ValueError: parameters are of unsupported type```
ofc
Ignoring exception in on_command_error
hmm
so?
Isn't it supposed to be a tuple
.. it said that cuz i have raise Error
bruh
Yea it should be a tuple
Oh
I don't really use SQL but since you have ctx.author.id within () I assume it should be a tuple
ah mb
is it? idk m new to sqlite
You need to add another "," at the end for it to be a tuple, not an SQL thing, it's a python thing
Yes i did...
It worked!
👍
one more thing
?
how do i select 2 items from db.. using random.choice.. BUT those 2 items shudnt be repeated
and also how to display the number of rows.. in the db.
For db questions you should use #databases
ok lets be honest... WHo tf replies in there?+
You can select 2 random entries from your db without random.choice
h- how?
¯\_(ツ)_/¯
No clue, I don't use SQL, I just know it's possible and seen it been done before
SELECT * FROM TableName ORDER BY RANDOM() LIMIT 2;
Vco sir big fan
also skelmis in ur server "nextcord" alreaady told it a bit before so u late but thx
O
h
Lol
wrong
P
Don't... Just don't start it
Q?
q in hindi means why
kyu = q
hindi
Cz this is a topical/help channel, not an off topic one (:
R
r = right
i dont like the channel getting !shhh ed
Ikr
T
DUDE
strange question but how would I get around to checking if a webhook has a code that matches a if statement
webhook doesn't has any code....?
I know but if I can generate a code to be sent on a webhook is there no way to make a bot scan for that code?
msg = await webhook.send()
Now msg is the discord.Message object which was sent
data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT 2;")
await ctx.send(data)``` well.. how do i get the object inside to get printed..?
this is wrong cuz..
data variable is your cursor object......
ik... thats why m asking...
how to get the inside stuff ..
data.fetchone()/data.fetchmany()
but the webhook is sent
depending on your need
externally
oh yea i phorgot..
*forgot , hm
Hi would someone be able to give me feedback on my project. https://github.com/MechaCoder/dnd-session-helper
fetchall()```
Fetches all (remaining) rows of a query result, returning a list. Note that the cursor’s arraysize attribute can affect the performance of this operation. An empty list is returned when no rows are available.
team1idlist = [860858858628055040, 218993342707400704]
team2idlist = [346219923451936770, 636493966971371530]
for count, x in enumerate(team1_ids.values()):
expected[team1idlist[count]] = float(
0 - (0.7 * (1 / (1 + 10 ** ((art2 - get_mmr(team1idlist[count])) / 400))) + ept1))
pstats.update_one({"id": team1idlist[count]}, {"$inc": {'Losses': 1}})
for count, x in enumerate(team2_ids.values()):
expected[team2idlist[count]] = float(
1 - (0.7 * (1 / (1 + 10 ** ((art1 - get_mmr(team2idlist[count])) / 400))) + ept2))
pstats.update_one({"id": team2idlist[count]}, {"$inc": {'Wins': 1}})
How come my expected dictionary is only doing the first index of each id list? Any ideas?
im doing a meme command and getting the a reddit submission with the random argument
and now i want to add a button which always go back to the beginning
so everytime the button gets clicked it should edit the message and get a new random post from a specific page
does someone know how to do that?
im working with disnake.py (vers 2.2.2)
await ctx.send(data.fetchall())
anybody pls teach me how to code a ddsicord bpt
dm me pls
https://vcokltfre.dev/ really don't need anybdoy
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
if I have code like this:
admin_role = guild.get_role(role_id)
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),
member: discord.PermissionOverwrite(read_messages=True),
admin_role: discord.PermissionOverwrite(read_messages=True)
}
create_channel = await guild.create_text_channel(f'{member} ID: {member.id}', overwrites=overwrites)
How can I add slowmode?
Is there a way to read data from a webhook that is sent externally?
You mean a message sent by that web hook?
!d discord.TextChannel.edit
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
And use the slowmode_delay kwarg
Yes but it gets sent externally.
You should receive the message from it like any other message event, provided your bot shares a server with the webhook
You can check if it's from the webhook with message.webhook_id
No, the webhook gets sent from a external server such as Plivo in this case.
If your bot is in the server the webhook is sent to then you can receive it's event
It's not tho.
Then it's impossible
That sucks..
anybody pls teach me how to code a discord bot
dm me pls
Okimii already sent this
It's a pretty decent tutorial if I say so myself 
Thank you 
For the beautiful tutorial 
how do I add role to message.author
in async def on_message(message)
You can use message.author.add_roles with the roles you want to add
Dont mean to be rude or ot but change your emoji its Christmas 
I added the pumpkin after Halloween because someone said everyone should remove pumpkin while it isn't Halloween 
So logically I'm gonna keep it until October next year then remove it
Good point ig
Anyone good with tasks 😭
copying psutil\tests\test_sunos.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_system.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_testutils.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_unicode.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\test_windows.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__init__.py -> build\lib.win-amd64-3.10\psutil\tests
copying psutil\tests\__main__.py -> build\lib.win-amd64-3.10\psutil\tests
running build_ext
building 'psutil._psutil_windows' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for psutil```
How to solve this for heroku?
I don't think that is related to discord bots
And doesn't the error say it?
How to install that on heroku
The issue occured during the deployement of a discord bot
You need the extension as said in the error
And where do I get the buildpack for that
Aka c++ 14.0 or greater
so i currently have an avatar command that just sends the user's avatar(without an embed, just a simple attachment). Do you know how i can make it show hyperlinks to all the different formats of the image like in the bigger bots?
Your ide literally gives you the link
How can you be so damn dumb

How can I fcking install that on heroku
Heroku is not my machine
On which I can just go on browser
And do it
???
You need it on your pc the error says it:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for psutil
doesnt heroku support c++?
That error showed up on heroku
(dont want to argue, i just wanted some info)
Welp thats a fat oof
It does
ok
Finally you understood me
Im sorry little one
also, is it possible to use the discord.py module with cython without having to change much of the code?
!d discord.Embed.url
The URL of the embed. This can be set during initialisation.
to make the bot efficient
little one?!?!?!
!d discord.User.avatar.url
No documentation found for the requested symbol.
Its a thanos reference 😭
oof
Oh ok I took it in NSFW way
how can i fix this ?
bruh what
I am sorry
replit?
Dirty minded 
yes
I am sorry
it doesnt support databases i think
wut really?
Its alr
What little one
Its a thanos reference when he pushed gamora off for the soul stone now lets not get ot

I didn't hear it prolly cuz I didn't watch the movie in english
with os
Ik about that but in what nsfw way
😅
Dont even know😭
A baby?
Where does a little one come from?
Thats not nsfw😮💨
Yeah.......
Oh that
Yeah......
Well your dirty minded
i thought it was a pedo joke but ok
The very beautiful thing
😳
Indeed xD
:troll:
Nice pfp btw
thx
Your welcome my good sir Mr.pratheek78 
team1idlist = [860858858628055040, 218993342707400704]
team2idlist = [346219923451936770, 636493966971371530]
for count, x in enumerate(team1_ids.values()):
expected[team1idlist[count]] = float(
0 - (0.7 * (1 / (1 + 10 ** ((art2 - get_mmr(team1idlist[count])) / 400))) + ept1))
pstats.update_one({"id": team1idlist[count]}, {"$inc": {'Losses': 1}})
for count, x in enumerate(team2_ids.values()):
expected[team2idlist[count]] = float(
1 - (0.7 * (1 / (1 + 10 ** ((art1 - get_mmr(team2idlist[count])) / 400))) + ept2))
pstats.update_one({"id": team2idlist[count]}, {"$inc": {'Wins': 1}})
How come my expected dictionary is only doing the first index of each id list? Any ideas?
I can't understand how it is related to Discord Bots 🙂
But ok
this dude calls himself the god of programming in 5 different languages and then he asks this:
Note really related to discord bots aka it goes to => #databases and you have a help channel open just wait patiently 
Sorry its part of a discord bot
Who?💀
friend's friend
Lmfao😭
same dude again:
💀
Ok 5 languages is a bit too much
he pinged me for 2 hrs like this until i said i had to go out somewhere lmao
😭
yeah he mentioned JS, Java, C, C++, etc
Damn
Hes probably starting py😭
IK only Bash(The Best), Java, Python
Html isnt a programming language
But it is helpful
but still tho, if he has experience in other langs, especially ones similar to python like JS, he should know how to make functions lmao
Yeah
yeah its a markup language
TBH I only know bash and shell scripting
Yup
i was gonna start learning C today, but i gotta fix my CLion config tho
its completely broken rn
I only know py because im to lazy to jump to js yet
the CMake thingy
js is ewwwww
yeah same
i started python like 1 and a half years ago
Not really
havent had the need to learn another language until now
Started since march
only thing hard to do in python is stuff like animations
For me it is
Cuz I wanna go into Cyber Security instead of Software Developement
and core things
Ah i see
im gonna try learning JS as quickly as possible cuz i gotta build a website for my bot
Im going to back end software development
or i could yoink code from git repos lmao
Static Website Generator 😎
im gonna go to either backend or data science
Wbu?
^
Ikr
Yeah and apis
Lots of hard shit to do lmao
im learning how to use sql through my discord bot
Everything relates to backend and not uis basically
i dont really have any projects other than my bot cuz whatever i learn i try to integrate it with d.py since im very familiar with it
Im going to learn how to use postgres but i havent yet
Learning SQL is easy, but implementing is hard
Yeah
ig you should start with mysql or sqlite since theyre not too complicated and have pretty much the exact same syntax
You'll have to consider the schema
postgre is hard
yep
pycharm helps a lot for learning sql cuz it has inbuilt db tools
Yeah ik but idrc im just gonna jump to it lmaooo
Postgre is a beast tho
so i wont have to open another sql browser
lol
Yep
a lot of companies use it for storing large data
NVM for interrupting but anyone knows how to get a free domain?
You don't
Don't be pessmistic
well...you could apply for github student pack and get a domain for 1 year
Not a personalized domain
free
How do you get a domain?(not familiar with web stuff)
github pages
BRUH
Buy it at a registrar
Github pages is freee
GitHub pages is not for domains, it's for hosting
And I already have one
wait i got confused between domain and hosting service
namecheap has some nice ones
shit
free?
No
Pretty sure they got the xyz ones that everyone uses
idts
As I said, no domains are free...
it'll be cheap tho
are you a student?
you can get the student pack and get a few domains
Temporarily
Not related to bots.
IK already
as long as you are a student, yes
They don't give you a personal one
That does not make it related to discord bots as it seemed to be problem in heroku
hi can i ask a question about discord bots here, or should i ask in the help channels?
Ig the same
Your wish TBH
You can ask here
ill ask here i guess
go through this:
https://education.github.com/pack
and see if you like anything
I have already applied
!ot Bring that over there please, not related to bots anymore
Off-topic channels
There are three off-topic channels:
• #ot2-never-nester’s-nightmare
• #ot1-perplexing-regexing
• #ot0-psvm’s-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
after it gets accepted, get a free domain
i made a music bot, and i use a lavalink server for it, where can i host the lavalink server for free?
24x7
with yt_dl?
- You can't
- Why not use a free one?
Everyone: !ytdl
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
what did you just say….
Free Hosting is not good
Never heard of it😭
where does it get the songs from then?
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
It scrapes youtube and other websites
i don't have money :/
for i in range(0,5000):
num = i
helpchannels = ["staff-cmds", "❓┃community-support", "ticket-"+str(num)]
No lava link😭
Breaches terms of service of youtube
im tryna get all channels 0-5000
definetely not running an illegal bot made for school server with ytdl
Use a public node
How to make group accept an argument if it has subcommands
@bot.group
async def rank(ctx, user: Optional[discord.User]):
if not ctx.invoked_subcommand:
#gives info of author if user is not provided
@rank.command(name='ranksubcommand')
async def other_rank_command(ctx): ...```
Didn't work, it only tried parsing 'ranksubcommand' as an argument
an1
But what is lavalink😭
List of free lavalink servers! Sharing is caring, so if you have lavalink that you can share feel free to make a pull request!
lemme see this
yeah
It's a standalone audio node blah blah.......
Not very helpful
server
LavaLink just makes a REST websocket connection around the Lavaplayer
kinda complicated
No
Ah i see
LavaPlayer scrapes YouTube and 100 other sites for music streaming
Just the way ytdl does
tried using it for a music bot, then dropped the idea after finding out that its quite heavy and i cant host the bot on heroku(which in the end i didnt anyway, cuz im too lazy to make another email for it)
You can
including spotify?
Spotify got encrytion
Which will rate limit you hardly
then how tf does hydra bot get its songs from spotify?
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
idk how to use this, sorry if i seem ignorant, cause i am. im new to python and this was my first bot
we arent gettin help on that topic, just discussing
It doesn't I don't think, it just says it does but uses yt
It uses the spotipy module to get song info from spotify and searches the song on soundcloud
on the website it says it only supports spotify now
Look above then,
It uses the spotipy module to get song info from spotify and searches the song on soundcloud
Can you DM me your issue?
afaik spotipy cant get all songs
yep
and is it illegal like ytdl?
oh ok
How is ytdl illegal? I don't see how downloading a video is any different than screen recording one
what is the use of @client.command?
Its a command decorator
It can
Yes
why use it
And you forgot the parenthesis
@client.command()
oops
😳
To create a command
is it just like a function?
thank
its against the TOS, and i think youre familar with how rythm and groovy got taken down
I wanna make a voice join/leave logs, like " user has join/eave test voice channel ", may i know how can i do it?
Use the event made for it
!d discord.on_voice_state_update
discord.on_voice_state_update(member, before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") changes their [`VoiceState`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceState "discord.VoiceState").
The following, but not limited to, examples illustrate when this event is called...
Compare before.channel with after.channel
what's a better option for storing a dict database, json or just a .py file?
which library can send discord slash commands invisibly (like this)
how do I check if array has array.[1]
im trying to move away from discord.py so i dont want any libraries that depend on that
wdym?
I mean
arg = message.content.lower().split()
if arg[1] in arg:
check if it has more than 1
in the array
if arg[2] in arg?
if len(arg) > 1
or that
if thats what you mean
if len(arg) <= 2: works thx
embed = discord.Embed(title="Purge", description=arg[1])
doesn't work hm
almost every fork can
doesn't send the embed
you just need to enable ephemeral in slash commands
yes but would that be a global setting?
bc i need it so that i can send it on specific msgs
like the current lib im using you can do
await ctx.send("hi", hidden=True)
why cant I print(arg[1])
No its a kwarg
await interaction.send("msg",ephemeral=True)
Disnake is the best tbh
Most mature fork out there
cool thanks 👍
if message.content.lower() == prefix+"purge":
arg = message.content.lower().split()
if len(arg) <= 2:
print("debug")
else:
print(str(arg[1]))
embed = discord.Embed(title="Purge", description=str(arg[1]))
await message.channel.send(content=None, embed=embed)
doesn't work hm
doesn't print the arg[1]
Use actual commands, not events to make commands
nvm fixed
can u tell me how to code a bot? pls if u are a bot player will give rewardds
🤨
check pins lol
read the docs or this https://vcokltfre.dev/
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
Well yes but not recommend
i need a guide
scroll up
a bot and i will code in repl it
dont use replit
Read this @earnest ferry
can you not read
Yes.
Yes you can but It's bad
No need to add thousand of questions mark either...
there is??????
Read the guide, use replit although it's bad and start your stuff
k lol
why dont you just localhost
wdym?
like host it on ur own pc
ye its my pc only
how to host it locaally??
just run ur main bot file using python in the cmd or whatever
@earnest ferry ive sent you many tutorials and others as well and so has alec the creator of the tutorial has recommend to see and learn from the tutorial what is the part you cant understand?
my god
read it, understand it, and write it
Youve been sent this many times
Chill
If your not willing to learn then we cannot help you
im wiling bro
Then i recommend you enter to the website and read the tutorial as its the best up to date tutorial right now
ok thnx 👍 👍
so i have this code
await server_channel.send(file=discord.File(data, 'database.png'))
is there any possible way i can put that image on the embed image?
@bot.command()
async def brackets(ctx, p:int):
while 0!=p:
data = await bot.db.execute("SELECT * FROM users ORDER BY RANDOM() LIMIT 2;")
dataa = await data.fetchall()
await ctx.send(dataa)
p-=1``` i want it like if dataa send in the first msg == dataa sent in the 2nd msg then it shud re do the dataa sent in the 2nd msg
how to do it
Good luck
server_channel?
whats server_channel defined as?
a channel, i already have an embed
I just wanna ask if is it possible i could set that file to the embed image?
i wanna make it embed
yes
how?
idk how to explain
uhh read the docs for embed theres prob an image property
!d discord.Embed.set_image
set_image(*, url)```
Sets the image 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 image.
Something with set_image
Yeah that
^
..
@slate swan ?
Dont know much about dbs really
Still learning them
same..
!p drop menu select roles
Converting to "int" failed for parameter "pep_number".
!pep <pep_number>
Can also use: get_pep, p
Fetches information about a PEP and sends it to the channel.
#bot-commands
a cmd for displaying pep rules
@slate swan
?
i dont see any msg variable there
why wud i need a msg variable
is this channel for using bots?
i just said what i wanted ... the result not the code
i dont quite get what you mean
#bot-commands
No,but it is about the discussion of them to use them its
=> #bot-commands
i mean that the 1st dataa sent.. any of the content send there shudnt be used in the 2nd msg which is going to be sent by the bot
@slate swan
hey
I was wondering why this doesn't send the message ```py
@bot.event
async def on_reaction_add(reaction, user):
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send("Verified by {user.id}")
No error
i read and typed the code but its not online
There isnt a token
Yea but regenerate it
u revealed ur token
guys where can i find drop menu select role?
why?
if any([x for x in message.content.lower().split() if x in file.read()]):
flags every letter in the file for some reason
Because its your bots password
indentation...
ok ....
Which if someone gets can do malicious things with your bot
ok now regenerated
Indent it
guys where can i find drop menu select role? @slate swan
And dont put it in the function
bt still offline
indentation..
wait
Not that bad as the bot isnt doing anything big
still shudnt
Reason?
its a bad practice
a lot
How is that bad practice?
Check discord it probably is online you just dont have a on_ready()event
wdym??
I know the deficiencies of replit but that isnt bad practice
it is..
No its not
this is #discord-bots
@earnest ferry btw make a env file to hide your token since replit is public
no need to argue over replit, i'll say replit bad because people see ur repl and discord bot token unless it's private
@bot.event
async def on_reaction_add(reaction, user):
if user == bot.user:
return
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send("Verified by {user.id}")
return
``` Why does this not output anything
Were talking about discord bots and how they can run in replit
oh yeah that
🤔 shouldn't it be just message.channel.send
Ignore that for now and no, it doesn't even print anything
Its fine his bot is little not a problem
..
if it becomes big then m saying
its like it isn't there :/
what is bot.user?
he did that so whenever the bot reacts to its own message it wont count
and whats with ur indentation
true thats some weird indentation
also not that
its wrong?
Guys what are the things I can host my bot into except my pc lol
indentation
No error
🤔 search for pterodactyl discord bot hosts or use epikhost
do u have an error handler?
Yes but not for this
show ur error handler
bru idk sql and that stuf
Epik host
Aws machine
At that time he can just switch to a ide really isnt a problem
No I mean, I heard some people talking about hosting their bot in something like rasp or aur, and that's what made me curious about it
actually I have none in this sample
like in this new piece im coding
A vps or a rpi
hey how to end interaction after button is clicked once??
ok fix your indentation and then chek if that works
@slate swan what is rpi?
but he wont cuz he doesnt know its side-effects and cuz of that he will use it
bro
make one
whats wrong with the indentation
A rasberry pi
I have a vps but I still wanna know about rpi
why did you double indent it when you had to type return
the return statement
which lib u using?
Not really a problem for him
nextcord?
may i ask why?
whats that? I'm a bit new :<
@bot.event
async def on_reaction_add(reaction, user):
if user == bot.user
return
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send("Verified by {user.id}")
return
ah okay ill try this
for dpy 2.0 just do self.stop() or something i forgor 💀
library
i use disnake
@slate swan can u tell me what rasperry pi does?
oh
I mean what is it?
idk bout that
ah sad
learn python
Remove the buttons maybe
In the button you do
self.value = True
#to stop the button from continuing
self.stop()
@slate swan once see dm pls
my guy forgot the colon (:)
async def on_reaction_add(reaction, user):
if user == bot.user:
return
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send("Verified by {user.id}")
return``` Still nothing
no no
o
he wants to disable
hes using disnake
not stop
I didn't its there
So?
okay, letlet me try
wait it's the same?
right
bruh no
@slate swan
Remove the buttons bro 😭
screenshot
?
If your trying to disable it use the disable kwarg
No.
@slate swan pls see dm
Yea
where to put this
the thing @slate swan said was for nextcord
ok
ok doez it work
Anyone KNOW HOW TO DO A TASK LOOP
Nope
use f strings
@tasks.loop
Welp dont know on nextcord
I mean how to get the values inside it
no 😭
@slate swan pplllllzzzzzzzzzzzzzzzzzzz see dmmmmm
"self is not defined"
Its basically a mini pc
Should probably try starting the task
bro put self in your parameters like def function(self)
nah
What!!!!????
right right, lemme
WHAT IS SELF
Nah nvm thats for disnake,for the view class but your using nextcord
How can I program that rasberry pi?
(if its a class)
is he?
who cares self still works in functions ¯_(ツ)_/¯
he said disnake
Its a needed paramter to access the class
but..still..
Idrk
nvm tho
it also works in classes too
plz tell indent where
Thats a arg
i have been lied to3
But isn’t it a kwargs
im frustated
learn python
brehhhhhhhh
LEARN PYTHON FFS
Ik that?
@bot.event
async def on_reaction_add(reaction, user):
if user == bot.user:
return
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send(f"Verified by {user.id}")
return
``` still no output 😭
ffs you don't know python indentation
spamming here wont help
make an error handler please!
THERE IS NO ERROR!
No I’m saying like if u don’t put it it’s already there so like what does it ever help with
he means whenever the bot encounters an error, make the bot print it
like a async def on_command_error
MAKE ONE AND SEE! Add else:
raise Error
The self param is for accessing a class
^^
Oh
Depends on what error
I don’t use classes
wait it's not a command
which library u using?
im stupid asf
No
Disnake
@kindred drum add else: raise Error
tell how to indetn!!!!
@bot.event
async def on_reaction_add(reaction, user):
if user == bot.user:
return
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send(f"Verified by {user.id}")
return
else:
raise error``` No output
^^
Wha-
Dude read carefully
wait
what we told u
Add a print statement under the bot.user check.
his else raise error is only wrong
He copied it
Error isn't defined ?
Been a minute hasnt it
What does empheral do?
crabgame
Error
Mhm. Haha.
Bro I didn't copy it
Makes the message only visible to the interaction author
and also in a function like async def on_command_error(ctx, error):
you said "Raise Error" but its not defined
Oh
@client.event
k
dude thats command error
raise Error ..
try:
await reaction.message.channel.send(f"Verified by {user.id}")
except Exception as e:
raise e
I believe that's what you would want to do.
not event error
ahh i still dont know how to end interaction
yes so i am telling for all the things
bot events are commands???? 🤔
error is a nonetype arg in that case
..
I am telling for globally
You said what?
@bot.event
async def on_reaction_add(reaction, user):
if user == bot.user:
return
try:
print("Noted")
await reaction.message.channel.send(f"Verified by {user.id}")
return
except Exeption as e:
raise e
why need a command_error handler if it's an event issue
..
just use what @dapper cobalt said :trol:
Idk lol
try not to spoonfeed please
Not really spoonfeeding as you guys arent quite helping the poor guy
@bot.event
async def on_reaction_add(reaction, user):
if user == bot.user:
print("check 1")
return
if reaction.emoji == "👍":
try:
print("Noted")
await reaction.message.channel.send(f"Verified by {user.id}")
except Exception as e:
raise e
else:
raise Error``` No output still
i only give people examples if they don't understand what i are trying to say ¯_(ツ)_/¯
hmm, I dont quite get the issue
either
so the event got triggered?
else raise error.. remvoe that
no
or no
it didn't get triggered
^^
@kindred drum
wont change anything but sure
the message that got reacted probably isn't cached
and also ur try and except are in the wrongplace
use on_raw_reaction_add
how to add emoji in buttons?
Try to stringify reaction.emoji. str(reaction.emoji) == "👍"
someone please?
I think theirs a kwarg for it
emoji = 'thumbsup' ?
no
if str(reaction.emoji) == "👍":
...
Should work afaik.
nvm i didnt understand
@tasks.loop(minutes=1.0)
async def task():
async with aiohttp.request("GET", url="Your url") as res:
json_data = await res.json()
print(json_data)
task.start()
Does that look right
finally an error
TypeError: on_raw_reaction_add() missing 1 required positional argument: 'user'```
Is that inside a cog?
bru add user: discord- wait what
it accepts one argument only
oh god, is it reaction or user
On raw reaction add takes payload as argument
We are not enough qualified to solve it 
There's a big difference between on_reaction_add and on_raw_reaction_add.
please..?
!d discord.on_reaction_add
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.
!d discord.on_raw_reaction_add
discord.on_raw_reaction_add(payload)```
Called when a message has a reaction added. Unlike [`on_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_add "discord.on_reaction_add"), this is called regardless of the state of the internal message cache.
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
@dapper cobalt @visual island ?
@kindred drum do you have the intent reactions enabled?
Does that make a call?
enable it ffs
wait
btw i think 1 arg only in python means = 2 args only
I do
Doesnt make sense
@bot.event
async def on_raw_reaction_add(user):
if user == bot.user:
print("check 1")
return
if user.emoji == "👍":
print("Noted")
await user.message.channel.send(f"Verified by {user.id}")``` no output
The param has to be reaction
pls tel @slate swan how to indent
change it to reaction
ffs learn python
what features have y'all made with interactions
!indent
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
where!
!!
then how do I check the user?
dude you dk how to learn python?
no!!!
h ¯_(ツ)_/¯
one second ill look at a github example
if you mean discord buttons, we made singleplayer tictactoe
how do I create a thread for an async function that closes itself when it's complete?
what modules (excluding dpy 2.0) could i use to make discord buttons and dropdowns and isn't discontinued?
one question:- do u know python?
nextcord
I think disnake can
has menus and dropdowns too
disnake has good buttons that are easy
🤔
nextcord too
nextcord is gonna have slash cmds too soon
what about stuff like discord-interactions
nextcord has
buttons are one part of the interaction api: theres also context menu commands and slash commands
@bot.event
async def on_raw_reaction_add(reaction):
if reaction.member.bot:
print("check 1")
return
if reaction.emoji == "👍":
print("Noted")
await reaction.message.channel.send(f"Verified by {reaction.author.id}")
``` First check works, how do I get the second one to
Disnake ofc has it
Disnake is the most mature fork out there
nextcordis
nextcord is*
No.
Yes.
i will be using discord-interactions
🤷♂️
ur wish but nextcord has a lot
menus too
Disnake has examples in their git too btw
looks good to me
nc too
was kind of interested in selects
I've done a personal, in depth* analysis on all of the libraries, and this is my ranking:
disnake
nextcord
pycord
discord-interactions
time for the deep dive
yee nc has all and also menus .

nc has menus
can u help with db questions?
ye
what is indentation? in python? idk python help me figure this question out

jk ofc