#discord-bots

1 messages · Page 1084 of 1

tropic flame
#

my bot was running just fine on vs

nimble plume
#

ok

#

Use vs best

slate swan
#

just tell the person that, id returns an integer but is being compared with a string, so it'll always be False

tropic flame
#

but on replit this error is coming -

Replit: Package operation failed.

Replit: Updating package configuration

--> python3 -m poetry lock

NonExistentKey

'Key "metadata" does not exist.'

at venv/lib/python3.8/site-packages/tomlkit/container.py:553 in getitem
549│ key = Key(key)
550│
551│ idx = self._map.get(key, None)
552│ if idx is None:
→ 553│ raise NonExistentKey(key)
554│
555│ if isinstance(idx, tuple):
556│ # The item we are getting is an out of order table
557│ # so we need a proxy to retrieve the proper objects
/home/runner/Ayr/venv/lib/python3.8/site-packages/setuptools/command/install.py: 34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
exit status 1

nimble plume
#

Improving my english

tropic flame
#

then how should i host the bot

nimble plume
#

get a cc

#

ask ur parents I want to host a bot

#

And I want cc

#

It will take no money

slate swan
#

cc doesn't solve the issue of hosting...

nimble plume
#

AWS

#

..

scarlet aurora
#

guys my bot takes like 2 seconds to boot up, how can I stop this?

nimble plume
#

very fast bro

#

mine take like a minute

tropic flame
scarlet aurora
#

bro i want mine to boot instantly

tropic flame
nimble plume
#

Imposible

scarlet aurora
nimble plume
#

it takes time to connect

#

To the api

tropic flame
slate swan
nimble plume
slate swan
#

you can always delay it using time.sleep though

nimble plume
#

ur demotivating him

tropic flame
jade tartan
#
  File "c:\Users\thoma\Desktop\MyBot\main.py", line 6, in <module>
    from discord.ui import Button, View
ImportError: cannot import name 'Button' from 'discord.ui'```
jade tartan
#

I do have 2.0

tropic flame
nimble plume
#

use discord.ui.Button

#

Don't import

crisp drift
heady sluice
slate swan
slate swan
nimble plume
crisp drift
#

You installed dpy 2.0 in a different py version

heady sluice
slate swan
heady sluice
#

though I'm impressed you know the game

nimble plume
#

I want to know why async is there in python

crisp drift
#

So what? Just install dpy2.0 in the same version of python ure using to boot up your bot

nimble plume
slate swan
#

hahahaha so funny, I'm dying

nimble plume
#

💀

#

I'm a joker

#

And ppl die with my jokes

#

so sad 😞

slate swan
tropic flame
jade tartan
#

VSC

tropic flame
#

eh idk then

slate swan
# jade tartan VSC

run python --version in any terminal and match the interpreter version in the bottom left/right corner in VSC

scarlet sorrel
scarlet sorrel
slate swan
scarlet sorrel
#

oh ok cool

#

wait can i do pip install ffmpeg ?

slate swan
#

and yes you gotta do that too iirc

scarlet sorrel
#

can i do it though linux cmd?

slate swan
#

sure

scarlet sorrel
#

how

slate swan
#

never used linux so idk

scarlet sorrel
#

ah

dull terrace
#

Here's a weird question, does custom_id support unicode characters?

jade tartan
#

python3 -m pip install --upgrade pip is that how to install the latest dpy?

dull terrace
#

huh turns out the answer is yes

slate swan
scarlet sorrel
dull terrace
#

is the new dpy already done?

jade tartan
slate swan
jade tartan
#

Damn Rapptz is famous how idk

slate swan
#

🙂

jade tartan
slate swan
jade tartan
#

Am using the 3.8

#

i mean 10

slate swan
jade tartan
#

3.10

scarlet sorrel
jade tartan
slate swan
scarlet sorrel
slate swan
#

don't know about that myself, never used ffmpeg, since its pretty pointless to (for me)

#

simply installing ffmpeg with pip fixes the issue already

#

!pip ffmpeg

unkempt canyonBOT
regal pulsar
jade tartan
#

Please stop ive seen ppl that kind of thing

hybrid pond
#

can someone help me?

digital mason
#

.content not .message

flat solstice
#

Is there a better way I could be doing this?py if before.permissions_synced is after.permissions_synced: embed.add_field( name="Permissions Synced", value="Permissions synced" if after.permissions_synced is True else "Permissions not synced", ) elif before.permissions_synced is not after.permissions_synced: embed.add_field( name="Permissions Synced", value="Permissions not synced -> Permissions synced" if before.permissions_synced is False and after.permissions_synced is True else "Permissions synced -> Permissions not synced" if before.permissions_synced is True and after.permissions_synced is False else "Permissions synced -> Permissions synced" if before.permissions_synced is True and after.permissions_synced is True else "Permissions not synced -> Permissions not synced", )mainly the elif's value statement

heady sluice
#

elif before.permissions_synced is not after.permissions_synced:you don't even need this

#

that sticker is accidental

heady sluice
#

yes

hybrid pond
still tiger
#

Would anyone know how can I make my own api to interface with my bot? like telling it to change activity etc
I already have a file I just need to pass in parameters from my api

scarlet sorrel
#

rip

slate swan
scarlet sorrel
scarlet sorrel
#

on my pc i installed ffmpeg from the site but no clue how to do it through linux cmd

vale wing
scarlet sorrel
#

it works to an extent

#

so far im at "209 packages excluded due to repository priority protections"

#

No package ffmpeg available.

vale wing
#

Try downloading the ffmpeg executable

scarlet sorrel
#

cuh

#

this is AWS

#

its linux command line or nothing

vale wing
#

Download it and put there, I see no problem

#

SFTP exists

scarlet sorrel
#

never heard of it

vale wing
#

Curl exists

scarlet sorrel
#

never heard of it

vale wing
#

You have ubuntu?

scarlet sorrel
#

no

vale wing
#

Then what os do you have

scarlet sorrel
#

i just said its on amazon linux

vale wing
#

Why not use ubuntu tho

scarlet sorrel
#

cuh

vale wing
#

"Never heard of it"?

scarlet sorrel
#

amazon linux is cheaper

vale wing
#

Ok

scarlet sorrel
#

😏

vale wing
#

Anyway curl should be in your os as well

#

And SFTP is available literally for anything

scarlet sorrel
#

you are just saying words

#

whats sftp

vale wing
#

Secure File Transfer Protocol

#

You may use firezilla for it

scarlet sorrel
#

so your saying if i get the ffmpeg.exe file onto the AWS server im good

#

cuz i can just use github for that

vale wing
#

And the curl should look like

$ curl https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -o ffmpeg.tar.xz```
scarlet sorrel
#

