#discord-bots

1 messages · Page 784 of 1

primal salmon
#

yep

slate swan
#

¯_(ツ)_/¯

velvet tinsel
#

¯_(ツ)_/¯

cloud dawn
primal salmon
#

imma do blacklisted word,kick,mute and temp tomorrow

velvet tinsel
#

ok

primal salmon
#

joe_8bit and then imma learn how to make the disboard or something idk

velvet tinsel
#

add more stuff as well

rancid stump
#

like that ?

velvet tinsel
#

bro

#

== None 😭

primal salmon
velvet tinsel
#

PEP8 wants a word with you shipit

primal salmon
#

wait what

slate swan
primal salmon
#

didnt they said message.guild : return?

slate swan
#

yep

#

and dont use it with the and

primal salmon
#

do it on the next line

rancid stump
primal salmon
#

is it? xD

fresh notch
primal salmon
velvet tinsel
slate swan
#

guild_only is a decorator from commands , guild is an attribute of Message

rancid stump
#

it works!!!!

#

but without not

#

thx buddys

slate swan
#

the condition with not was supposed to be a standalone statement , but since you used it with and not is not required

leaden jasper
#

perfect thanks

#

is a member in all servers called user?

slate swan
#

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

waxen meteor
#

Hey can you tell me how to make delete channel command using discord py

slate swan
#

brb

waxen meteor
#

await ctx.delete..?

cloud dawn
unkempt canyonBOT
#

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.
slate swan
#

ctx.channel.delete works if you want to delete the current channel

slate swan
waxen meteor
#
@bot.command() 
async def delete(ctx) :
   await ctx.channel.delete() 
#

Like this?

slate swan
#

yea it will delete the channel command was used in

waxen meteor
#

K

cloud dawn
slate swan
cloud dawn
quaint epoch
#

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

cloud dawn
#

No i mean clean this chat lol

quick gust
#

he is asking you to delete the traceback since u figured it out I believe

quaint epoch
cloud dawn
#

Thanks :3

rancid stump
#

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 ?

quaint epoch
final iron
#

!d discord.VoiceChannel.connect

unkempt canyonBOT
#

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").
final iron
#

@quaint epoch

slate swan
#

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

maiden fable
#

!d discord.on_interaction

unkempt canyonBOT
#

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.
slate swan
#

nvm , discord_components library 😑

#

yh#

#

forgot to mention that

waxen meteor
#

Can you tell me in how many servers can a bot join if the bot is hosted by using replit

maiden fable
#

It can join the same amount of servers any other bot can

slate swan
#

theres no specific amount it could be in 100k

#

but repl isnt a recommended host

maiden fable
slate swan
waxen meteor
#

I mean at least tell me the number( without lagging)

slate swan
#

69

maiden fable
#

Hmm

waxen meteor
#

K done

slate swan
#

theres not rlly a specific amount for laggy its just repl isnt a good host

maiden fable
#

Yea

slate swan
#

^

maiden fable
#

Use heroku and every week, just tell people there's a downtime of 2 days to keep yr bot running whole month

#

Ezzz

slate swan
#

heroku isnt designed for hosting bots though its ok

maiden fable
#

Was meant as a joke but okay

slate swan
#

ok

cloud dawn
#

i got a hosting for 6 bucks a month

#

worth the education you get from it.

slate swan
maiden fable
cloud dawn
maiden fable
#

As long as u got a credit card

#

24 GB RAM, 4 vCores iirc

final iron
#

I coughed up $60 and now have unlimited hosting

maiden fable
#

Enough to run a small hosting service lmao

final iron
maiden fable
final iron
#

Yeah

maiden fable
#

The reason I didn't accept it is cz I ain't got a cc

final iron
#

Jesus

#

That's a ton

maiden fable
#

For free

final iron
#

Where's the catch?

maiden fable
#

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

final iron
#

Damn

#

I already coughed up the money for a raspberry pi

maiden fable
#

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

waxen meteor
#

Hello send me discord py server

maiden fable
final iron
#

My power and internet don't go down that often

blazing beacon
#

hunter having an identity crisis

maiden fable
#

