#discord-bots
1 messages · Page 784 of 1
¯_(ツ)_/¯
¯_(ツ)_/¯
imma do blacklisted word,kick,mute and temp tomorrow
ok
and then imma learn how to make the disboard or something idk
add more stuff as well
like that ?

PEP8 wants a word with you 
wait what
that is no way what i sent...
didnt they said message.guild : return?
do it on the next line
wait guide and guide_only is different ?
is it? xD
can anyone help #help-apple
I only say what I see tbh
guild is the server and guild_only is a deco for a command iirc
guild_only is a decorator from commands , guild is an attribute of Message
o ok
the condition with not was supposed to be a standalone statement , but since you used it with and not is not required
Member is a User but guild binded, A friend you talk in dms is a User, but if you talk to him in a server its a Member with additional properties and methods like roles , top_role , color/colour etc
Hey can you tell me how to make delete channel command using discord py
brb
await ctx.delete..?
!d disnake.abc.GuildChannel.delete
await delete(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes the channel.
You must have [`manage_channels`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_channels "disnake.Permissions.manage_channels") permission to use this.
ctx.channel.delete works if you want to delete the current channel
ah , its an abstract base class
yea it will delete the channel command was used in
K
@bot.command()
async def delete(ctx):
for chan in ctx.guild.channels:
await chan.delete()
``` this is way more efficient. ||joke dont use ||
why not loop with bot.get_all_channels
You're right
lmfao
so, i have a song, song.mp3 that has a rickroll, when i run the play command it needs to join a vc and start playing. It joins, but when it plays it it gives me this error ^^
it says that the operation that was performed on the bot isn't a socket
ohhhh
i fixed it nvm
no i got it, i tried to session.play when session was defaulted to None
lol
No i mean clean this chat lol
he is asking you to delete the traceback since u figured it out I believe
oh yeah just did it
Thanks :3
hy guys i have a discord bot which used selenium [opens the chrome browser]
where should i host it
??? i have a plan to host it in digital ocean
by installing chrome browser in digital ocean
what did you say ?
oh and btw does await voice_channel.connect() return a VoiceClient object?
!d discord.VoiceChannel.connect
await connect(*, timeout=60.0, reconnect=True, cls=<class 'discord.voice_client.VoiceClient'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Connects to voice and creates a [`VoiceClient`](https://discordpy.readthedocs.io/en/master/api.html#discord.VoiceClient "discord.VoiceClient") to establish your connection to the voice server.
This requires [`Intents.voice_states`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.voice_states "discord.Intents.voice_states").
@quaint epoch
does anyone know why this isnt working?
@bot.command()
@commands.is_owner()
@commands.cooldown(1, 3, commands.BucketType.user)
async def help2(ctx):
embed = discord.Embed(title=f'Help Command', color=0x36393F, timestamp=ctx.message.created_at, description=f"krzx 2 cool")
await ctx.reply(embed=embed,
components = [
Select(
placeholder = 'Select a module!',
options = [
SelectOption(label="Moderation", value="1", emoji=bot.get_emoji(934990020740272158)),
SelectOption(label="Fun", value="2", emoji=bot.get_emoji(934990020740272158)),
SelectOption(label="Utility", value="3", emoji=bot.get_emoji(934990020740272158)),
SelectOption(label="System", value="4", emoji=bot.get_emoji(934990020740272158)),
SelectOption(label="Anti-Nuke", value="5", emoji=bot.get_emoji(934990020740272158))
])])
@bot.event
async def on_select_option(interaction):
if interaction.values[0] == "1":
embed = discord.Embed(color=0x36393F,
title='Moderation Commands', description="Mod")
await interaction.send(embed=embed)
elif interaction.values[0] == "2":
embed1 = discord.Embed(color=0x36393F,
title='Fun Commands', description="fun")
await interaction.send(embed=embed1)
elif interaction.values[0] == "3":
embed2 = discord.Embed(color=0x36393F,
title='Utility Commands', description="Utility")
await interaction.send(embed=embed2)
elif interaction.values[0] == "4":
embed3 = discord.Embed(color=0x36393F,
title='System Commands', description="System")
await interaction.send(embed=embed3)
elif interaction.values[0] == "5":
embed4 = discord.Embed(color=0x36393F, title='Anti-Nuke Commands', description="Anti nuke cmds")
await interaction.send(embed=embed4)```
is that even an event
no its not
!d discord.on_interaction
discord.on_interaction(interaction)```
Called when an interaction happened.
This currently happens due to slash command invocations or components being used.
Warning
This is a low level function that is not generally meant to be used. If you are working with components, consider using the callbacks associated with the [`View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View") instead as it provides a nicer user experience.
New in version 2.0.
Can you tell me in how many servers can a bot join if the bot is hosted by using replit
It can join the same amount of servers any other bot can
Remove the k. It won't be able to join more than 100 servers before verification
^
you can make it join as many as you want to depending if its whitelisted or not
also replit would be lowkey laggy if your bot crosses 100 servers
I mean at least tell me the number( without lagging)
Hmm
K done
theres not rlly a specific amount for laggy its just repl isnt a good host
Yea
#discord-bots message , before anything please read this message :)
^
Use heroku and every week, just tell people there's a downtime of 2 days to keep yr bot running whole month
Ezzz
heroku isnt designed for hosting bots though its ok
Was meant as a joke but okay
ok
what's it called?
U can host for free on Oracle
netcup
I coughed up $60 and now have unlimited hosting
Enough to run a small hosting service lmao
No way they offer that for free
Bet?
Yeah
Where's the catch?
U gotta give them their credit card details
They gonna charge and refund u 1 USD to verify the card
Same with AWS, but they charge 1 USD without refunding
A friend of mine got a small hosting service running from those 2 VPS's for his friends
Its Linux
Hmm, if I were u, I would have preferred to go with the Oracle option since u r getting everything for me but for the Rasp, u gotta pay for the internet and if yr internet goes down, so does yr bot
Hello send me discord py server
My power and internet don't go down that often
hunter having an identity crisis
yr wish ¯_(ツ)_/¯
Can you send any docs or anything where I can know like in how many servers can discord bot join if you host by using replit and won't lag
Depends on the bot
How can Oracle afford to offer those services for free
Like
Idk
Just don't use replit
¯\_(ツ)_/¯
My situation just have replit
depends on many things like the bot cache and the stuff it does,
my bot is in 77 servers with 22k member and here's the resource usage
replit barely provides you with 150 mb ram iirc
So is it that replit or
its a webserver
What if I put Cool down on commands
Then I can put my bot by using replit. I am phone user. I Only have replit as choice
So. In. How Many servers can I add by using replit
Any guess
Oh
But my bot got crashed when someone invited it . Mainly joined 5 servers
Probably someone spammed commands
Replit ban for too man api req
i have this for free 💀
So for how many seconds. I should put cooldown on every commands to less api req
well the api reqs dont actually effect too much on memory so you may let it be
thats just replit being buggy
How to choose an user from a reactioned message? Like a giveaway bot
!d discord.Reaction.users you can get a list of the users who reacted , and use random.choice
async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.
The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
Examples
Usage
```py
# I do not actually recommend doing this.
async for user in reaction.users():
await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
Ty
I have this code
while True:
schedule.run_pending()
asyncio.sleep(1)
break
When I start it i get the error coroutine sleeep was never awaited
But when I do
await asyncio.sleep(1)
I get the error I can only use await in a async function
But idk what to change
so i currently have this task in a cog, and i think it should work, but when i run the code, it tells me theres a missing argument 'self' even though i have specified it:
@tasks.loop(seconds = 1, count = None, reconnect = True)
async def remind(self):
today = datetime.date.today().weekday()
timech = datetime.datetime.now()
current_time = timech.strftime("%H:%M:%S")
rem_chan_id = self.client.get_channel(936512525099491348)
if today == 4:
if current_time == "20:52:00":
await rem_chan_id.send('Test')```
exactly what the error says. you cant use await outside an anychronous function. if you want this code to run when the bot is online, put it in an on_ready() event, but if you want it to keep running every other second or so, use a task
@commands.command(aliases=['8ball'])
async def eightball(self, ctx, *, _ballInput: clean_content):
"""extra generic just the way you like it"""
choiceType = random.choice(["(Affirmative)", "(Non-committal)", "(Negative)"])
if choiceType == "(Affirmative)":
prediction = random.choice(["It is certain ",
"It is decidedly so ",
"Without a doubt ",
"Yes, definitely ",
"You may rely on it ",
"As I see it, yes ",
"Most likely ",
"Outlook good ",
"Yes ",
"Signs point to yes "]) + ":8ball:"
emb = (discord.Embed(title="Question: {}".format(_ballInput), colour=0x3be801, description=prediction))
elif choiceType == "(Non-committal)":
prediction = random.choice(["Reply hazy try again ",
"Ask again later ",
"Better not tell you now ",
"Cannot predict now ",
"Concentrate and ask again "]) + ":8ball:"
emb = (discord.Embed(title="Question: {}".format(_ballInput), colour=0xff6600, description=prediction))
elif choiceType == "(Negative)":
prediction = random.choice(["Don't count on it ",
"My reply is no ",
"My sources say no ",
"Outlook not so good ",
"Very doubtful "]) + ":8ball:"
emb = (discord.Embed(title="Question: {}".format(_ballInput), colour=0xE80303, description=prediction))
emb.set_author(name='Magic 8 ball', icon_url='https://www.horoscope.com/images-US/games/game-magic-8-ball-no-text.png')
await ctx.send(embed=emb)
Whats the problem?
Is it ok if I host my bot by using my website?
ig? Depends on where yr website is hosted and if the hoster supports Python
What is the problem?
"@deleted-user"
How u using the cmd?
?
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.
_ballInpit: discord.User
So is it ok if I use replit and host my bot in vps so I can add it in many servers?
That is what recommended, yes
Bruh so I Just want is good hosting
If I use it this way, it won't send anything.
Mhm
It should... Any error?
nothing error
u got an error handler?
Your bot will be online only for 22 days per month
Oh
in the free version
Atleast. I can add it in many servers though
try looking into railway
Like 1k servers?
It is more or less like discord, but less popular so the bot shouldn't get ratelimited easily
How can i make that?
Is it free?
It isn't that easy to make yr bot reach 1k servers. I have an AI Chatbot and its been about 6-7 months but its only in 113 servers
Yea
Discord Dev Portal > OAuth2 > General
So if I use that in how many servers can I add
Bruh, it depends on yr bot, but I have seen a few big bots like in 50 servers or smth being hosted there
ryphal
u got an error handler?
hllo bruh
What's that?
i kinda
Hm?
stucked in a problem
Wdym. What if my bot is Multipurpose bot
Sure ask it right away
So, I Co-Dev a verified bot, is there any way for me to get voting roles by voting for the bot on top.gg and having it removed after 12 hours?
my vs codes not working proparly
It should join about 100 servers if it doesn't take much resources
top.gg have an API
ye ik
If it is related to the IDE, then go to #editors-ides
when i hit any command
BTW congrats on getting yr bot verified! @neat pagoda
So should I use railway or uptimrobot For Hosting
railway imho
it shows the result in terminal
Ik how to add voting roles, but, how do u remove it after 12 hours?
and not working as python script
I mean what if it has all commands-music, fun. Like all. So I can add in 100 servers only?
which means???
Like Discortics
well the easiest way would be to just check the current unix time/datetime object, add 12 hours to it, store it in a db, and then make a task.loop to check the time stored in the db every hour
yeah but nothing. if i dont write any to 8ball its work
ok thx
sorry i heard this first time
music is against ToS. Discord won't verify yr bot
Mind showing yr error handler?
I have one
YouTube ToS
gtg bye, thx for the help @maiden fable
What if I made my bot same like discortics without music stuff. So. I can add my bot in more than 100 servers?
All cool
the problem is not the error handler
as well😅
It needs to be verified from discord before it can join more than 100 servers
Yeah after verification. Can I add?
bro it is. Your error handler is most probably eating the errors
Yes.
oh i think that's like rythm
isn't it
???
Ik, but let's just ignore it, shall we?
I noticed the BOT tag from the bd client
What if I use verified bot of my friends one
Xd so I don't have to verify
L ol
Look, lemme get this straight. You can host a verified bot on railway too, but a VPS is preferred since the bot can take up more resources and can lag due to insufficient resources.
Wdym by insufficient resources?

Like the bot is trying to access more RAM but its already using 100% RAM
Then it won't be able to save more data and can/will lag
Oh so what is the difference between vps and railway
VPS can give u more resources and a dedicated machine to run yr bot on, unlike Railway which uses shared machine
railway is also made to support web servers, not discord bots
Lol wdym by web servers
Yea, but a better choice than replit to host a discord bot for the time being
backend of any web application
Sort of, websites and APIs
Back ?
Oh it still doesn't work?
look you should google what backend means by yourself, this isn't the channel to discuss that
@slate swan
bruh you are really uncool
Me?
you know
just understand that discord bots are not something that railway supports
Damn
i totaly lost
property owner: Optional[Member]```
The member this thread belongs to.
!d disnake.ext.commands.Bot.voice_clients
property voice_clients: List[VoiceProtocol]```
Represents a list of voice connections.
These are usually [`VoiceClient`](https://docs.disnake.dev/en/latest/api.html#disnake.VoiceClient "disnake.VoiceClient") instances.
in another chats
threads are a dpy 2.0 thing
So how can I know. How many storage my code is taking in replit? And replit don't have ram stuff?
Actually we ain't liable to share anything with u. We help here voluntarily. No hate towards u or anyone else but just clearing things up and explaining our situation
Lemme see
ohhk
i also think
i am a garbage😢
would this work? ```py
session = await vc.connect()
await session.disconnect()
To leave the vc```
1.) This ain't the correct channel
2.) No you aren't don't think like that (:
!d discord.VoiceChannel.disconnect
No documentation found for the requested symbol.
!d discord.VoiceClient.disconnect
await disconnect(*, force=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Disconnects this voice client from voice.
sorry bruh
There
!resources got some cool resources to help u improve your Python skills
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
🤓
and how does it work
Click on the link
The role is below the bot's highest role and the bot got Manage Roles permission, right?
Lemme ask from the disnake devs
Try asking the question there
In the disnake server
Wait
@slate swan
it shows to many options broh
u r on the older version
Try updating
guide
Look, #python-discussion is a better channel for this talk
2.3.0 is the newer version
i already knows about git
what do you guys think is the best lib in discord rn?
it is teaching me
disnake
pip install -U disnake
there are a few, disnake, nextcord, pycord or if u r willing to learn a new lib, then go for hikari
ohkay
i've tried hikari and it looks really good
Or u can also go for Rin, a wip (iirc) wrapper made by @pliant gulch 👀
Da Fak
Mind sharing the link of the logging output again?
You def don't want to use Rin right now
Not stable?
Stable, not a lot of models
Ah
Stable as in stability with the gateway
Other than reconnection as I haven't added that
Andywares are never stable
You should add that in the readme of the repo then since I first checked the readme to see if u said about it being in Alpha or smth
Try asking in the disnake server.
Whenever something gets stable he rewrites it
Proof
Nino
ngl that is kinda sounds like you changed something
@slate swan want the invite to the disnake server?
The version says ‘0.1.0-alpha’
Didn't check the version, just saw the readme from yr github
Nino was fine lol I just never finished
😂 just messing lol
The osu wrapper too
Jeez the self advertisement 😂
He wasn't in the mutual servers, so I just asked him if I should send one in his DMs
The bot too
Bro it says import from github. How will I connect replit to railway
@bot.command(pass_context = True)
async def alts(ctx, username):
altApi = requests.get(f"http://api.antisniper.net/altfinder?key={key}&name={username}")
hpApi = requests.get(f"https://api.hypixel.net/player?key={hpkey}&name={username}")
altjson = altApi.json()
hpjson = hpApi.json()
names = []
names.append(f'alt(ign)')
if hpjson['player'] is None:
embed = discord.Embed(title="Dewier Bot", description=(f"Cannot find a player with the name ``{username}``"), color=(0x0b0909))
await ctx.send(embed=embed)
else:
for alt in altjson['results']:
embed = discord.Embed(title = "Dewier Bot", description = (f'(names)'), color = (0x0b0909))
await ctx.send(embed = embed)
bot.run("*")```
how would i make it send the message only after the loop is finished
Everything I contribute on your ass stops working on it
Look, this isn't the correct channel for this question. Join their support server on discord
Send link in dms
See from their website
Don't use requests
what would i use
use httpx/aiohttp
The bot was finished 👁️👁️
how
Just look at their docs bro
!blocking
Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.
What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:
import discord
# Bunch of bot code
async def ping(ctx):
await ctx.send("Pong!")
What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.
async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!
It's blocking
No that's a lie, don't start your day with a lie, you can't/won't finish shit
👀 You both know, DMs is a better place to discuss these things, right?
I'll finish the wrapper at least ok
do i just import aiohttp
Lmao I can understand when the motivation is lost to continue working on things anymore
We gonna see
Sure
I do expect weekly maintenances.
dpy comes with it
then it iwll work?
every hour atleast
LMAO
😔
now that I have been active in #discord-bots for this long (less than minute) I can go
it says NameError: name 'requests' is not defined
No it won't, you can store all the embeds you make in a list and send them all together
Haha cya
cya
Like all sync libraries should respond
Use aiohttp bro
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
how do i make a request with it
there are examples in the docs, that's why I asked you to read it
What not happened here
how do i find the docs
i did
import aiohttp
from aiohttp_requests import requests
No session
i forbid
!d aiohttp.ClientSession use this?
what
class aiohttp.ClientSession(base_url=None, *, connector=None, cookies=None, headers=None, skip_auto_headers=None, auth=None, json_serialize=json.dumps, ...)```
The class for creating client sessions and making requests.
PoV: He doesn't know how to use aiohttp
They don't
while True:
await asyncio.sleep(30)
spammers.clear()
print("Cleared")
break
while True:
schedule.run_pending()
await asyncio.sleep(1)
Is there an option to run both while loops without stopping one of them
oh then maybe im on a different docs page
You know that this channel isn't the correct one to send these type of GIFs in reply to random messages, right? Also I was just stating facts
import aiohttp
import asyncio
async def main():
async with aiohttp.ClientSession() as session:
async with session.get('http://python.org') as response:
print("Status:", response.status)
print("Content-type:", response.headers['content-type'])
html = await response.text()
print("Body:", html[:15], "...")
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
``` first example my eyes
gotta fetch soap now
Rip
Those were not random 
It burns so i can concentrate on the pain rather than the code.
Works kinda like the rubber duck.
Okay what I just wanted to tell u is to please stop this difficult art of sending GIFs in reply to random messages and do the hard work of making the chat laugh since no one is laughing
I don't send gif to make people laugh 
i mean, there's nothing which is not understandable there...
guys !ot
AAAAAAAAAAAAAAAAH just.... stop it
Saying ot is kinda ot

!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
See, instantly puts me off.
but idk shit
Exactly, on-topic
Hy guys is that something possible in discord bot like
If i gave some command to a bot it work but in the meanwhile if someone gave commands it not processed that second command until first one got finished
My bot currently process one command at the time but when someone gave additional command it keep it in the background
I want something that after one command it sleep then take second command
!d discord.on_command ?
No documentation found for the requested symbol.
Ok will try
it takes in only one arg which is ctx
Ctx?? Is command list
ctx.bot.commands will return the list of commands
!d discord.ext.commands.Bot.commands
property commands: Set[discord.ext.commands.core.Command[discord.ext.commands.core.CogT, Any, Any]]```
A unique set of commands without aliases that are registered.
can someone help me switch something from requests to aiohttp
!d discord.ext.commands.Context.bot
The bot that contains the command being executed.
Not the correct channel, #❓|how-to-get-help
the docs have simple quickstarters
how do I check how long ago the last message was sent in a channel
use channel.history to get the last channel and use created_at on the message object u get
alr
i need a command idea
appreciate it
command idea for what
??
then you'll need to request an api that sends a random dog
pretty easy just use docs
request to the api*
both r correct
idk chief
!d discord.Member.guild_permissions
property guild_permissions: discord.permissions.Permissions```
Returns the member’s guild permissions.
This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").
This does take into consideration guild ownership and the administrator implication.
@discord.ext.commands.has_guild_permissions(**perms)```
Similar to [`has_permissions()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_permissions "discord.ext.commands.has_permissions"), but operates on guild wide permissions instead of the current channel permissions.
If this check is called in a DM context, it will raise an exception, [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage").
New in version 1.3.
!d discord.abc.GuildChannel.permissions_for also exists for better accuracy
permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role").
This function takes into consideration the following cases...
xd
it couldn't handle the request lol
sure
probably a 400
Restart the server its common
u can simply do if perms.send_messages and stuff
or if u wanna create a dict out of it, then just do dict()
ok im gonna try
!d disnake.Permissions.manage_threads
Returns True if a user can manage threads.
New in version 2.0.
i keep getting this error when i play music in a vc ```Ignoring exception in command play:
Traceback (most recent call last):
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\core.py", line 176, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\shake\AppData\Local\Programs\Python\music_bot.py", line 57, in play
player[(ctx.guild.id, default_stream_channel)] = await session.play(source)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\voice_client.py", line 601, in play
raise ClientException("Not connected to voice.")
disnake.errors.ClientException: Not connected to voice.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\bot_base.py", line 561, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\core.py", line 930, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\ext\commands\core.py", line 185, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: Not connected to voice.```
it worked before, now it says im not connected when my bot IS connected to the vc
Well the error says the bot isn't in a VC
it IS tho
async def remind(ctx, time, *, task):
def convert(time):
pos = ['s', 'm', 'h', 'd']
time_dict = {"s": 1, "m": 60, "h": 3600, "d": 3600 * 24}
unit = time[-1]
if unit not in pos:
return -1
try:
val = int(time[:-1])
except:
return -2
return val * time_dict[unit]
converted_time = convert(time)
if converted_time == -1:
await ctx.send('You didn't answer the time properly')
return
if converted_time == -2:
await ctx.send('Time must be an integer and btw i hate maths')
return
await ctx.send(f'I have set a reminder for {task}, and will explode in {time}')
await asyncio.sleep(converted_time)
await ctx.author.send(f'You have set a reminder for {task}, OVER AND OUT! 3 ')
await ctx.author.send(f'You have set a reminder for {task}, OVER AND OUT! 2 ')
await ctx.author.send(f'You have set a reminder for {task}, OVER AND OUT! 1 ')
await ctx.author.send(f'Reminder for {task} is over.') ``` the remind command i add
recheck, the error says otherwise
@maiden fable , i did this ```py
session = await vc.connect()
vc is a verified voice channel
source = await disnake.FFmpegOpusAudio.from_probe('rickroll.mp3')
await session.play(source)``` essentially, it worked before but not now
weird
you can use elifs and you should use a db
to save the time and and the author and check the rows so you can use the command many times
nah
gaves suggestion to make the command better and having 2 if statements for the 2options is just not correct use elif
!d discord.Thread.pins
await pins()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves all messages that are currently pinned in the channel.
Note
Due to a limitation with the Discord API, the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") objects returned by this method do not contain complete [`Message.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message.reactions "discord.Message.reactions") data.
i asked if sameone from staff can do this im waitin for anwser
cool
keeps saying that the bot ISN'T connected to vc when it is, and i can't run the rickroll.mp3 in the vc
@slate swan helloooo
how can i edit bot message?
i want to edit my embed and this is what i use to send it
await channel.send(embed=embed)
why ping
msg = await send()
await msg.edit(...)
!d discord.Message.edit
await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
mhm
wait how can i edit specific bot message?
^^^
you can either fetch the message if you aren't sending it inside your command/whatever otherwise if you are, then do what hunter said
i have thic command, and get this error ```python
def check(m):
return m.channel == channel
msg = await j1mk0l.wait_for("message", check=check)
test = msg.content
#try:
mycursor.execute("DELETE FROM license WHERE name=test;")
mydb.commit()
Command raised an exception: ProgrammingError: 1054 (42S22): Unknown column 'test' in 'where clause'
i need to make it edit every minute i use
@tasks.loop(seconds=60)
async def test():
channel = bot.get_channel(id)
await channel.send(embed=embed)
did you mean Where name="test"
i dont want to send it over and over again
no because i want ti get the name from test = msg.content, which get it just fine
*test={msg.content}
Fetch the message and then edit it
See their test var
Isn't using f-strings with SQL bad
ah yes okay
it is
!sql-fstring
SQL & f-strings
Don't use f-strings (f"") or other forms of "string interpolation" (%, +, .format) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it presents a major security risk via SQL injection.
Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, safely.
For example, the sqlite3 package supports using ? as a placeholder:
query = "SELECT * FROM stocks WHERE symbol = ?;"
params = ("RHAT",)
db.execute(query, params)
Note: Different database libraries support different placeholder styles, e.g. %s and $1. Consult your library's documentation for details.
See Also
• Extended Example with SQLite (search for "Instead, use the DB-API's parameter substitution")
• PEP-249 - A specification of how database libraries in Python should work
O
O
omggg bozo!
with a discord bot, why do I have to set the embed thumbnail outside of the embed parameters?
class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").
For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
oh
I just assumed it had it because of this.
so why does discord.Embed(thumbnail={"url":"url"},description="test") not work?
that never would
because it doesn't have a thumbnail kwarg...?
the __init__ of Embed takes only colour, color, title ,type, url, description and timestamp
!d discord.Embed.set_thumbnail use this
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.
alright, thank you
wait whats type
!d discord.Embed.type
The type of embed. Usually “rich”. This can be set during initialisation. Possible strings for embed types can be found on discord’s api docs
@quick gust
ooh I see
discord/embeds.py lines 177 to 187
def __init__(
self,
*,
colour: Union[int, Colour, _EmptyEmbed] = EmptyEmbed,
color: Union[int, Colour, _EmptyEmbed] = EmptyEmbed,
title: MaybeEmpty[Any] = EmptyEmbed,
type: EmbedType = 'rich',
url: MaybeEmpty[Any] = EmptyEmbed,
description: MaybeEmpty[Any] = EmptyEmbed,
timestamp: datetime.datetime = None,
):```
Yea just saw
oh the message is deleted
because no member have their id in string form
pins[0].content.split()[-1] will always be a string
you need to use int(pins[0].content.split()[-1]) but that may fail too if the first word in the pin is not an number
*last
what can i use to get buttons and dropdowns
on discord
pycord???
ping me
@slate swan disnake
thank you
for buttons for sure
@cold sonnet simuliar to discord py?
yes
alright good
yes it's a fork
why this thing is happening?
BTW buttons are available for dpy 2.0
pip install disnake
!pypi disnake
@final iron how does list comp hurt your brain its easy
Idk I guess I was looking at the wrong materials
I understand it now
Its so easy
newlist = [expression for item in iterable if condition == True]
@final iron list comp are awesome 
This wont work.
pretty easy

dont use time.sleep
it will sleep on your whole bot and use listeners
Error:
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
and use
await asyncio.sleep(1)
haven't had a problem with time.sleep() on a command.
do time.sleep(100) and try to use your bot
Okay.
btw love your pfp
Thank you.
do embeds count as message attachments? and if so is there a way to exclude embeds when fetching the attachments
can anyone help me implementing slash commands in my bot
nope
can someone explain what is a hook here ?
Read the getting started page for your lib
I have read it all
and i have the code in my cog but when i type / it does not come up
i am aware of the wait time
ik
but i have waited for over a week
have you loaded the cog?
It shouldn't
if it worked python isnt a programming language
!blocking
Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.
What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:
import discord
# Bunch of bot code
async def ping(ctx):
await ctx.send("Pong!")
What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.
async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!
should read on async programming
stuff don't work like that
This isn't resolving a indentation problem.
you first did the command which then triggers the sleep which will sleep on the whole bot basic py
I know it's basic.
Imagine okimii not changing his name for a month
seems like you dont
i have done that
xD
your triggering a function once
Code?
whole code or just the cog
from pydoc import describe
from discord import Embed
import nextcord
from discord.ext.commands import Bot, Cog
from discord_slash import cog_ext, SlashContext
from nextcord.ext import commands
from nextcord import Embed
class slash(Cog):
def __init__(self, bot: Bot):
self.bot = bot
guild_ids = [930186574078017597]
@cog_ext.cog_slash(name="test", guild_ids=guild_ids)
async def _test(self, ctx: SlashContext):
embed = Embed(title="Embed Test")
await ctx.send(embed=embed)
@commands.Cog.listener()
async def on_ready(self):
print('Slash loaded!')
def setup(bot):
bot.add_cog(slash(bot))
Preferably the bot code like how you define it etc and a commands code
This is all the code?
dms
- did you added the cog
- did you load the cog
- global slash commands take about an hour to register
- does your bot have application commands scope
5.if you dont want slash commands globally use the test_guilds kwarg
for vc
just the cog
5 answers and i get ignored smh
I've coded in python for 2 years.
I can do more with the bot code not cogs.
- yes
- yes
- i have waited for over a week
- yes
and you dont know how functions work?
dms?
I do.
Guy's let's be nice.
idk chief seems like you have something wrong
somebody help me download disnake
dms plssplslspls
Please don't ask us to go into dm, this channel exists for a reason.
pip install disnake
I've made 15 bots in python.
ive tryed
@slate swan
Sorry
your using on msg for commands ok 😭
Guys please?
hi. i have this command and get this error```python
sql = "INSERT INTO customers (name, code) VALUES (%s,%s)"
val = (user,test)
mycursor.execute(sql, val)
mydb.commit()
Command raised an exception: MySQLInterfaceError: Python type Member cannot be converted
++ in redeem mycursor.execute(sql, val)
just saying you should read docs
Hey @knotty badger!
It looks like you tried to attach file type(s) that we do not allow (.rar). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
it cant convert the obj
You can't insert full objects to sql
upgrade pip and restart your editor
This is pycharm right?
No hold on.
mhm?
Yeah. I've used it a couple times.
Then why are you using cmd?
pycharm uses envs
lol
look
I should've never asked in here. Becuase this is making me mad.
what happened?
Input the pip command inside the pycharm console.
its for other people
input isnt very async sir
Most likely this is for the config.
mhmmmm i see i mean thats cool ig
To be honest if people can't read a simple .yaml file they shouldn't host bots.
so he wants to make like a template
okimii ❤️
hii
I asked for help on a indent error. And he basically was telling me something not remotley close to my error. About why I used time.sleep()
lmfao
xd im getting paid and the person isnt exactly a progrmmer
scroll up
ok
oof, did you get an answer?
yea he did
Can you re-ask the question instead of provoking okimii?
Okimii G.O.D.
Well no.
Nope.
smh
scroll up 
time.sleep isnt async but he says it is
Well time.sleep() will break your bot
leave it
!d asyncio.sleep exists
coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.
If *result* is provided, it is returned to the caller when the coroutine completes.
`sleep()` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.
Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.
Example of coroutine displaying the current date every second for 5 seconds:
for a reason
yaml is like a txt file it's easier than word ;-;
I know?
microsoft word = amazing IDE
i know its really stupid but:
well look at that
what do people not get about adding onto people's point
no, Vim
shit I was looking at "select an activity" lmfao
Its an indention error not a function error.
and typed out activity by mistake
Not for one second I've used it before.
I use it too for debugging sometimes dw
so you cant fix an indentation error and i told you not to use time.sleep or you want your bot to stop working everytime it gets used?
alright lets get down to business
It's not that I need help on a different problem than a function.
I mean...you ~~could tell him that after you help him with indents
~~
Too late I'm annoyed.
disnake
this is a helping channel were trying to help you?
not installing rip
patience, my okimii.
I have none so I cant say much
!pypi rip
i am a stupid person i kn
install rip 😠
im just a noob after all
🧢
rip = rest in peices
Thats run console. You need to type it in terminal
no noo
HAHAHAH where is it
please tell me
👁️ 👁️
😳
ey
this guy is a genuis
why do list comps hurt your brain
they're pretty fun
That was from yesterday
bro
you not gonna talk like that to my homie 
you cant pip install on input
I understand them now
ima change my name
:((
but......but......I'm too rude
ash is the time of female to not subclass View
....
stop treating women like objects
no comments
😳
wut
😭
alrigth how install discord py 2.9

children inherit stuff from their parent class
Ashley you're beginning to happen to be the discord.Client between the discord.ext.commands.Bots
a.k.a the mother
yes
lame
ash is the type of female to subclass Client
You guys are so trying to keep the chat to discord bots
shit
mina is after me
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
F.U.N.N.Y.
if I go ot she's gonna kill me
thanks
lol
who's mina
its alright, dont get high-headed about it
she's gonna birbo stabbo me
nice ip
minaberry
minaberry
oh
she's a goat
nice IP bro 😎
atleast she touches grass unlike me
go touch grass
yes bro
ok omw
i wanna teah mina dpy but she doesnt have the time😠
it might be a long journey, but I'll be back
Why are you freezing your bot
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
is the dev server still up?
😦
didnt need an opinion but fine
I'll go speak to fist instead
smh

Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
he started sending that a lot recently
👁️ 👁️
Changed my name
lmao
cap
@slate swan caeden still hasnt finished his paragraph lmfao
No cap
I'm boutta slap you
still waiting
try me
reaches through the screen
👁️ 👁️
slaps
I seeee you
!ot 
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.

you and ash smh
WOAH no swear

?
I swear to myself 😦
it shows your development server port
OMFG IT DOESNT FREEZE
*replit's
Cool.
sure it doesnt
you know nothing about asynchronous programming
If it doesn't freeze then python is broken
S**w off.
i know my stuff
completely asynchronous 
okimii , dont be caeden
what does s**w off mean
you don't need to asterix' it
hes saying pure miss information
*misinformation
like 7 times
😳
miss information
he did miss information ig
im tired of class give me a break
idk about saying miss information
are you in class?
i was
is it break time?
no im done
ok
lol
what are you done with
with class?
i wouldn't do such a thing
lol
yes
Why is this a GIF chat...
lol
I moved to ot ok
This is a valid payload for mobile status right?
payload = {
'op': self.IDENTIFY,
'd': {
'token': self.token,
'properties': {
'$os': sys.platform,
'$browser': 'foo',
'$device': 'Discord Android',
'$referrer': '',
'$referring_domain': ''
},
'compress': True,
'large_threshold': 250,
'v': 3
}
}
?
Was messing around in discord.gateway.DiscordWebSocket.identify
This is confusing 
Yea iirc
What's confusing tho?
Wait why is v 3?
Like I get an desktop online status
that green dot or the pea looking thing
Mhm
Was patching pycord
Ah u need mobile status
yes
A monkey patch snippet which was found online and edited actually worked
which was my main incentive
So it works?
No, patching the file directly doesn't work for some reason, but monkey patching it with a random snippet I found online worked (with some mild modifications) :
def get_mobile():
"""
The Gateway's IDENTIFY packet contains a properties field, containing $os, $browser and $device fields.
Discord uses that information to know when your phone client and only your phone client has connected to Discord,
from there they send the extended presence object.
The exact field that is checked is the $browser field. If it's set to Discord Android on desktop,
the mobile indicator is is triggered by the desktop client. If it's set to Discord Client on mobile,
the mobile indicator is not triggered by the mobile client.
The specific values for the $os, $browser and $device fields are can change from time to time.
"""
import ast
import inspect
import re
import discord
def source(o):
s = inspect.getsource(o).split("\n")
indent = len(s[0]) - len(s[0].lstrip())
return "\n".join(i[indent:] for i in s)
source_ = source(discord.gateway.DiscordWebSocket.identify)
patched = re.sub(
r'([\'"]\$browser[\'"]:\s?[\'"]).+([\'"])',
r"\1Discord Android\2",
source_,
)
loc = {}
exec(compile(ast.parse(patched), "<string>", "exec"), discord.gateway.__dict__, loc)
return loc["identify"]
And this is what I did in the main file :
import discord
import os
from discord.ext import commands
from mobile_status import get_mobile
discord.gateway.DiscordWebSocket.identify = get_mobile()
bot = commands.Bot(command_prefix="foo")
@bot.event
async def on_ready():
print(f"Sucessfully logged in as {bot.user}")
bot.run(os.getenv("DISCORD_TOKEN"))
And it actually worked, god knows why 
Hmm, I do remember that patching the ready/connect payload in the gateway.py file does that
me too, I asked some folk at nextcord to double check and they said yes
I used to inspect module to see if everything was applied (obviously) and it was
This is what I found in the dpy server ¯_(ツ)_/¯
async def mobile(self):
import sys
payload = {'op': self.IDENTIFY,'d': {'token': self.token,'properties': {'$os': sys.platform,'$browser': 'Discord iOS','$device': 'discord.py','$referrer': '','$referring_domain': ''},'compress': True,'large_threshold': 250,'v': 3}}
if self.shard_id is not None and self.shard_count is not None:
payload['d']['shard'] = [self.shard_id, self.shard_count]
state = self._connection
if state._activity is not None or state._status is not None:
payload["d"]["presence"] = {"status": state._status, "game": state._activity, "since": 0, "afk": False}
if state._intents is not None:
payload["d"]["intents"] = state._intents.value
await self.call_hooks("before_identify", self.shard_id, initial=self._initial_identify)
await self.send_as_json(payload)
discord.gateway.DiscordWebSocket.identify = mobile
Ah browser should be Discord iOS
Yea I tried iOS as well, didn't work
oh snap
Nvm both device and browser are set to Discord Android
Lol
lemme try ios then with both
Sure
Lol
@lunar quail works?
nope
Show code
payload = {
'op': self.IDENTIFY,
'd': {
'token': self.token,
'properties': {
'$os': sys.platform,
'$browser': 'Discord iOS',
'$device': 'pycord',
'$referrer': '',
'$referring_domain': ''
},
'compress': True,
'large_threshold': 250,
'v': 3
}
}
waiting for previous online ack to finish for accurate results 
looks done now
Works?