whats -o ffmpeg

vale wing
#

Then you would need to unzip it

vale wing
scarlet sorrel
#

how would i unzip it

vale wing
#

There's a command for that too

scarlet sorrel
#

cant i just use github

vale wing
#

And I think you can find how to unpack archive on linux CLI without my help, it's in straight access on google

vale wing
scarlet sorrel
#

just put it on github and pull it

vale wing
#

Sure

scarlet sorrel
#

ok cool

vale wing
#

But ffmpeg weights like 80 mb iirc

unkempt canyonBOT
scarlet sorrel
#

cuh

#

this aint off topic

vale wing
#

In fact it is close to edge

scarlet sorrel
vale wing
scarlet sorrel
#

it is

scarlet sorrel
#

bruh

vale wing
#

I think I gave you correct link

scarlet sorrel
#

you ever made a bot?

scarlet sorrel
#

alr

#

@vale wing so how do i unzip it

vale wing
scarlet sorrel
#

you need to look into what discord bots require my good lad

paper sluice
loud junco
#

🤣

scarlet sorrel
loud junco
#

i like how many confusing human there is here

paper sluice
vale wing
#

Won't start at all?

#

No errors?

slate swan
#

no errors. just doesnt start

vale wing
#

Also pass_context is deprecated

paper sluice
#

ur doing await ctx.send(embed=em) outside the function.....

vale wing
#

Damn 1 space indents

#

Man make it at least 4

paper sluice
vale wing
#

And regenerate your token, you just leaked it

dire folio
#

^

slate swan
paper sluice
#

dude, u are using cstyle string format inside in str.format???? why????

loud junco
#

how do i handle the rate limited error

#

so it doesnt flood my screen with a 10million words essay

paper sluice
#

error? or warning?

loud junco
#

error handler

vale wing
slate swan
loud junco
paper sluice
loud junco
paper sluice
loud junco
#
indent
  works
    like
      this
########################################
not 
  like
          this
vale wing
#

!d discord.Client.on_error

unkempt canyonBOT
#

await on_error(event_method, /, *args, **kwargs)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The default error handler provided by the client.

By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.10)") however it could be overridden to have a different implementation. Check [`on_error()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_error "discord.on_error") for more details.

Changed in version 2.0: `event_method` parameter is now positional-only.
loud junco
#

huh

#

i thought error handler is a bot.event instead of await

paper sluice
scarlet sorrel
#

it is

maiden fable
#

@scarlet sorrel I don't wanna argue or smth, but music bots are against ToS

pliant gulch
#

Hunter did you see my solution from yesterday

hybrid pond
#

not against discord tos

vale wing
#

As long as the issue isn't related to ytdl or smth we can help

hybrid pond
#

only spotify and google wont allow it anymore

vale wing
#

Maybe he's just trying to play it from file

pliant gulch
#

Of course, not every music bot is breaking ToS, but the majority will

#

Since licenses will be very expensive, especially if you want big library

maiden fable
vale wing
#

Nvm he is using ytdl 😒

pliant gulch
# maiden fable I did, but wasn't really able to test it out since it was morning when I saw it ...

!e ```py
from future import annotations

from typing import TYPE_CHECKING, Any, Callable, Coroutine, TypeVar

import asyncio

import inspect
import re

class MaybeAwait:
def init(self, coro: Callable[..., Coroutine]) -> None:
if not asyncio.iscoroutinefunction(coro):
raise RuntimeError("Received non-coroutine.") from None

    self.syncf: Callable[..., Any]
    self.coro = coro

def __call__(self, id: int) -> Any:
    ctx = inspect.getframeinfo(inspect.stack()[1][0]).code_context[0] # type: ignore
    if re.search(r"^(.*?)(\bawait get_member\b)(.*)$", ctx):
        return self.coro(id)

    return self.syncf(id)

def sync(self) -> Callable[..., Callable[..., Any]]:
    def inner(func: Callable[..., Any]) -> Callable[..., Any]:
        
        self.syncf = func
        return func

    return inner

async def main() -> None:
@MaybeAwait
async def get_member(id: int) -> int:
print(f"Async {id}")

@get_member.sync()
def _get_member(id: int) -> int:
    print(f"Sync {id}")

print(await get_member(123))
print(get_member(456))

asyncio.run(main())

unkempt canyonBOT
#

@pliant gulch :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 48, in <module>
003 |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
004 |     return loop.run_until_complete(main)
005 |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
006 |     return future.result()
007 |   File "<string>", line 44, in main
008 |   File "<string>", line 20, in __call__
009 | TypeError: 'NoneType' object is not subscriptable
pliant gulch
#

Oh i guess it doesn't work in snekbox

maiden fable
#

Ah I understand most of it now

#

Just gotta look into how __call__ works

pliant gulch
#

Solution was too hacky for me to like it though

maiden fable
pliant gulch
maiden fable
#

Thanks!

slate swan
#
PS C:\Users\Clicks\Desktop\Timmy> python3 bot.py
Traceback (most recent call last):
  File "C:\Users\Clicks\Desktop\Timmy\bot.py", line 13, in <module>
    import exceptions
ModuleNotFoundError: No module named 'exceptions'``` it wont work, why?
paper sluice
#

what is exceptions?

slate swan
maiden fable
#

And where is it using the exceptions module?

pliant gulch
pliant gulch
#

overload yea

paper sluice
#

yea, 😅

pliant gulch
#

Right now I'm writing some basic built-ins literal thingy to make int.fetch

slate swan
pliant gulch
#

I'll send in a bit