yr wish ¯_(ツ)_/¯

maiden fable
#

I know who u r

waxen meteor
#

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

maiden fable
#

Depends on the bot

final iron
#

How can Oracle afford to offer those services for free

waxen meteor
maiden fable
#

Idk

final iron
#

¯\_(ツ)_/¯

waxen meteor
slate swan
#

replit barely provides you with 150 mb ram iirc

slate swan
#

its a webserver

waxen meteor
#

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

slate swan
#

that doesnt change the cache , but will for sure make the bot make less API reqs

#

oh

waxen meteor
#

Any guess

slate swan
#

i had a bot hosted with replit which was in 45 servers

#

and it worked decently

waxen meteor
#

Oh

#

But my bot got crashed when someone invited it . Mainly joined 5 servers

#

Probably someone spammed commands

waxen meteor
quick gust
#

i have this for free 💀

waxen meteor
slate swan
slate swan
devout iris
#

How to choose an user from a reactioned message? Like a giveaway bot

slate swan
#

!d discord.Reaction.users you can get a list of the users who reacted , and use random.choice

unkempt canyonBOT
#

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}!')
```...
devout iris
#

Ty

fresh orchid
#

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

valid galleon
#

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')```
valid galleon
tacit token
#
    @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?

waxen meteor
#

Is it ok if I host my bot by using my website?

maiden fable
#

ig? Depends on where yr website is hosted and if the hoster supports Python

tacit token
maiden fable
#

How u using the cmd?

tacit token
#

?

maiden fable
#

what u writing in the chat

#

!d discord.Message.clean_content

unkempt canyonBOT
#

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.

maiden fable
#

Thought so

#

It is the clean_content that is converting the mention to name

tacit token
#

and i how to change clean_content to discord.User?

#

discord.User works

maiden fable
#

_ballInpit: discord.User

waxen meteor
#

So is it ok if I use replit and host my bot in vps so I can add it in many servers?

maiden fable
waxen meteor
tacit token
maiden fable
maiden fable
tacit token
#

nothing error

maiden fable
#

u got an error handler?

waxen meteor
#

Isn't it good

maiden fable
#

Your bot will be online only for 22 days per month

waxen meteor
#

Oh

maiden fable
#

in the free version

waxen meteor
#

Atleast. I can add it in many servers though

maiden fable
#

try looking into railway

#
Railway

Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.

waxen meteor
#

Like 1k servers?

maiden fable
#

It is more or less like discord, but less popular so the bot shouldn't get ratelimited easily

devout iris
#

How can i make that?

maiden fable
# waxen meteor Like 1k servers?

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

maiden fable
maiden fable
waxen meteor
tacit token
maiden fable
#

Bruh, it depends on yr bot, but I have seen a few big bots like in 50 servers or smth being hosted there

winter tree
#

ryphal

maiden fable
winter tree
#

hllo bruh

maiden fable
winter tree
#

i kinda

maiden fable
#

Hm?

winter tree
#

stucked in a problem

waxen meteor
maiden fable
#

Sure ask it right away

neat pagoda
#

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?

winter tree
#

my vs codes not working proparly

maiden fable
neat pagoda
maiden fable
winter tree
#

when i hit any command

maiden fable
#

BTW congrats on getting yr bot verified! @neat pagoda

waxen meteor
maiden fable
winter tree
#

it shows the result in terminal

neat pagoda
winter tree
#

and not working as python script

waxen meteor
waxen meteor
maiden fable
tacit token
winter tree
maiden fable
neat pagoda
#

lol

#

that sucks

maiden fable
neat pagoda
#

I have one

maiden fable
winter tree
#

if you wanna listen songs

#

you can join radio

neat pagoda
#

gtg bye, thx for the help @maiden fable

waxen meteor
maiden fable
#

All cool

tacit token
#

the problem is not the error handler

winter tree
#

as well😅

maiden fable
waxen meteor
maiden fable
maiden fable
winter tree
#

isn't it

cold sonnet
maiden fable
#

???

maiden fable
#

I noticed the BOT tag from the bd client

waxen meteor
#

Xd so I don't have to verify