maiden fable
maiden fable
slate swan
#
if isinstance(error, exceptions.UserBlacklisted):```
maiden fable
#

Ah what is yr file structure

#

U need a file named exceptions in the root of the folder

pliant gulch
maiden fable
#

Damn cool
I guess that would involve messing with builtins module?

pliant gulch
#

No, that won't work for literals

#

You need to either mess with the class in memory using ctypes, then making the dict mutable

#

or you can use a glitch, what i'll use to expose the underlying map of dict

#
from __future__ import annotations

from typing import Any

import asyncio
import os

import aiohttp


async def main() -> None:
    session = aiohttp.ClientSession()
    headers = {"Authorization": "Bot " + os.environ["DISCORD_TOKEN"]}
    URL = "https://discord.com/api/v9/users/{0}"

    class _:
        def __eq__(self, other: dict[str, Any]) -> None:

            async def fetch(id: int) -> dict[str, Any]:
                async with session.get(URL.format(id), headers=headers) as resp:

                    return await resp.json()

            other["fetch"] = fetch

    int.__dict__ == _()

    me = await (270700034985558017).fetch()
    print(me)


asyncio.run(main())
``` here it is
paper sluice
#
        if re.search(rf"^(.*?)(\bawait {self.coro.__name__}\b)(.*)$", ctx):
            return self.coro(id)

lil more dynamic

pliant gulch
#

😳

#

Orignally I was hooking onto RuntimeWarning but that was a total headache

#

I had to use f_locals to see the args and stuff

maiden fable
#

I would love it if someone implements this in their very lib and people start to criticize the person

pliant gulch
#

The only reason I would never use it is cause it's basically impossible to typehint correctly with it

#

And, plus inb4 segmentation fault

tacit token
#

Discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: '766960170349363210'

@client.command()
@commands.has_permissions(kick_members=True)
async def warn(ctx, member: discord.User, *, reason):
      save_warn(ctx, member)
      dm = await client.fetch_user(member.id)
      em=discord.Embed(title="Warning", description=f"Server: {ctx.guild.id}\nReason: {reason}")
      await dm.send(embed=em)
slate swan
#

Bro wtf

#

why are u fetching the user

tacit token
slate swan
#

💀

tacit token
#

this skull is the best for help ty sir

slate swan
#

change it to discord.Member also

#

thats a old stack

#

ig

#

code yourself instead of copying code from stackoverflow, so you actually know what's happening

meager whale
#

Can anyone help me in making my bot online 24/7

slate swan
slate swan
meager whale
#

I am a new bot dev

slate swan
#

oh cool

meager whale
#

I don't know about hosting

tacit token
#

the error the ID

slate swan
#

@meager whale

meager whale
#

Yes

meager whale
#

Tell me sparky how to host 24/7 🥺

maiden fable
#

@slate swan

pliant gulch
maiden fable
#

Lmao rip ppl like me

#

BTW @pliant gulch r u hosting any of yr bots right now?

pliant gulch
#

I have no bots hosted right now

maiden fable
#

Ah okay

pliant gulch
#

I don't even have an active development bot either kek

#

The only discord stuff I've done recently was Rin

maiden fable
#

Just wanted to ask, approx how much memory yr bot needed and what intents it had on, along with approx number of users it had

pliant gulch
#

Mmm my bot never had a lot of users

#

But I did use a special custom caching method

#

So it wouldn't chunk guilds on startup. allowing start up times to be extremely fast no matter how many guilds

maiden fable
#

Ah, I like that

pliant gulch
#

Then it would chunk when needed, storing data else where

maiden fable
pliant gulch
#

So my memory usage was pretty low

maiden fable
#

Nice

pliant gulch
maiden fable
#

Well how much RAM it took then?

pliant gulch
#

Like 50-60mb

maiden fable
#

Ah okay

#

Thanks for telling!

pliant gulch
#

I had a gig of memory left to use

maiden fable
#

Haha 50-60 MB RAM is almost nothing

pliant gulch
#

But I didn't use much things that required persistence anyways

maiden fable
#

Thanks for telling!

dusk tundra
#

anyone one to help me with a bot

maiden fable
#

?

hybrid ravine
#
    guildobj = await client.get_guild(guild)
TypeError: object NoneType can't be used in 'await' expression``` any help? why is client.get_guild returning None?
maiden fable
#

u don't await get

#

also wrong guild id

dusk tundra
#

@maiden fable Im a shit sandwich at coding but I know pine editor Im trying to create a discord bot that will grab a link from tradingview

maiden fable
#

ok?

dusk tundra
#

it has to go in and click that or type alt + s in tradingview

#

@maiden fable is this possible?

maiden fable
#

what u stuck at?

dense swallow
#