waxen meteor
maiden fable
#

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.

waxen meteor
maiden fable
#

Like the bot is trying to access more RAM but its already using 100% RAM

winter tree
#

is there any one who uses ubantu

maiden fable
#

Then it won't be able to save more data and can/will lag

waxen meteor
maiden fable
slate swan
#

railway is also made to support web servers, not discord bots

waxen meteor
maiden fable
slate swan
maiden fable
waxen meteor
maiden fable
#

Oh it still doesn't work?

slate swan
#

look you should google what backend means by yourself, this isn't the channel to discuss that

maiden fable
#

@slate swan

winter tree
#

bruh you are really uncool

maiden fable
#

Me?

winter tree
#

you know

slate swan
#

just understand that discord bots are not something that railway supports

winter tree
#

you just give the link

#

or else

maiden fable
#

Damn

winter tree
#

i totaly lost

maiden fable
#

Lemme see

#

!d disnake.Thread.owner

unkempt canyonBOT
quaint epoch
#

!d disnake.ext.commands.Bot.voice_clients

unkempt canyonBOT
#

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.
winter tree
#

in another chats

maiden fable
#

threads are a dpy 2.0 thing

waxen meteor
# maiden fable Damn

So how can I know. How many storage my code is taking in replit? And replit don't have ram stuff?

maiden fable
# winter tree in another chats

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

winter tree
#

i also think

#

i am a garbage😢

quaint epoch
#

would this work? ```py
session = await vc.connect()
await session.disconnect()

To leave the vc```

maiden fable
#