Hi, im trying to connect my database to my bot. This code used to work, and in d.py 2.0a this doesnt work anymore
code: ```py

this is in sub-classed commands.Bot class

    self.db = self.loop.create_task(self.create_db_pool())

this as a normal function

async def create_db_pool(self):
    ssl_object = ssl.create_default_context()
    ssl_object.check_hostname = False
    ssl_object.verify_mode = ssl.CERT_NONE

    await asyncpg.create_pool(
        #dsn=os.getenv("DATABASE_URL"),
        dsn=os.getenv("DB_URL"),
        ssl=ssl_object
    )
https://cdn.discordapp.com/attachments/790798642474123304/982680947499614248/unknown.png
dense swallow
#

self is the bot class

dusk tundra
maiden fable
#

do

self.db = asyncio.run(self.create_db_pool())
maiden fable
dusk tundra
maiden fable
dusk tundra
#

@maiden fable I'm Microsoft Excel certified I know Pine I can pick up on the python quickly I just don't know the commands yet

maiden fable
#

!resources is a great way to start!

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.

dense swallow
maiden fable
dusk tundra
maiden fable
#

!d discord

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

maiden fable
#

Docs have a small tutorial

dense swallow
maiden fable
#

Nice

dense swallow
#

😂

maiden fable
#

!paste please use this

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

dense swallow
#

ok

dusk tundra
#

@maiden fable I downloaded visual studio last night will that be enough to run a discord bot or do you have to run it through the command center

dusk tundra
#

I finished downloading all the pips I needed

maiden fable
hybrid pond
#

anyone in here has experiance with virustotal api?

maiden fable
#

No

shrewd apex
dense swallow
#

what

dense swallow
#

but thanks :)

pliant gulch
#

Proactor error, this is indeed a windows moment

shrewd apex
#

and the end is nonetype object has no attribute send -_-yert

pliant gulch
paper sluice
crisp drift
#

my man ;))

dense swallow
pliant gulch
crisp drift
#

U can remake it easy andy

pliant gulch
crisp drift
#

True that, i've turned that caching off since i keep my bot private now

dense swallow
crisp drift
pliant gulch
#

Also what ever happened to the tinder bot

crisp drift
#

Yeah ahahhaa

crisp drift
#

Tindabot died cuz ive worked with a lazyass that didn't want to do anything than getting credits on my code

dusk tundra
#

Does python have a user manual to learn commands?

pliant gulch
crisp drift
#

Isnt rin dead

dense swallow
#

@maiden fable any idea why that error occured?

shrewd apex
pliant gulch
maiden fable
#

@shrewd apex mind helping DTS?

crisp drift
pliant gulch
maiden fable
#

I am stuck with smth

shrewd apex
pliant gulch
shrewd apex
dusk tundra
crisp drift
#

Bro thats some hardcore sh*t

dusk tundra
#

"sma()" is a command how do I learn these commands

pliant gulch
#

Except caching isn't done, so you'll need to manually chunk

dusk tundra
#

"print()" is a command

crisp drift
#

Yes

heady sluice
slate swan
shrewd apex
heady sluice
#

calling a function...

slate swan
#

what have i come to😳

dusk tundra
crisp drift
#

And boom easy startup

heady sluice
#

well I'd suggest a youtube video or w3schools

slate swan
#

w3school is trash

heady sluice
#

damn you okimii

shrewd apex
heady sluice
#

w3school is great

crisp drift
#

okimii banned from udevs? kekw

pliant gulch
#

LMAOO

slate swan
#

brandon banned me man

#

😩

dusk tundra
pliant gulch
dusk tundra
#

😂

pliant gulch
crisp drift
shrewd apex
dusk tundra
#

Python is trying to keep me a shit a sandwich at coding

slate swan
heady sluice
slate swan
crisp drift
#

Then theres nothing else u can do except leaving some useless code to make it faster

heady sluice
#

shut

slate swan
dusk tundra
pliant gulch
shrewd apex
crisp drift
#

Nah im not into coding anymore for now :((

slate swan
#

i want to see kais impl👁️ 👁️

dusk tundra
#

@heady sluice Business wise how does Python make me dollars

heady sluice
#

you gotta learn functions before asking these questions

pliant gulch
maiden fable
crisp drift
#

isnt blanket doing it with you andy

pliant gulch
#

No that was Lefi

heady sluice
#

is blanket alive

crisp drift
#

he is, in our server

slate swan
#

and blanket only did the vc impl 💀

dusk tundra
shrewd apex
dusk tundra
#

@heady sluice how does it make ones life better/easier

pliant gulch
heady sluice
dusk tundra
#

task wise

heady sluice
#

AI

#

most AIs are made with python

slate swan
dusk tundra
slate swan
heady sluice
#

prolly

slate swan
heady sluice
shrewd apex
slate swan
shrewd apex
slate swan
#

theirs really other websites that have better explanations imo

slate swan
pliant gulch
shrewd apex
#

i didn't say the content was pro

slate swan
#

hi i need help, my bot sending messages twice...
i checked if the bot is hosted in 2 hostings in the same time but its no.
i have restarted the bot but its still not work..
please help me

slate swan
shrewd apex
shrewd apex
#

without stopping the old one

pliant gulch
slate swan
#

i might continue my discord api wrapper cuz i havent done anything complex in a few

heady sluice
#

yeah but what does your on_message look like

slate swan
slate swan
shrewd apex
crisp drift
#

He lost it kekw

stiff gorge
#

howmuch time will it take for a hybrid command to log ?

pliant gulch
shrewd apex
#

💀

crisp drift
#

360p picture

slate swan
heady sluice
pliant gulch
slate swan
#

Actually 180p

crisp drift
#

Give him an example andy :((

heady sluice
#

are y'all dumb

stiff gorge
#

the commands r working with prefix but not with slash cmnd

shrewd apex
slate swan
# pliant gulch

atleast make it good quality, that picture has the quality of your life smh

crisp drift
#

shut it banned boy

slate swan
heady sluice
#

a satellite picture isn't 180p just because you don't see the andromeda galaxy without zooming in

slate swan
heady sluice
#

yes

#

andy you writing a book?

dusk tundra
#

whats the function for making my computer take control. . .how do I let bill gates start touching buttons

heady sluice
#

that's a program called anydesk

maiden fable
#

Only if it was this easy 😔

pliant gulch
# crisp drift He lost it <:kekw:893598778626564157>
bot = Bot(chunk_guilds_at_startup=False)
chunked: dict[int, tuple[discord.Guild, datetime.datetime]] = {}

@bot.event
async def on_message(message: discord.Message) -> None:
    if message.guild.chunked is False or message.guild.id not in chunked:
        chunked[message.guild.id] = message.guild, datetime.datetime.utcnow()

        await message.guild.chunk()

@tasks.loop(seconds=...)
async def check() -> None:
    for id, (guild, time) in chunked.items():

        if (datetime.datetime.utcnow() - time).seconds > 100:
            del chunked[id]
```Close enough?
heady sluice
#

imagine disabling commands

pliant gulch
#

It won't work kek

#

It's pseudocode

crisp drift
#

yes

#

lmaooo

shrewd apex
#

yeah atleast something to start with tho

#

i had no idea how to even begin💀

pliant gulch
#

It's been like a year or two

shrewd apex
maiden fable
#

Haha I was jk

heady sluice
#

a ss

#

with a space

crisp drift
#

Better chunk in a try except block

dusk tundra
#

@heady sluice how many strings is it going to take to create a bot that can log into Microsoft edge of firefox

maiden fable
#

Nice

dusk tundra
#

🤔

slate swan
#

thats called a crawler lol

maiden fable
#

U mean scraper?

heady sluice
#

crapper

crisp drift
# shrewd apex i took a ss

Chunked should me be in a database and then you chunk the guilds that were active within the 24h on startup

slate swan
#

i didnt mean that

dense swallow
#

_ _

crisp drift
#

In an try except block cuz chunking too much can cause a ratelimit kekw

dusk tundra
pliant gulch
#

It'll raise an error if bad intents as well

crisp drift
#

I remember it was fucking up something with my bot when I tried to chunk too much guilds at the same time. It it couldnt chunk, it would return an error

unkempt canyonBOT
#

discord/gateway.py lines 652 to 654

async def send(self, data: str, /) -> None:
    await self._rate_limiter.block()
    await self.socket.send_str(data)```
shrewd apex
#

nice

maiden fable
pliant gulch
crisp drift
crisp drift
pliant gulch
crisp drift
#

Which is ON by default

crisp drift
#

No andy kekw

maiden fable
pliant gulch
#

why the try execept then

keen mural
#

.

pliant gulch
#

😔 \

keen mural
#
class Fight3(discord.ui.View):
    def __init__(self, context: commands.Context):
        super().__init__(timeout=None)
        self.value = None
        self.command_ctx = context```
with my view, `timeout=None` works, but if i plug in an amount of seconds like 5 it instantly times out, anybody know what im doing wrong?
pliant gulch
crisp drift
#

It was fucking up my whole bot connection, dont ask me how the fuck it was doing that, im a lazy ass didnt look further

crisp drift
maiden fable
#

Yea that is what I did

crisp drift
#

Then?

left idol
#

i'm working with pycord and im wondering if i can do something like this

@bot.slash_command()
async def(ctx, *args):
  mylist = ', '.join(args)
  await ctx.send(users)

using slash commands? if not possible can i use bridge since it allows for ext.commands capabilities

pliant gulch
keen mural
#
class Fight3(discord.ui.View):
    def __init__(self, context: commands.Context):
        super().__init__(timeout=None)
        self.value = None
        self.command_ctx = context```
with my view, `timeout=None` works, but if i plug in an amount of seconds like 5 it instantly times out, anybody know what im doing wrong?
pliant gulch
shrewd apex
#

welp it gets more and more complex ig I will do that after finishing my botpithink||touch ups and optimisations||

crisp drift
#

Just dont do it

#

Do you have any reason for it

keen mural
#
class Fight3(discord.ui.View):
    def __init__(self, context: commands.Context):
        super().__init__(timeout=None)
        self.value = None
        self.command_ctx = context```
with my view, `timeout=None` works, but if i plug in an amount of seconds like 5 it instantly times out, anybody know what im doing wrong?
shrewd apex
#

just saw something new

#

so thought I would try

crisp drift
#

Unless you ahve more than 100 guilds with thousands of members, thats useless

pliant gulch
#

What would be nice, discord.py having cache drivers

slate swan
crisp drift
pliant gulch
#

so instead of a python dict which can be slower compared to others

pliant gulch
#

You'll be able to use RBDMS, Redis

keen mural
atomic path
#

I mean 5s is fairly short

keen mural
#

im saying it doesnt matter the amount i plug in it always times out instantly

pliant gulch
crisp drift
#

REdis

slate swan
#

yes pls

atomic path
#

and how do you know it timed out

keen mural
#

because interaction failed

crisp drift
#

I use my computer's EEPROM to cache andy's fat a*

pliant gulch
#

👿

keen mural
#

and it goes past my view wait statement

atomic path
#

o

#

whta does the return value of wait print

keen mural
atomic path
#

if I remember correctly wait returns True if it times out but false if it just finishes like regularly

keen mural
#

i have it as smth like await view.wait() and then an if view value and then an else statement

atomic path
#

wh

silk surge
#

I'm wondering, so I'm building a Discord bot that makes use of 17Track API to track online orders. Thing is that the way 17Track API works is that you need an HTTP server so the server can POST you updates.