1.) This ain't the correct channel
2.) No you aren't don't think like that (:

maiden fable
unkempt canyonBOT
#
Not in my house!

No documentation found for the requested symbol.

maiden fable
#

!d discord.VoiceClient.disconnect

unkempt canyonBOT
#

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.
maiden fable
#

There

winter tree
#

i want to improve my skills

#

so where do i find my charm

maiden fable
#

!resources got some cool resources to help u improve your Python skills

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

winter tree
#

🤓

maiden fable
#

Click on the link

#

The role is below the bot's highest role and the bot got Manage Roles permission, right?

winter tree
#

okk

#

done bruh thanks

maiden fable
#

Lemme ask from the disnake devs

#

Try asking the question there

#

In the disnake server

#

Wait

#

@slate swan

winter tree
#

it shows to many options broh

maiden fable
#

u r on the older version

winter tree
#

showing try

#

read

maiden fable
#

Try updating

winter tree
#

guide

winter tree
#

bruh

maiden fable
#

2.3.0 is the newer version

winter tree
#

i already knows about git

subtle patio
#

what do you guys think is the best lib in discord rn?

winter tree
#

it is teaching me

maiden fable
#

pip install -U disnake

maiden fable
subtle patio
maiden fable
#

Da Fak

#

Mind sharing the link of the logging output again?

pliant gulch
#

You def don't want to use Rin right now

maiden fable
#

Not stable?

pliant gulch
#

Stable, not a lot of models

maiden fable
#

Ah

pliant gulch
#

Stable as in stability with the gateway

#

Other than reconnection as I haven't added that

grim oar
#

Andywares are never stable

maiden fable
#

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.

grim oar
maiden fable
#

LMAO

#

Lmao

pliant gulch
grim oar
#

Nino

cloud dawn
#

ngl that is kinda sounds like you changed something

maiden fable
#

@slate swan want the invite to the disnake server?

pliant gulch
maiden fable
pliant gulch
cloud dawn
#

😂 just messing lol

grim oar
maiden fable
#

LMAO

#

You both should probably take it to DMs

cloud dawn
pliant gulch
#

Osu wrapper was a POC

#

I just never finished

maiden fable
grim oar
#

The bot too

waxen meteor
sonic flax
#

@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
grim oar
#

Everything I contribute on your ass stops working on it

maiden fable
waxen meteor
#

Send link in dms

maiden fable
#

See from their website

sonic flax
grim oar
#

use httpx/aiohttp

pliant gulch
sonic flax
grim oar
#

Just look at their docs bro

sonic flax
#

whats wrong with requests?

#

also will that fix it

cloud dawn
unkempt canyonBOT
#

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!

grim oar
#

It's blocking

grim oar
maiden fable
#

👀 You both know, DMs is a better place to discuss these things, right?

pliant gulch
#

I'll finish the wrapper at least ok

sonic flax
maiden fable
#

Lmao I can understand when the motivation is lost to continue working on things anymore

grim oar
grim oar
cloud dawn
grim oar
#

dpy comes with it

sonic flax
#

then it iwll work?

maiden fable
#

🤣

#

Weekly or daily 👀

tawdry perch
#

every hour atleast

maiden fable
#

LMAO

pliant gulch
tawdry perch
#

now that I have been active in #discord-bots for this long (less than minute) I can go

sonic flax
grim oar
maiden fable
#

Haha cya

tawdry perch
#

cya

cloud dawn
grim oar
maiden fable
#

!d discord.TextChannel.purg

#

!d discord.TextChannel.purge

unkempt canyonBOT
#

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...
sonic flax
grim oar
sonic flax
#

i did
import aiohttp
from aiohttp_requests import requests

cloud dawn
#

i forbid

slate swan
#

!d aiohttp.ClientSession use this?

sonic flax
unkempt canyonBOT
#
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.
maiden fable
cloud dawn
slate swan
cloud dawn
fresh orchid
#
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

slate swan
maiden fable
cloud dawn
# slate swan oh then maybe im on a different docs page
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

maiden fable
#

Rip

slate swan
#

wait what

#

soap for eyes?

cloud dawn
#

Works kinda like the rubber duck.

maiden fable
keen talon
slate swan
grim oar
#

guys !ot

maiden fable
cloud dawn
keen talon
maiden fable
#

!ot

unkempt canyonBOT
cloud dawn
#

See, instantly puts me off.

grim oar
rancid stump
#

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

unkempt canyonBOT
#
Not in a million years.

No documentation found for the requested symbol.

maiden fable
#

Rip

#

Use the on_command event ig

rancid stump
maiden fable
#

it takes in only one arg which is ctx

rancid stump
maiden fable
#

ctx.bot.commands will return the list of commands

#

!d discord.ext.commands.Bot.commands

unkempt canyonBOT
#

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.
sonic flax
#

can someone help me switch something from requests to aiohttp

maiden fable
#

!d discord.ext.commands.Context.bot

unkempt canyonBOT
potent spear
sacred sigil
#

how do I check how long ago the last message was sent in a channel

slate swan
#

use channel.history to get the last channel and use created_at on the message object u get

#

alr

#

i need a command idea

slate swan
#

somebody help, dont say make a help command

#

bc i have no commands

#

PING ME

sacred sigil
slate swan
#

idk bro i just need a command

#

for my bot

sacred sigil
#

??

slate swan
#

like uh

#

$dog

#

or something

sacred sigil
#

then you'll need to request an api that sends a random dog

slate swan
#

i mean like

#

i need a command idea

#

$dog would be the worst command

slate swan
slate swan
maiden fable
slate swan
#

idk chief

maiden fable
#

!d discord.Member.guild_permissions

unkempt canyonBOT
#

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.
maiden fable
#

there is also a check

#

!d discord.ext.commands.has_guild_permissions

unkempt canyonBOT
#

@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.
maiden fable
#

!d discord.abc.GuildChannel.permissions_for also exists for better accuracy

unkempt canyonBOT
#

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...
slate swan
slate swan
maiden fable
#

sure

slate swan
#

probably a 400

maiden fable
#

u can simply do if perms.send_messages and stuff

#

or if u wanna create a dict out of it, then just do dict()

slate swan
maiden fable
#

!d disnake.Permissions.manage_threads

unkempt canyonBOT
slate swan
#

but i cant even restart server i think

#

or run the bot

maiden fable
#

Hmm tell the staff to force restart the server then

#

danbot rip

slate swan
#

ok

#

and i just only add one command tuday

quaint epoch
#

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

maiden fable
#

Well the error says the bot isn't in a VC

quaint epoch
slate swan
#
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
maiden fable
quaint epoch
#

@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

maiden fable
#

weird

slate swan
#

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

maiden fable
#

!d discord.Thread.pins

unkempt canyonBOT
#

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.
slate swan
maiden fable
#

cool

quaint epoch
#

keeps saying that the bot ISN'T connected to vc when it is, and i can't run the rickroll.mp3 in the vc

velvet tinsel
#

@slate swan helloooo

tardy plume
#

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)
maiden fable
#

why ping

maiden fable
#

!d discord.Message.edit

unkempt canyonBOT
#

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.
tardy plume
#

ah ok

#

inside edit(here) is the new embed like this edit(embed=embed2)?

maiden fable
#

mhm

tardy plume
#

wait how can i edit specific bot message?

maiden fable
quick gust
#

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

river flare
#

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'

tardy plume
#

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)
grim oar
tardy plume
#

i dont want to send it over and over again

river flare
grim oar
#

Then use f string

#

f"... WHERE name={test}"

quick gust
final iron
grim oar
final iron
#

Isn't using f-strings with SQL bad

quick gust
quick gust
final iron
#

!sql-fstring

unkempt canyonBOT
#

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

grim oar
#

O

pulsar shell
#

O

grim oar
#

omggg bozo!

slate swan
#

with a discord bot, why do I have to set the embed thumbnail outside of the embed parameters?

final iron
#

No thumbnail kwarg

#

!d discord.Embed

unkempt canyonBOT
#

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.
slate swan
#

oh

slate swan
quick gust
#

thats an attribute

#

embed.thumbnail

slate swan
#

so why does discord.Embed(thumbnail={"url":"url"},description="test") not work?

#

that never would

quick gust
#

because it doesn't have a thumbnail kwarg...?

slate swan
#

the __init__ of Embed takes only colour, color, title ,type, url, description and timestamp

#

!d discord.Embed.set_thumbnail use this

unkempt canyonBOT
#

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.
quick gust
#

wait whats type

final iron
#

!d discord.Embed.type

unkempt canyonBOT
#

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

final iron
#

@quick gust