To the point:
How can I run discord.py alongside some web server such as flask or aiohttp in a way that lets me interact within each other (because using threading doesn't let me send a message when the HTTP endpoint gets an update)

unkempt canyonBOT
#
Certainly not.

Package could not be found.

maiden fable
#

!pypi discord.ext.ipc

unkempt canyonBOT
silk surge
#

Oh so, let me get this straight, this lets me run Flask in a separate process and then, when I run a special instruction, send a message to an specific channel?

livid hinge
#

lol my bad

maiden fable
maiden fable
livid hinge
#

sorry for.lags

maiden fable
#

Haha its fine, I was jk

livid hinge
#

lol

#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

silk surge
#

i'll check tonight, thanks

maiden fable
#

Cool

livid hinge
#

im most proud of an on_message

slate swan
maiden fable
#

I am proud of making a custom commands system via on_message

livid hinge
#

oh thats cool

#

how does it work

maiden fable
#

U don't wanna see

slate swan
maiden fable
#

U will get a stroke

maiden fable
slate swan
livid hinge
maiden fable
#

Eh, I shut the project anyways and edited it many times

livid hinge
#

i know cursed code lol

#

mine is also pretty horrible

maiden fable
#

Lmao this is next level cursed, even people in #esoteric-python will get a headache

livid hinge
livid hinge
#

thats part why its gotten good tho

maiden fable
livid hinge
#

those ppl wont get a headache lmao

maiden fable
#

Lmao

#

BTW is it normal for discord client to take more than 1 GB RAM and still lag lmao

slate swan
#

do those people even know whats a headache😭

maiden fable
livid hinge
#

wbu @slate swan

heady sluice
livid hinge
#

yours outputs ciphertext?

slate swan
livid hinge
#

your encryption cmd

maiden fable
#

I am sure grey made an on_message which banned every person who messages, even when the bot has no perms

slate swan
livid hinge
#

nothing

slate swan
#

its just a simple dict

maiden fable
#

BTW @livid hinge did u see this

livid hinge
#

wow what could go wrong??

maiden fable
#

Discord do be adding AutoMod 👀

livid hinge
#

discord really?

slate swan
#

at this point handle everything including bots

maiden fable
#

Lmao discord do be adding every feature that a mod bot has

slate swan
#

mee6 like give me money

pliant gulch
#

Wonder if discord is still gonna roll out guild monitesation, like patron. I remember reading a data-mine and seeing those features

pliant gulch
#

So cursed

livid hinge
#

Ugh/

maiden fable
pliant gulch
#

Discord is trying to tap into the onlyfans market I guess

slate swan
#

well im going to switch to revolt😩

maiden fable
pliant gulch
#

@ revolt I'm andy 😏 sniped

maiden fable
#

The user base is a passive one

slate swan
#

text me on WhatsApp 😳

pliant gulch
#

Yea they don't use a tag system

#

So you have unique names!

maiden fable
#

Yea that too

livid hinge
pliant gulch
#

I joined revolt early so I got a beta badge as well

maiden fable
pliant gulch
#

Good

maiden fable
livid hinge
maiden fable
#

Both the pics are from same server

livid hinge
#

discord's trying to copy that?

slate swan
#

discord is slowly turning in to a free to play game but everything in the game isnt free

pliant gulch
#

Discord premium-gating features like they suddenly got acquired by EA

slate swan
#

EA sportspithink

crisp drift
#

andy revolt or guilded

slate swan
#

@maiden fable

pliant gulch
#

Revolt

maiden fable
#

Yea?

slate swan
#

hunter

maiden fable
#

okimii

crisp drift
#

Isnt guilded good?

pliant gulch
#

No

maiden fable
pliant gulch
#

Or atleast when I used guilded it sucked

slate swan
pliant gulch
#

Literally waited 1 minute for it to go past loading page

pliant gulch
#

And was using memory BAD

crisp drift
#

Last time i checked they were in early startup

pliant gulch
#

Memory leaks holy

crisp drift
#

They all discord clones anyway

maiden fable
#

Well its also owned by Roblox or its parent company

pliant gulch
#

Powered by the child labour game programming industry

crisp drift
slate swan
#

was*

maiden fable
#

U cannot use it for general chatting or making even a Programming server

#

At least discord was not that much

crisp drift
#

Ah

#

Time to join revolt

slate swan
#

lets all just switch to WhatsApp guys

pliant gulch
#

Join 😏

#

They got custom themes in revolt

maiden fable
slate swan
#

bro why not

crisp drift
#

joins revolt by logging in with discord

maiden fable
maiden fable
slate swan
#

does revolt have a mobile client yet?

maiden fable
#

still in prod

slate swan
maiden fable
#

a 3rd party is making it, the last time I checked

slate swan
#

bruh

maiden fable
slate swan
knotty wasp
#

How do I make a change lets say style becomes green from red to be edited in the view im using buttons subclass

unkempt canyonBOT
#

class discord.ButtonStyle```
Represents the style of the button component.

New in version 2.0.
pliant gulch
maiden fable
#

Revolt

crisp drift
#

Vouch for me andy

knotty wasp
# maiden fable !d discord.ButtonStyle
class ticketbutton(nextcord.ui.Button):
    
    def __init__(self,style,label):
        
        self.style = style
        self.label = label

    async def callback(self , interaction : Interaction):
        
        if self.style == nexcord.ButtonStyle.green:
            
            style , label = stylelabel(False)
            col.update_one({'gid':gid},{'$set':{'ticket':0}})
        
        elif self.style == nexcord.ButtonStyle.red:
            
            style , label = stylelabel(True)
            col.update_one({'gid':gid},{'$set':{'ticket':1}})
        
        self.style = style
        self.label = label
        await interaction.response.edit_message(view=self)
maiden fable
#

Basically open sourced discord

crisp drift
#

Tell them to give me special badges

pliant gulch
#

Should've joined early for beta badge

maiden fable
#

Don't bother with chat apps that don't respect your privacy. Revolt is a brand new chat platform designed around you.

maiden fable
slate swan
#

i wonder if google would ever make a discord alike app they would be like: give me your datalurks

pliant gulch
crisp drift
#

lol u even made a server

#

lets get it

pliant gulch
#

No brandon made it

slate swan
#

smh

crisp drift
#

We dont invite okimii tho

slate swan
pliant gulch
#

Yes but soon they will have end-to-end encryption on your messages

crisp drift
#

nice marketing

pliant gulch
#

Selfhostable as well

#

Far from it

#

Discord is infact very spooky when it comes to privacy

maiden fable
#

No

#

There are still UI differences

#

It isn't the literal ditto

#

Also they ain't earning money from it

slate swan
#

they can but it would be a hard and a waste of resources

maiden fable
#

Its open sourced

#

Donations

#

And they only use one server rn

#

Like only one server is enough to run the instance

#

Based in Germany

stiff gorge
#

howmuch time will it take for a hybrid command to log ?

#

the commands r working with prefix but not with slash cmnd

maiden fable
#

It can take upto 2 hours for the commands to sync

stiff gorge
#

ohk

slate swan
slate swan
#

i make list and i dont know is it work

maiden apex
#

hello, i am trying to do a discord bot with discord.py, i want the main command of the bot to be a little pytoh code i made before, how can i do this ?
the code i made :

from itertools import product
import time
import math


inputs = input("numbers of inputs : ")
goal = float(input("goal : "))

start_time = time.time()

# sprint
def sprint(x):
    return ((x * 0.6 * 0.91) + (0.1 * (1.3 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / 0.6) ** 3))

# stop
def stop(x):
    return ((x * 0.6 * 0.91) + (0.1 * (0 * 1) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / 0.6) ** 3))

# walkback
def walkback(x):
    return ((x * 0.6 * 0.91) + (0.1 * (1 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / -0.6) ** 3))

# sneak
def sneak(x):
    return ((x * 0.6 * 0.91) + (0.1 * (0.3 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / 0.6) ** 3))

# sneakback
def sneakback(x):
    return ((x * 0.6 * 0.91) + (0.1 * (0.3 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / -0.6) ** 3))


functions_list = [stop,sprint,walkback,sneakback,sneak]

def functions_product(f, start = 0):
    for func in f:
        start = func(start)
    return start

for i in product(functions_list, repeat=int(inputs)):
    if abs(functions_product(i) - goal) < 0.00000001:
        print(f'{[f.__name__ for f in i]}: {functions_product(i)}')

print("--- results took %s seconds to find ---" % (time.time() - start_time))
input("press enter to quit")```
#

i want the bot to ask the questions of the "input" at the top of the code and then to run everything else with the reponse of the user

slate swan
#

What the maths

maiden apex
#

it's some formulas

#

you can run the code yourself if you want

#

(the code basically bruteforce all theses formulas between each others formulas)

#

it's maybe weird to understand

slate swan
#

Ye it is

maiden apex
#

i just need to know how can i make the bot say this

#

and to make the response of the user a var

dire folio
#

You could just have smth like

async def cmd_name(ctx, inputs, goal):
slate swan
dire folio
#

Or ^

slate swan
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
stiff fern
#

Am I suppose to use Check()?

slate swan
stiff fern
#

bruh

#

graci

slate swan
#

welcome

rich epoch
slate swan
maiden apex
rich epoch
slate swan
#

oh well

maiden apex
serene mantle
#

Hey guys i have a rather annoying situation right now.

#

I made a simple discord bot, that replys with text everytime someone runs a command

#

like il run !pay

slate swan
serene mantle
#

and it will respond with

#

"pay here..." etc

#

i've tried hosting on both repl.it & pebblehost and i keep getting rate limted.

dire folio
#

shouldn't use replit

#

idk what pebblehost is

serene mantle
#

anyone have any idea why this is happening?

dire folio
#

show the whole traceback

slate swan
#

Show full traceback

slate swan
# serene mantle i've tried hosting on both repl.it & pebblehost and i keep getting rate limted.
  • Repl.it is going to make your bot get ratelimited faster, since, of course, it uses a shared IP divided amongst many clients. And the discord API ratelimits IPs.
  • Repl.it machines are superly underpowered
  • If the bot is in development stage, use a local code editor (Dedicated - PyCharm, Light - Visual Studio Code, Atom, Sublime Text)
  • If the issue is raised during the hosting of it, consider using a Virtual Private Server (VPS, and yes, you have to buy one)
  • You can get many cheap VPS' (See pinned messages for more info) or claim 12-months free on AWS (has limitations)
#

Ok

serene mantle
serene mantle
#

i have dozens of bot that have never been rate limited.

#

that i run on pebblehost

slate swan
#

don't know what pebblehost is so uhh

sick birch
#

I used to have a minecraft server on pebblehost, it was pretty terrible tbh

#

Don't remember exactly what was wrong with it as it was a while ago, but I do remember the general feeling I got from it was that it felt kinda cheap and bad, if you understand what I'm saying

slate swan
#

Even their Premium version?

serene mantle
#

yes

#

pebblehost doesn't have a free version

slate swan
#

ew

stiff fern
#

Why would this happen?

sick birch
stiff fern
#

I don't have parenthesis around event?

slate swan
stiff fern
slate swan
#

💀

stiff fern
#

Im trying to use cogs so if I put it in the main file would it till work cause I'll just do that and then I wouldn't need to have discord.client.event lol

sick birch
#

Oh yeah I was looking at the error

#

If it's inside a cog you should be using commands.listener() I believe?

stiff fern
#

Is it better to have it in the cog or would it work fine outside of it

slate swan
#

commands.Cog.listener()

sick birch
#

Ah thank you

sick birch
stiff fern
#

I have no idea what that does lol

#

Ok I'll just put it outside then and save the copy paste

sick birch
#

Still pretty bad but... not as bad as before

regal pulsar
slate swan
#

thats a cog-

regal pulsar
#

then @commands.Cog.listener

slate swan
regal pulsar
#

yes

stiff fern
maiden apex
# maiden apex hello, i am trying to do a discord bot with discord.py, i want the main command ...

how can i fix that ?

Traceback (most recent call last):
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
    await self.prepare(ctx)
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
    await self._parse_arguments(ctx)
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 542, in transform
    raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: inputs is a required argument that is missing.

what i am trying to make :

@client.command()
async def ibf(ctx, inputs, goal):
    await ctx.send('How many ticks do you want to bruteforce ?')
    inputs = await client.wait_for('message')
    await ctx.send('What goal speed do you want ?')
    goal = await client.wait_for('message')```
(i am not sure about what i am doing rn)
sick birch
#

You can't use input() along with your bot, as input() is blocking

slate swan
maiden apex
#

can someone make a little example of what of what i should do to just get the response of the user and make this a var please ?

heady sluice
#
@bot.command()
async def ibf(ctx):
    def check(msg):
        return msg.channel == ctx.channel and msg.author == ctx.author
    await ctx.send('How many ticks do you want to bruteforce ?')
    inputs = await bot.wait_for('message', check=check)
    await ctx.send('What goal speed do you want ?')
    goal = await bot.wait_for('message', check=check)
slate swan
stiff fern
#

Oh there’s an extensive for that, will do ty

heady sluice
#

oh bot and client usage

slate swan
#

yes

spring flax
#

how do I do something like this in poll questions?

heady sluice
#

you calculate the percentage

heady sluice
#

then if you have 56% on one side, you set the embed value to whole_line_character*56 + points_character*44

#

because those are a bunch of characters Ig

#

and the value of the second embed would be whole_line_character*44 + points_character*56 + "44% votes"

slate swan
maiden fable
#

Why not just do votes = char?

heady sluice
#

because percentage

spring flax
#

okay so I think I got it - thank you

heady sluice
#

Ash's logic was definitely dumbing there

slate swan
maiden fable
maiden apex
#
await ctx.send(f'{[f.__name__ for f in i]}: {functions_product(i)}')```
is something wrong with this ?
heady sluice
maiden fable
#

Idk if that is what u r tryna do

heady sluice
#

not percent into number

#

number into percent

maiden fable
#

Nvm I am gonna go

dull terrace
#

Why is my bot not being referenced when i reply to something it does now

#

oh ffs is it because it's using a slash command

maiden apex
#

why do i get this error message ?

Traceback (most recent call last):
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\arsbu\Documents\CODE\PKbot\main.py", line 50, in ibf
    for i in product(functions_list, repeat=int(inputs)):
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Message'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\arsbu\Documents\CODE\PKbot\testpy\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: int() argument must be a string, a bytes-like object or a real number, not 'Message'

the code of my command :

# sprint
def sprint(x):
    return ((x * 0.6 * 0.91) + (0.1 * (1.3 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / 0.6) ** 3))

# stop
def stop(x):
    return ((x * 0.6 * 0.91) + (0.1 * (0 * 1) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / 0.6) ** 3))