quick gust
unkempt canyonBOT
#

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,
):```
maiden fable
#

Yea just saw

slate swan
#

oh the message is deleted

maiden fable
#

I misinterpreted

#

by these lines

slate swan
#

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

cold sonnet
#

@slate swan disnake

slate swan
#

thank you

cold sonnet
#

for buttons for sure

slate swan
#

@cold sonnet simuliar to discord py?

cold sonnet
#

yes

slate swan
#

alright good

quick gust
slate swan
#

:)))

tardy plume
#

why this thing is happening?

maiden fable
#

BTW buttons are available for dpy 2.0

slate swan
#

how do i install disnake

#

someone help

#

ping pls

final iron
slate swan
#

!pypi disnake

unkempt canyonBOT
slate swan
#

@final iron how does list comp hurt your brain its easy

final iron
#

I understand it now

#

Its so easy

slate swan
keen talon
#

@final iron list comp are awesome pithink

peak loom
#

This wont work.

slate swan
#

pretty easy

keen talon
slate swan
#

it will sleep on your whole bot and use listeners

peak loom
#

Error:

slate swan
#

!indents

unkempt canyonBOT
#

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

slate swan
#

and use

await asyncio.sleep(1)
peak loom
slate swan
peak loom
slate swan
peak loom
flat solstice
#

do embeds count as message attachments? and if so is there a way to exclude embeds when fetching the attachments

keen talon
slate swan
knotty badger
#

can anyone help me implementing slash commands in my bot

desert cosmos
#

can someone explain what is a hook here ?

final iron
knotty badger
#

and i have the code in my cog but when i type / it does not come up

knotty badger
#

i am aware of the wait time

peak loom
#

ik

slate swan
knotty badger
#

but i have waited for over a week

slate swan
#

have you loaded the cog?

peak loom
#

It works.

final iron
#

It shouldn't

slate swan
#

if it worked python isnt a programming language

cloud dawn
slate swan
#

!blocking

unkempt canyonBOT
#

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!

slate swan
#

should read on async programming

peak loom
slate swan
#

stuff don't work like that

slate swan
peak loom
#

This isn't resolving a indentation problem.

slate swan
#

you first did the command which then triggers the sleep which will sleep on the whole bot basic py

cloud dawn
#

Imagine okimii not changing his name for a month

slate swan
slate swan
#

your triggering a function once

cloud dawn
#

🥳

knotty badger
#

🥳

cloud dawn
knotty badger
#

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))
cloud dawn
slate swan
#

why is disnake not installing

#

somebody help me

slate swan
#

dms

slate swan
# knotty badger whole code or just the cog
  1. did you added the cog
  2. did you load the cog
  3. global slash commands take about an hour to register
  4. does your bot have application commands scope
    5.if you dont want slash commands globally use the test_guilds kwarg
#

for vc

slate swan
#

5 answers and i get ignored smhpithink

peak loom
cloud dawn
knotty badger
slate swan
knotty badger
peak loom
cloud dawn
#

Guy's let's be nice.

slate swan
#

somebody help me download disnake

#

dms plssplslspls

cloud dawn
#

Please don't ask us to go into dm, this channel exists for a reason.

slate swan
peak loom
#

I've made 15 bots in python.

slate swan
#

ive tryed

peak loom
#

@slate swan

slate swan
cloud dawn
#

Guys please?

river flare
#

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)

slate swan
#

just saying you should read docs

unkempt canyonBOT
#

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.

slate swan
cloud dawn
slate swan
slate swan
cloud dawn
slate swan
#

yeah

#

yes

cloud dawn
slate swan
peak loom
cloud dawn
slate swan
#

lol

peak loom
#

I should've never asked in here. Becuase this is making me mad.

slate swan
cloud dawn
slate swan
#

its for other people

slate swan
cloud dawn
slate swan
cloud dawn
#

To be honest if people can't read a simple .yaml file they shouldn't host bots.

slate swan
#

so he wants to make like a template

velvet tinsel
slate swan
peak loom
# slate swan what happened?

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()

slate swan
slate swan
velvet tinsel
slate swan
#

youll see

#

im not wrongpithink

slate swan
cloud dawn
slate swan
peak loom
peak loom
slate swan
#

smh

slate swan
velvet tinsel
#

ohh shit

slate swan
#

time.sleep isnt async but he says it ispithink

final iron
velvet tinsel
unkempt canyonBOT
#

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:
velvet tinsel
#

for a reason

cloud dawn
final iron
velvet tinsel
slate swan
#

i know its really stupid but:

velvet tinsel
slate swan
velvet tinsel
#

shit I was looking at "select an activity" lmfao

peak loom
slate swan
#

¯_(ツ)_/¯

velvet tinsel
#

and typed out activity by mistake

peak loom
cloud dawn
slate swan
#

alright lets get down to business

peak loom
velvet tinsel
slate swan
#

disnake

slate swan
#

not installing rip

velvet tinsel
#

patience, my okimii.

I have none so I cant say much

velvet tinsel
unkempt canyonBOT
slate swan
#

i am a stupid person i kn

velvet tinsel
#

install rip 😠

slate swan
#

im just a noob after allpithink

slate swan
#

rip = rest in peices

final iron
velvet tinsel
#

no noo

slate swan
#

please tell me

slate swan
#

🔫

final iron
velvet tinsel
#

🔪 or 🔫

slate swan
#

👁️ 👁️

velvet tinsel
#

😳

cold sonnet
slate swan
#

this guy is a genuis

velvet tinsel
slate swan
velvet tinsel
#

they're pretty fun

final iron
velvet tinsel
cold sonnet
slate swan
final iron
#

I understand them now

velvet tinsel
slate swan
#

:((

slate swan
#

ash is the time of female to not subclass View

#

....

velvet tinsel
slate swan
#

no comments

velvet tinsel
#

😳

slate swan
#

😭

#

alrigth how install discord py 2.9

slate swan
velvet tinsel
cold sonnet
#

Ashley you're beginning to happen to be the discord.Client between the discord.ext.commands.Bots

velvet tinsel
#

a.k.a the mother

cold sonnet
#

lame indeed

slate swan
#

ash is the type of female to subclass Client

#

You guys are so trying to keep the chat to discord bots

velvet tinsel
unkempt canyonBOT
slate swan
velvet tinsel
#

if I go ot she's gonna kill me

slate swan
slate swan
cold sonnet
#

who's mina

slate swan
velvet tinsel
slate swan
#

nice ip

slate swan
velvet tinsel
cold sonnet
#

oh

slate swan
slate swan
#

very cool person

velvet tinsel
#

nice IP bro 😎

cold sonnet
velvet tinsel
slate swan
cold sonnet
#

ok omw

slate swan
#

i wanna teah mina dpy but she doesnt have the time😠

cold sonnet
#

it might be a long journey, but I'll be back

final iron
#

Why are you freezing your bot

unkempt canyonBOT
velvet tinsel
#

is the dev server still up?

slate swan
#

ash is such a lovely person

#

thanks

velvet tinsel
slate swan
#

didnt need an opinion but fine

velvet tinsel
#

ok

#

I'm alone now

slate swan
#

👁️ 👁️

#

okimii and his eyes

velvet tinsel
#

I'll go speak to fist instead

slate swan
#

smh

slate swan
unkempt canyonBOT
velvet tinsel
slate swan
final iron
#

Changed my name

slate swan
#

lmao

slate swan
velvet tinsel
#

@slate swan caeden still hasnt finished his paragraph lmfao

final iron
slate swan
#

you havent seen my functions right?

#

i follow pep8 for everything

final iron
#

I'm boutta slap you

slate swan
velvet tinsel
slate swan
velvet tinsel
#

slaps

velvet tinsel
final iron
slate swan
#

!ot Exit

unkempt canyonBOT
slate swan
slate swan
velvet tinsel
#

SHIT

slate swan
peak loom
velvet tinsel
velvet tinsel
peak loom
slate swan
#

*replit's

peak loom
slate swan
#

you know nothing about asynchronous programming

final iron
peak loom
slate swan
slate swan
slate swan
velvet tinsel
final iron
#

Try time.sleep(150) and see what happens

#

Your bot will be completely frozen

velvet tinsel
#

you don't need to asterix' it

slate swan
velvet tinsel
slate swan
#

like 7 times

velvet tinsel
#

😳

slate swan
#

miss information

slate swan
#

😳

velvet tinsel
#

he did miss information ig

slate swan
#

im tired of class give me a break

velvet tinsel
#

idk about saying miss information

velvet tinsel
slate swan
velvet tinsel
slate swan
velvet tinsel
slate swan
#

lol

velvet tinsel
#

what are you done with

slate swan
#

with class?

velvet tinsel
#

ok

#

okimii

#

you disappoint me

#

I was expecting a comeback 👀

slate swan
#

i wouldn't do such a thing

velvet tinsel
#

...

slate swan
#

lol

slate swan
#

yes

maiden fable
#

Why is this a GIF chat...

slate swan
#

lol

velvet tinsel
lunar quail
#

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 catlost

maiden fable
#

What's confusing tho?

#

Wait why is v 3?

lunar quail
#

that green dot or the pea looking thing

maiden fable
#

Mhm

lunar quail
maiden fable
#

Ah u need mobile status

lunar quail
#

A monkey patch snippet which was found online and edited actually worked

#

which was my main incentive

maiden fable
#

So it works?

lunar quail
# maiden fable 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 shrug

maiden fable
#

Hmm, I do remember that patching the ready/connect payload in the gateway.py file does that

lunar quail
#

I used to inspect module to see if everything was applied (obviously) and it was

maiden fable
#

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

lunar quail
lunar quail
maiden fable
#

What did u do?

#

Device?

lunar quail
maiden fable
#

Lol

lunar quail
#

lemme try ios then with both

maiden fable
#

Sure

velvet tinsel
#

Lol

maiden fable
#

@lunar quail works?

lunar quail
maiden fable
#

Show code

lunar quail
#
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
            }
        }
maiden fable
#

Wait

#

Try setting the device to iOS too

lunar quail
#

looks done now

maiden fable
#

Works?

lunar quail
#

sadge