# walkback
def walkback(x):
    return ((x * 0.6 * 0.91) + (0.1 * (1 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / -0.6) ** 3))

# sneak
def sneak(x):
    return ((x * 0.6 * 0.91) + (0.1 * (0.3 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / 0.6) ** 3))

# sneakback
def sneakback(x):
    return ((x * 0.6 * 0.91) + (0.1 * (0.3 * 0.98) * ((1 + 0.2 * 0) * (1 - 0.15 * 0)) *(0.6 / -0.6) ** 3))

functions_list = [stop,sprint,walkback,sneakback,sneak]

@client.command()
async def ibf(ctx):
    def check(msg):
        return msg.channel == ctx.channel and msg.author == ctx.author
    await ctx.send('How many ticks do you want to bruteforce ?')
    inputs = await client.wait_for('message', check=check)
    await ctx.send('What goal speed do you want ?')
    goal = await client.wait_for('message', check=check)

    def functions_product(f, start=0):
        for func in f:
            start = func(start)
        return start

    for i in product(functions_list, repeat=int(inputs)):
        if abs(functions_product(i) - goal) < 0.0000001:
            await ctx.send(f'{[f.__name__ for f in i]}: {functions_product(i)}')```
slate swan
#

....

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

maiden fable
#

You're welcome

maiden apex
#

oh sorry

slate swan
formal basin
#

Guys anyone know how to make a command that gives everyone a certain role?

maiden fable
unkempt canyonBOT
#

await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
slate swan
heady sluice
#

if you wrote numbers in that message, you can convert it to int by int(inputs.content)

formal basin
formal basin
maiden fable
#

ratelimit goes brrrr

slate swan
formal basin
maiden fable
#

Might as well change the perms for everyone role

formal basin
slate swan
maiden fable
spring flax
#

which event should I used for live tracking of polls?

maiden apex
#
    await ctx.send('How many ticks do you want to bruteforce ?')
    inputs = await client.wait_for('message', check=check)
    int(inputs.content)
    await ctx.send('What goal speed do you want ?')
    goal = await client.wait_for('message', check=check)
    int(float(goal.content))```
would this work ?
spring flax
slate swan
spring flax
#

i just want the reaction count

heady sluice
#

and no it wouldn't

#
    inputs = await client.wait_for('message', check=check)
    inputs = int(inputs.content)
maiden apex
#

ah ok

formal basin
slate swan
heady sluice
#

buff RawReactionActionEvent

spring flax
#

so I have to keep fetching the message?

heady sluice
#

to count the votes? only if you want to update showing it somewhere

slate swan
spring flax
heady sluice
#

why not just store the message

#

after fetching it once or sending it

spring flax
#

oh good idea

#

thanks

#

how would I store it to be used in a the reaction event?

heady sluice
#

if payload.message_id == stored_message.id

#

iirc you can somehow store a message in the cache, if you do that you can use on_reaction_add as well

spring flax
#

would buttons be better for this?

heady sluice
#

shrug

#

no I don't think so

#

because when you reset the bot you can't use the button anymore

formal basin
#

Hello guys anyone know how to make a command that changes a perm of a role in the server

spring flax
slate swan
#

buttons, have fun, you'll have to store whole of the option list in a database unlike reactions which can be fetched directly

heady sluice
#

!botvar

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

slate swan
#

thats gonna be reset

heady sluice
#

fetch again

#

store again

heady sluice
#

gtg

slate swan
#

@bot.command() async def clear(ctx, limit : int = None): premium = [982692724153151569] if limit == None: if ctx.guild.id not in premium: await ctx.channel.purge(limit=30) else: ctx.channel.purge(limit=100000) else: if ctx.guild.id not in premium: if limit > 30: await ctx.send("[**ERROR**] Your max limit is 30.") else: ctx.channel.purge(limit=limit) else: ctx.channel.purge(limit=limit)

main.py:31: RuntimeWarning: coroutine 'TextChannel.purge' was never awaited
ctx.channel.purge(limit=limit)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

#

Any who can help?

spring flax
slate swan
#

Anyone know the issue?

#

``import discord
from discord.ext import commands

token = (token)
bot = commands.Bot(command_prefix='!', intents=discord.Intents.all())

@bot.event
async def on_ready():
print('working smoothly!')
bot.run(token)``

slate swan
slate swan
#

THANKYOUU

spring flax
# slate swan what do you wanna store exactly?

I just want to make a command that displays a poll and in that poll, the reaction data is updated on each reaction add.
Let's say there are two reactions, If someone clicks one, it'll update the percentage that clicked on that one

slate swan
#

i just realised

torn sail
slate swan
slate swan
slate swan
unkempt canyonBOT
#

await edit(*, name=..., permissions=..., colour=..., color=..., hoist=..., display_icon=..., mentionable=..., position=..., reason=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the role.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this.

All fields are optional.

Changed in version 1.4: Can now pass `int` to `colour` keyword-only parameter.

Changed in version 2.0: Edits are no longer in-place, the newly edited role is returned instead...
spring flax
slate swan
#

How do events work in dpy

slate swan
# slate swan How do events work in dpy

in simple words, whenever the api finds the suitable conditions that were registered by your app, it sends back the required data whenever that certain condition meets

slate swan
spring flax
#

would it be consistent enough?

slate swan
#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Reaction.message "discord.Reaction.message").

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
slate swan
slate swan
#

Why does this give me Attribute Error?

slate swan
#
@client.event
async def on_message(message):
  user_response = ''
  if message.author == client.user:
    return None
    
  elif str(message.content) == '-chat':
    username = str(message.author).split('#')
    await message.channel.send('Starting a new chat...')
    # starting advanced chat 
    if check_user('name_log.txt', username[0] + username[1]):
      file =  open('name_log.txt', 'a')
      file.write(username[0] + username[1] + '\n')
      file.close()
      time.sleep(2)
      await message.channel.send(r.choice(new_greeters) + ' ' + username[0] +'\n' + r.choice(questions))
      user_response = await client.wait_for('message', check = None, timeout= 15.0)     
    
    else:
      time.sleep(2)
      response  = r.choice(old_greeters)
      if response == old_greeters[0]:
        await message.channel.send(response)
        user_response = await client.wait_for('message', check = None, timeout= 15.0)
      else:
        await message.channel.send(response + '\n' + r.choice(questions))
        user_response = await client.wait_for('message', check = None, timeout= 15.0)
  user_response = user_response.content
  if user_response == 'good':
    await message.channel.send('Good to know')
client.run(TOKEN) ```
spring flax
#

does the on_reaction_add internally fetch each message?

slate swan