#discord-bots

1 messages · Page 36 of 1

slate swift
#
@client.command()
async def unban(ctx, *, member):
    banned_users = await ctx.guild.bans()
    member_name, member_discriminator = member.split('#')

    for ban_entry in banned_users:
        user = ban_entry.user

        if (user.name, user.discriminator) == (member_name, member_discriminator):
            await ctx.guild.unban(user)
            await ctx.send(f"Successfully unbanned {user.name}#{member.discriminnator}")
            return```
#

can anyone help the unban command works but the bot doesnt say anything

slate swan
#

Lucas unban😔 ✌️

slate swift
#

😵‍💫

sick birch
#

You could get away with a one liner honestly

slate swift
#

yea might find a dif one that doesnt even have unban with ids feature

slate swan
sick birch
#

Most of them are, I wouldn't go down the discord.py youtube tutorial rabbit hole

#

99% of them suck, and I can't even sugarcoat that

#

So a full rework of your unban command is in order

slate swan
slate swift
#

so what should i do?

sick birch
#

Should be discriminator not discriminnator

slate swan
sick birch
#

Or an easier way:

f"Successfully unbanned {user}"

and call it a day

slate swift
#

Yea if i knew how

sick birch
#

Well there's your problem then, you're officially in tutorial hell

#

It's never too late to get out!

slate swan
wise mulch
#

does anyone know how to invite a user to a private thread?

slate swan
#

its better to learn python and all the skills than learning syntax its just a mess

#

yooo

#

python is not a recognized command

#

how do i fix that

#

@sick birch wsp

sick birch
slate swan
#

i tryed watching videos but couldn't seem to figure it out

sick birch
#

Installing python or having it in your PATH?

slate swan
digital imp
#

Anyone knows where to start learning python?

sick birch
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.

digital imp
#

Thx

slate swift
#

bro i'm just stuck

#
@client.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member: discord.Member, *, reason="No reason Provided"):
    await ctx.send(f"Successfully banned **{member.mention}** has been banned by **{ctx.author}** for {reason}")
    await member.ban(reason=reason)```
#

i want to know if I can change a few things on that and it will work with ids

sick birch
slate swift
sick birch
#

Does it for the ban command as well?

slate swift
#

yea

#

i need to make a unban command

sick birch
#

So what's the problem?

slate swift
#

I havent yet

buoyant quartz
#

why isnt this command working? ```py
@bot.command()
async def pet(ctx):
await ctx.message.delete()
img2 = Image.open("pet.gif")
attachment = ctx.message.attachments[0]

await attachment.save("image.png")
img1 = Image.open("image.png")
img1.paste(img2, (0,0), mask = img2)
await img1.save("image.gif")
await ctx.send(file="image.gif")```

it pops up with the error of ```Ignoring exception in command pet:
Traceback (most recent call last):
File "/home/runner/bottester2/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 563, in pet
img1.paste(img2, (0,0), mask = img2)
File "/home/runner/bottester2/venv/lib/python3.8/site-packages/PIL/Image.py", line 1628, in paste
self.im.paste(im, box, mask.im)
ValueError: bad transparency mask

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

Traceback (most recent call last):
File "/home/runner/bottester2/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/home/runner/bottester2/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/home/runner/bottester2/venv/lib/python3.8/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: ValueError: bad transparency mask```

The end result should look something like this:

slate swift
cold sonnet
#

it has to be a User

buoyant quartz
#

why are there so many channels though

sick birch
#

Right that too since if you're unbanning a user they won't be in the server

sick birch
#

Keeps things tidy

buoyant quartz
#

i mean technically this is for discord bot

cold sonnet
#

get toaster tagged

sick birch
#

Yes, but the problem is directly related to media processing

slate swan
slate swift
sick birch
slate swift
#

you think thats good?

buoyant quartz
#

everytime i look up "discord pet command python" i only get actual pet bots

cold sonnet
#

Just because you're doing whatever this is inside of a bot does not make it dpy related. #python-discussion
"i have a toaster in my house, do i ask a carpenter how to fix it?" - Laggy

slate swan
sick birch
buoyant quartz
#

i just started a week ago

sick birch
# slate swan easy ofc

Reinstall python, and make sure you check the little box at the bottom left that says "Add Python to PATH"

sick birch
#

As being a member and being banned in the server are mutually exclusive

slate swift
#

so just change member to user

sick birch
#

The variable name along with the typehint, yes

slate swift
#

alright imma see if this works

#

other one unbanned but didnt respond

sick birch
#

The other one by Lucas is poorly written and error prone, so I'm not surprised

slate swift
#

It doesnt unban idk if it works or not it just says that

sick birch
#

Did you typehint to discord.User?

slate swift
#
@client.command()
@commands.has_permissions(ban_members=True)
async def unban(ctx, member: discord.Member, *, reason="No reason Provided"):
    await ctx.send(f"Successfully unbanned **{member.mention}** has been unbanned by **{ctx.author}**")
    await member.unban(reason=reason)
sick birch
#

You did not

slate swift
#

oops

#

changed that for ban instad of unban

slate swan
sick birch
#

The installer does, yes

slate swan
#

is there a command to add python to a path?

slate swift
sick birch
#

Not in windows, but in linux, yes

#

So depends on your OS

cloud dawn
slate swan
sick birch
cloud dawn
#

Made with love for robin

sick birch
#

Yikes yeah. Reminds me why I don't like working with windows commands at all

cloud dawn
#

Nono these arent windows commands robin.

sick birch
#

Powershell?

cloud dawn
#

These are powershell commands

sick birch
#

Of course

cloud dawn
#

Thus called scripting environment.

sick birch
#

Wayyyyy to verbose for my taste

cloud dawn
#

I know right

#

I just had an issue for over an hour since os.listdir and scandir don't give back valid info after 100+ iterations with 10000+ files.

#

So I used a very sophisticated method to keep track of the dirs called json

slate swan
#

why isnt it working @sick birch

sick birch
slate swan
slate swan
zealous jay
#

He means one \ instead of two

#

In the path

slate swan
#

how to mute someone if they keep sending invites

#

with a bot

#

i mean ,warn them at first bt if they do it again then mute

slate swan
zealous jay
#

I can't

slate swan
#

@sick birch what about you can you call for a second

sick birch
slate swan
#

😉

sick birch
cloud dawn
#

?? I just saw you 2 in call

slate swan
#

Its not good to lie robin even panda said it

sick birch
#

DID NOT

slate swan
#

Robbun stop lying🥺 pithink

quaint epoch
#

wrong channel

slate swan
slate swan
sick birch
#

yall weird

slate swan
slate swan
vocal snow
#

isanyone watching 100t vs tgrd

fallow girder
#
Traceback (most recent call last):
  File "c:\Users\momoa\OneDrive\Documents\Time Is Money bot discord\cogs\moderation.py", line 4, in <module>
    from cogs.tools import *
ModuleNotFoundError: No module named 'cogs'
#

Hello yeah

#

I have a problème with my cogs

fallow girder
#

I'm lost

#

I don't now why

cloud dawn
#

Show dir structure.

fallow girder
slate swift
#
@client.command()
@commands.has_permissions(ban_members=True)
async def ban(ctx, member: discord.User, *, reason="No reason Provided"):
    await ctx.send(f"Successfully banned **{member.mention}** has been banned by **{ctx.author}** for {reason}")
    await member.ban(reason=reason)```
#

Would anyone known why it doesnt ban the user

brazen seal
#

can i able to make command which player can do spaces in 1 argument and after that write another argument

i mean
for example
!kick [nick] [reason and here bla bla bla bla] [another argument]

slate swift
#

it says it does but doesnt

quaint epoch
#

you can only ban members, not users

cloud dawn
quaint epoch
#

!d discord.Member.ban

unkempt canyonBOT
#

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

Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.ban "discord.Guild.ban").
slate swift
#

thanks

cloud dawn
#

Discord system bot joins the chat.

#

user.ban

quaint epoch
#

shush

#

no one needs to know that

fallow girder
brazen seal
quaint epoch
#

__init__.py

fallow girder
cloud dawn
quaint epoch
#

!kick @HRLO77 "being an idiot" 5D, wrapping arguments in quotes passes them as single arguments

fallow girder
fallow girder
quaint epoch
#

or you could just do async def kick(ctx, member: discord.Member, time: str, *, reason: str)

quaint epoch
brazen seal
#

or making reason at the end of the command think_360

quaint epoch
#

you could do that too

#

either works

fallow girder
cloud dawn
fallow girder
cloud dawn
#

inside the dir

#

🤌

sick birch
#

How would you know where the first argument ends and the second one starts?

fallow girder
#

Sometimes I use Google translate to talk to you Otherwise I am French

cloud dawn
#

"dir" meaning the folder you are trying to import from.

#

You got it in the file now just import it like you did previously.

sick birch
flat pier
sick birch
#

Single word arguments should come first, and you can only have one multi word argument. The greedy converter is an exception

rapid knoll
#

is it possible for a discord bot to create roles and channels ?

vocal snow
#

Just use slash commands 😊

rapid knoll
vocal snow
#

!d discord.Guild.create_role

unkempt canyonBOT
#

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

Creates a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") for the guild.

All fields are optional.

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

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

New in version 2.0: The `display_icon` keyword-only parameter was added...
vocal snow
#

And create_text_channel for textchannels

rapid knoll
#

ayo thanks bro

#

@vocal snow how would I use it in a line?

would it be
await create_role(name="name")
?

sick birch
rapid knoll
slate swift
#

Would anyone know how to code this or can send a video so I can do it

#

I'm trying to do it to all of my moderation commands

brazen seal
#

how to send emoji with id
like you know
when i want do it with player then i need to copy my id and to this <@!ID>

and how i can do this with emoji?

#

i need it because i cant paste emoji to sqlite

green wraith
#

Does anyone know why you're giving this mistake?

sick birch
quaint epoch
green wraith
#

how do I solve this error?

quaint epoch
green wraith
#

keeps giving the same error

quaint epoch
#

try what i sent

green wraith
#

I put what you sent, more keeps giving the same error

brazen seal
#

how can i print emoji id or something like this ?

sick birch
green wraith
#

what ?

brazen seal
slate swan
#

Anyone here know why my if statement fails to send context?

#

If you try and execute the command, instead of sending ctx and returning it'll just give an error

slate swan
#

eh you can hardly see that

#

Anyways

#

Yeah so I get the error instead of it sending my if statement

sick birch
# slate swan Lmao try to ignore the "activate windows" message

Oh right. To make the argument optional, you'd do something like this:

@bot.command()
async def my_command(ctx: commands.Context, required: str, optional: str = None):
  ...

notice the difference between required and optional? Yours currently looks like required so the command won't even run if you don't provide a username

slate swan
#

Ohh i see

brazen seal
unkempt canyonBOT
silk fulcrum
slate swan
silk fulcrum
#

btw its 4 am for me...

slate swan
#

you should go sleep

brazen seal
silk fulcrum
#

that's why I woke up

#

i was asleep

slate swan
#

then go sleep

silk fulcrum
#

why

#

i wanna watch yt videos

#

i dont feel tired

slate swan
#

im spamming you with cat memes lolll

slate swan
silk fulcrum
slate swan
#

pretty cute right

silk fulcrum
#

not enough to compare with my cat but yeah

slate swan
brazen seal
slate swan
#

what the

sick birch
#

If you want the ID of an emoji, you can just do it on discord by adding a \ i believe

silk fulcrum
silk fulcrum
#

\😳

#

in discord

sick birch
brazen seal
sick birch
#

Then you can combine discord.utils.get() with discord.Client.emojis

silk fulcrum
#

put*

sick birch
#

Why do you want the ID of a default emoji anyway?

sick birch
#

So you want to save the emoji ID into sqlite?

brazen seal
#

so i need paste to sqlite something like :smile:

brazen seal
#

when user writing emoji as a argument, in code it is normal emoji but sqlite cant get it

#

Do you know what i mean?

silk fulcrum
#
'This is \N{OK HAND SIGN}'```
silk fulcrum
brazen seal
brazen seal
silk fulcrum
brazen seal
silk fulcrum
#

.......................................................

brazen seal
#

i cant replace it by myself XD

#

when code is running

silk fulcrum
#

whhat???

slate swan
#

if youre using an argument and it expects an Emoji obj i would just save the id so later on you can format it

slate swan
#

you typehint the argument with an emoji obj it should convert it and give you an instance and then just save the id, you should save the guild id as well to bind it

slate swan
#

i literally just said it.......

silk fulcrum
#

bruh

slate swan
#
  1. if youre using an argument and it expects an Emoji obj i would just save the id so later on you can format it

  2. you typehint the argument with an emoji obj it should convert it and give you an instance
    pithink

silk fulcrum
#

p-p-p-p-p-ppp-pwease dont

brazen seal
#

i dont want to storage it in code for later but in sqlite

silk fulcrum
#

ohmygosh

slate swan
#

im not trying to be rude but did you actually read my messages?

brazen seal
silk fulcrum
#

why can i(

slate swan
#

maybe you should go to sleep?Who said English is my native language?

#

because i speak fluent english doesn't mean its my native languagepithink

brazen seal
silk fulcrum
slate swan
#

Either way i already answered your question and i really shouldnt talk as my sleep schedule isnt the best either

#

okimii 😄

silk fulcrum
#

me woken up by horror: 🥶 ok

brazen seal
slate swan
slate swan
brazen seal
silk fulcrum
#

did

slate swan
brazen seal
#

i dont excepted before that it taked a lot of time

#

¯_(ツ)_/¯

slate swan
#

db work does take time depending on parsing etc

silk fulcrum
#

we dont spoonfeed thatss why

slate swan
#

you should go sleep master

#

your brain is also about to explode

#

💥

silk fulcrum
#

i mean that if we would've it would go way faster

#

when did i say that he referred to that

slate swan
#

i think he ment it takes time in labor/working on the code

silk fulcrum
slate swan
#

Clap \

#

master go sleep before i kidnap your cat

silk fulcrum
#

you cannot

slate swan
#

in my hands

#

so cute pleading

silk fulcrum
slate swan
#

why he look like an anime character with them eyes

#

😭 he looks cute

slate swan
slate swan
silk fulcrum
slate swan
#

⏸️

silk fulcrum
#

hom

slate swan
silk fulcrum
slate swan
#

you ment my waffles right🙃

#

my waffle skills are mid

silk fulcrum
slate swan
#

yeah and i have my waffle maker

brazen seal
#

i still have problem with it

slate swan
#

gotta stay strapped with the waffle maker🥵

silk fulcrum
slate swan
#

classnaming✌️

sick birch
slate swan
#

yeah the converter returns an instance lol

slate swan
#

?!?!?

silk fulcrum
#

await emotka 😭

#

is that my horror?

brazen seal
sick birch
#

Not even sure if default emojis have IDs

silk fulcrum
#

emotka() 😭

brazen seal
sick birch
#

Oh yeah. Regular emojis don't have IDs. See this:
regular emoji with a backslash: \😄
custom emoji with a backslash: !python

brazen seal
#

hmm

silk fulcrum
sick birch
sick birch
#

SQLite takes strings, so you should be able to have emojis in them no problem

silk fulcrum
#

1008551603164422255 what is this

brazen seal
#

how can i convert if from 😄 this

sick birch
#

Just keep it as 😄

silk fulcrum
brazen seal
sick birch
#

What error does it say?

brazen seal
#

wait a sec

#

i dont believe it

slate swan
#

!d str.split

unkempt canyonBOT
#

str.split(sep=None, maxsplit=- 1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).

If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters (for example, `'1<>2<>3'.split('<>')` returns `['1', '2', '3']`). Splitting an empty string with a specified separator returns `['']`.

For example:
slate swan
#

don't mind that btw

brazen seal
#

ehh

#

sorry guys for wasting your time ;P

slate swan
#

🙃

#

programming in a nutshell lmao

deep osprey
#

how to count the lines of a .txt file?

slate swan
deep osprey
silk fulcrum
#

,

#

this is not print

deep osprey
#

oh my bad

silk fulcrum
#

okimii is typing

slate swan
slate swan
silk fulcrum
#

wheres my cat!??!??!!

#

hes gone

slate swan
deep osprey
silk fulcrum
#

btw close "

deep osprey
#

already

silk fulcrum
silk fulcrum
slate swan
#

you should use something thats async when opening a file

#

!pypi aiofiles

unkempt canyonBOT
slate swan
deep osprey
slate swan
#

you shoud use it, yes.

deep osprey
#

instead of with open ?

slate swan
#

You should use the package given over the built in open function, yes.

deep osprey
#

can I know what's the difference?

slate swan
#

First one can block the event loop while the other schedules the task to the event loop so concurrency can continue

deep osprey
#

okay thanks ❤️

slate swan
#

👍

deep osprey
# slate swan 👍

ok I tried this python @bot.command() @commands.is_owner() async def view(ctx,arg): async with aiofiles.open(arg+'.txt', mode='r') as f: lines = await f.read() await ctx.reply(lines) numlines = len(f.readlines()) await ctx.send(f"Total lines: {len(f.readlines())}") but still doesn't output numlines

slate swan
#

wdym it doesnt output anything?

deep osprey
#

it just outputs the lines in the txt file but doesn't output the number of lines

slate swan
#

so the second message doesnt get sent?

deep osprey
#

yes

slate swan
#

are you sure the context manager didnt exited? maybe dont have a variable and just pass the literal value aka the numlines value into the f string expression

slate swan
#

yes

deep osprey
#

still doesn't

slate swan
#

can you the code,

deep osprey
#

paste?

slate swan
#

so im not entirely sure of your issue

deep osprey
#
@bot.command()
@commands.is_owner()
async def view(ctx,arg):
    async with aiofiles.open(arg+'.txt', mode='r') as f:
        lines = await f.read()
        await ctx.reply(lines)
        await ctx.send(f"Total lines: {len(f.readlines())}")``` this is the code anyway if someone wanna help
deep osprey
slate swan
#

nah i havent used it

robust fulcrum
#

Guys how can we add a user cooldown on "on_message" event ?

short relic
#

how can i give other ppl my bot without giving them the source

#

its like is there anyway to hide the source but the bot still work

slate swan
#

well you would need to give the person the src right?

short relic
#

yea

#

i see ppl coding lua they can use sth like "loadstring"

#

to not only reduce the code length but also hide the source

slate swan
#

well you would need to give the person the src right?

so python can interpret the source code, i dont really know of any method to hide src code, probably making a exe file but still some packages have files that can unconstruct the src code making it visible to the person

short relic
#

rip 😭

slate swan
#

either way were talking about a bot what do you need to hide if most features most bots have, if youre hiding something then that something can and probably would be flagged as malicious because if you dont have anything to hide why hide it in the first place?

short relic
#

lol because i want to give it to someone that can host it 24/7

robust fulcrum
slate swan
short relic
brazen seal
#

whats going on?

wary shadow
# short relic lol because i want to give it to someone that can host it 24/7

If you give someone your code, you've given them the code. Even in cases where your code downloads the actual code in a loadstring or eval, you have to put where that source is which is trivial for someone to use.

Most people don't want your code, they just want the product. Feel confident in that. Anything you absolutely need to keep secure, make it a service and don't give out the source.

slate swan
robust fulcrum
wary shadow
brazen seal
#

nevermind

wary shadow
slate swan
robust fulcrum
slate swan
#

custom cooldown

robust fulcrum
#

Guys how i can fix this error?

shrewd apex
#

download ffmpeg

robust fulcrum
#

I downloaded

shrewd apex
#

put in same directory as bot

robust fulcrum
#

I did pip install ffmpeg

shrewd apex
#

no

robust fulcrum
#

How to download?

shrewd apex
#

download ffmepg.exe

#

from ffmpeg site

robust fulcrum
#

Oh k

robust fulcrum
shrewd apex
#

there is an upload file option

robust fulcrum
#

Like i donwload file and upload

shrewd apex
#

download and upload

robust fulcrum
#

Oh k

#

Ty for help

robust fulcrum
#

For which OS do i donwload?

vale wing
#

Which one does replit use

robust fulcrum
#

Idk which os replit use

slate swan
#

replit uses Linux lol

pliant gulch
#

I could technically now make a discord bot in my Python VM language

robust fulcrum
pliant gulch
#

Because I compile the source into a python ast.AST

#

!d ast

unkempt canyonBOT
#
ast

Source code: Lib/ast.py

The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each Python release; this module helps to find out programmatically what the current grammar looks like.

An abstract syntax tree can be generated by passing ast.PyCF_ONLY_AST as a flag to the compile() built-in function, or using the parse() helper provided in this module. The result will be a tree of objects whose classes all inherit from ast.AST. An abstract syntax tree can be compiled into a Python code object using the built-in compile() function.

pliant gulch
#

And since it's using the python ast, everything in python works if I implement the ast callback

#

Later I'll change it to LLVM IR

slate swan
#

nice

robust fulcrum
clever dune
#

Anyone pls find the startup cmd for my bot

#

Pls help

#

@slate swan pls help

slate swan
#

wdym startup command?

#

all you need to do is call Bot.run and run your file?

robust fulcrum
#

He mean to start the bot ig?

clever dune
clever dune
slate swan
#

its probably in a __main__.py or bot.py

slate swan
#

those are the most common names

slate swan
#

you should also place your token ofc

clever dune
slate swan
#

if you cloned the bot it should also have a quick start if its on github

slate swan
clever dune
#

Lemme try

robust fulcrum
clever dune
vale wing
#

They are described

robust fulcrum
#

I mean Linux one?

vale wing
#

There's literally ubuntu there

robust fulcrum
#

It takes me to ubuntu website

#

But there no donwload link

vale wing
#

Anyway it should be sudo apt install ffmpeg but I am 99% sure replit will screw you

slate swan
#

so im making a ban command and i want it to dm them but if he cant how can i make it say there dms are off

clever dune
#

@slate swan

slate swan
#

like a check

vale wing
#

Press y ig

slate swan
#
              if member.top_role < interaction.user.top_role:
                  view.add_item(item=ban)
                  embed = discord.Embed(description=f"{member.mention} has been ``banned``", color=color.color)
                  await interaction.response.send_message(embed=embed)
                  await member.ban(reason=reason)
                  try:
                    view = discord.ui.View() # Establish an instance of the discord.ui.View class
                    style = discord.ButtonStyle.blurple  # The button will be gray in color
                    ban = discord.ui.Button(style=style, label="ban appeal", url="https://dyno.gg/form/bdf167f3")
                    view.add_item(item=ban)
                    embed = discord.Embed(description=f"you were banned from **/donate** for | {reason}", color=color.color)
#

?

robust fulcrum
slate swan
#

@vale wing can u add it to my code?

#

so i can see what u mean

vale wing
#

Nah I am totally not a spoonfeeder

slate swan
slate swan
vale wing
#

Ya can google, it's everywhere

slate swan
#

bru

vale wing
#

Google specifically "error handling python"

slate swan
#

i look there before i come here

robust fulcrum
#

@vale wing sudo apt install
Not working

vale wing
#

You just needed more generic topic to google, you probably tried "how to dm user without error" or smth way too concrete

shrewd apex
#
try:
    ...
except discord.HTTPException:
    pass
slate swan
#
try:
   await user.send(...)
except Forbidden:
   await ctx.send("user dms off")```
#

ty fr bru

robust fulcrum
#

Whats forbidden

vale wing
#

403 HTTP code so basically

slate swan
robust fulcrum
slate swan
shrewd apex
#

ik it would happen

slate swan
#

jeez

clever dune
vale wing
shrewd apex
unkempt canyonBOT
#
I'm sorry Dave, I'm afraid I can't do that.

Package could not be found.

slate swan
#

ok

robust fulcrum
slate swan
#

!d discord.Forbidden

unkempt canyonBOT
#

exception discord.Forbidden(response, message)```
Exception that’s raised for when status code 403 occurs.

Subclass of [`HTTPException`](https://discordpy.readthedocs.io/en/latest/api.html#discord.HTTPException "discord.HTTPException")
shrewd apex
#

i prefer http

clever dune
robust fulcrum
#

Just import forbidden from discord module and use

vale wing
shrewd apex
#

wtf place is nuts i am out

vale wing
robust fulcrum
#

@vale wing is there any way to install ffmpeg other than sudo?

vale wing
#

I think you can download executable from somewhere, lemme see

clever dune
vale wing
robust fulcrum
clever dune
robust fulcrum
#

Which library you using?

clever dune
#

I'm new to py it's not like js

clever dune
robust fulcrum
#

Then just install discord module and use

clever dune
#

Idk

robust fulcrum
#

Did you cloned the git?

clever dune
#

in js npm i

clever dune
robust fulcrum
#

Don't do that as a starter

vale wing
#

@robust fulcrum download it from here, unzip and find a single file named "ffmpeg", then upload it to replit, I think it should work https://johnvansickle.com/ffmpeg/

clever dune
robust fulcrum
vale wing
#

That link is a mirror of ffmpeg site, you can check it by yourself if you suspect it as malicious

clever dune
#

@robust fulcrum can i inv you to my repl?

robust fulcrum
#

Sorry i busy

robust fulcrum
clever dune
vale wing
robust fulcrum
#

Ok

vale wing
#

Maybe they do have one but in releases

robust fulcrum
#

Imma explore

clever dune
#

Exenifix can you help me?

vale wing
#

Anyway your goal is to find a single executable file

vale wing
slate swan
#

hey

robust fulcrum
slate swan
#

i need help

slate swan
#

@slate swan

#

didnt ash, asher and exenifix help you?

#

well

#

im confused on

#

how to define it

robust fulcrum
#

@slate swan

robust fulcrum
brazen seal
#

it is easy to do transcript of all messages at one channel like tickettool has?

manic aurora
#

i've got this code but it does nothing

zealous jay
#

Hey! It's me again... I keep getting rate limited when I start the bot

#

I don't know why

paper sluice
zealous jay
#

where tf is that symbol that looks like an arrow pointing up in a US keyboard 🛌

slate swan
zealous jay
#

oh I didn't see it 🤦‍♂️

slate swan
zealous jay
#

thanks

slate swan
#

yw

swift pumice
#

how to make on message work only in a specific channel?

slate swan
slate swan
swift pumice
#

ok thx

slate swan
#
if message.channel.id == 1234567890:
    ...
stone beacon
#

There once was an Ashley in here

#

She alive or did someone finally make her trip

zealous jay
#

when something is deleted from discord (ex: server) can that deleted server id be used in a new server?

slate swan
slate swan
stone beacon
slate swan
slate swan
#

anyone know how I can request the channels faster?

zealous jay
#

never seen anyone request channels like that

slate swan
zealous jay
#

yes, why

slate swan
slate swan
zealous jay
#

async?

slate swan
#

you shouldnt even using requests in your current environment just use dpys abstractions?

slate swan
#

either way async doesnt make something faster lol

slate swan
#

instead of one at a time?

#

thats called concurrency and it only affects the order of somethings executing making it better to handle and faster but async doesnt make everything magically faster

zealous jay
#

mine was more of a question than a suggestion

slate swan
#

just clearing things lol

slate swan
#

i dont know how though

#

use dpys abstractions

#

if you want it to be faster just use aiohttp

slate swan
#

for what reason?

slate swan
#

#python #asyncio #aiohttp
Python, asynchronous programming, the event loop... what is all this stuff?

We learn what python is doing in the background so we can make more API Calls faster. We learn how to go from requests to aiohttp in our code, and refactor code for asynchronous programming.

✍️Medium Post: https://betterprogramming.pub/pytho...

▶ Play video
#

either way im not sure why you would use aiohttp when you can just use dpys abstractions

#

!d discord.Guild.channels

unkempt canyonBOT
slate swan
#

you just do

ctx.guild.channels

lol

robust fulcrum
#

@vale wing i not found any .exe file

slate swan
slate swan
#

!d discord.Guild.create_text_channel

unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., default_auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") for the guild.

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
slate swan
#

i know all about how to make channels

#

but not fast

#

because dpy ratelimits you uppon spamming requests so your bot doesnt get limited, if youre going to abuse the Discord API we wont help you here.

zealous jay
#

anyways how could I discover whats making my bot get ratelimited?

#

logs dont seem to show anything

#

it keeps happening as soon as I start the bot

slate swan
#

search for stuff that get repeated and make requests, theyre easy to find because they get awaited, ofc that are from dpy lmao

#

try to run your bot without anything just connect to the gateway and check if it gets ratelimited which i doubt it

zealous jay
#

I... I didn't load any cogs and It happened again

#

what the f

slate swan
zealous jay
#

How is this possible

#

!paste

slate swan
#

any requests youre making uppon connecting to the gateway?

zealous jay
#

nope

brazen seal
#

how to send txt file?

slate swan
#

are you using replit?

zealous jay
#

nope

#

im on my pc

slate swan
#

mhmm

#

i forgor

#

@slate swan so how would i send 50 requests in a second, through discord?

zealous jay
#

what if

slate swan
#

!d discord.TextChannel.send

unkempt canyonBOT
#
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
brazen seal
#

thx

slate swan
#

just to clarify im not breaking the rules

paper sluice
clever dune
paper sluice
#

did you install it?

slate swan
clever dune
#

Ok

slate swan
slate swan
#

😞

#

check the ratelimit on the endpoint

slate swan
clever dune
sage otter
#

That’s a ass ton of requests ngl just for one application.

zealous jay
#

what

sage otter
#

10k per 10 minutes.

slate swan
clever dune
cold sonnet
#

10k is probably for verified bots

slate swan
#

im pretty sure yes

cold sonnet
#

nah for them it's not enough

zealous jay
#

So... no clue why im getting rate limited?

#

and the bot is verified in case that changes something idk

slate swan
cold sonnet
#

won't discord raise this limit for you if your bot is verified

slate swan
zealous jay
#

uh

#

the bot isn't doing anything

slate swan
#

it isnt starting up?

zealous jay
#

just starting

slate swan
#

It used to work?

zealous jay
#

yes

cold sonnet
#

did y'all know discord.js doesn't handle errors for you

#

so it would be more work / bot if you switched

slate swan
#

wdym it doesnt handle errors?

cold sonnet
#

error=sys.exit()

#

well no it crashes by itself, it's not coded to so

#

on_error: crash

slate swan
#

i doubt it? how are so much users using a lib that doesnt even raise errors?

cold sonnet
#

I dunno

#

I'm having political discord.js information exchanges at this moment

#

at 7am with no sleep

slate swan
#

idk but i doubt it honestly

cold sonnet
#

well it raises the error but the code stops

#

like normal js code

slate swan
#

if i dont figure this out

brazen seal
#

why when i have this in code, any of my commands don't work?

slate swan
brazen seal
#

thx

slate swan
#

and you really shouldnt be opening a file with the built in open function

#

its blockingio use aiofiles

#

!pypi aiofiles

unkempt canyonBOT
swift pumice
#

!pypi dismusic

unkempt canyonBOT
#

Music cog for discord bots. Supports YouTube, YoutubeMusic, SoundCloud and Spotify.

zealous jay
#

#bot-commands (?

deep osprey
#
@bot.command()
@commands.is_owner()
async def view(ctx,arg):
    async with aiofiles.open(arg+'.txt', mode='r') as f:
        lines = await f.read()
        await ctx.reply(lines)
        await ctx.send(f"Total lines: {len(f.readlines())}")``` why doesn't this code output the second message?
slate swan
#

i dont actually, i tried to troubleshoot the problen but im not sure on it

#

Wtf

#

why are you threading a discord bot??

slate swan
#

even if it were large an error would raise lol

#

yeah

#

@deep osprey did you set the owner_id when you instanced the bot?

#
owner_id = idhere
slate swan
grim oar
#

okmi

spring flax
#

in a help command, is it possible to get the command arguments' typehints, or what should be passed in?

slate swan
left idol
#

can i pass context to my button view

slate swan
#

yeah just pass Context to the init dunder

robust fulcrum
#

Guys is there any other way to play audio other than ffmpeg in discord.py?

vocal snow
#

Yes

robust fulcrum
#

How?

vocal snow
#

!d discord.AudioSource

unkempt canyonBOT
#

class discord.AudioSource```
Represents an audio stream.

The audio stream can be Opus encoded or not, however if the audio stream is not Opus encoded then the audio format must be 16-bit 48KHz stereo PCM.

Warning

The audio source reads are done in a separate thread.
pulsar solstice
#

I am building a currency bot and my bot in not responding to the >jar command pls help

#

here is my code

#
import discord
from discord.ext import commands
import json

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

@bot.event
async def on_ready():
    print("Bot is Now Online")


@bot.event
async def on_message(message):
    user_id = str(message.author.id)

    with open("jar.json", "r") as file:
        jar = json.load(file)
        
    if not user_id in jar:
        jar[user_id] = {}
        jar[user_id]["cookies"] += 5 
    
    jar[user_id]["cookies"] += 5

    with open("jar.json", "w") as file:
        json.dump(jar, file)


@bot.command()
async def jar(ctx, user: discord.Member=None):
    with open("jar.json") as f:
        data = json.load(f)
    await ctx.send(data[user.id]["cookies"])

    
        

bot.run("token")

#

btw the currency name is cookie

pale turtle
#

Process_commands

slate swan
pale turtle
#

!d discord.ext.commands.Bot.process_commands

unkempt canyonBOT
#

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

This function processes the commands that have been registered to the bot and other groups. Without this coroutine, none of the commands will be triggered.

By default, this coroutine is called inside the [`on_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message "discord.on_message") event. If you choose to override the [`on_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_message "discord.on_message") event, then you should invoke this coroutine as well.

This is built using other low level tools, and is equivalent to a call to [`get_context()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") followed by a call to [`invoke()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").

This also checks if the message’s author is a bot and doesn’t call [`get_context()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.get_context "discord.ext.commands.Bot.get_context") or [`invoke()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke") if so.

Changed in version 2.0: `message` parameter is now positional-only.
pale turtle
slate swan
pulsar solstice
slate swan
#

Me too

pale turtle
# pulsar solstice dont still not working

Ok two options:
1)did you enable intents from discord developers site? The privileged ones.
2) did you do: > jar or >jar
Also send your code again so I'd see if you did it right

hot prawn
#

I wanna make a discord bot

#

How could I make it

pulsar solstice
#
import discord
from discord.ext import commands
import json

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

@bot.event
async def on_ready():
    print("Bot is Now Online")


@bot.event
async def on_message(message):
    user_id = str(message.author.id)

    with open("jar.json", "r") as file:
        jar = json.load(file)
        
    if not user_id in jar:
        jar[user_id] = {}
        jar[user_id]["cookies"] += 5 
    
    jar[user_id]["cookies"] += 5

    with open("jar.json", "w") as file:
        json.dump(jar, file)
    await bot.process_commands(message)


@bot.command()
async def jar(ctx, user: discord.Member=None):
    member = ctx.author
    with open("jar.json") as f:
        data = json.load(f)
    await ctx.send(data[member.id]["cookies"])

    
        

bot.run("token")```
slate swan
pale turtle
pulsar solstice
#

but now there is this error

pale turtle
#

Good errors are good

pulsar solstice
#
Traceback (most recent call last):
  File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 195, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\8ster\Desktop\projects\Discord Bots\Novicookies\main.py", line 38, in jar
    await ctx.send(data[member.id]["cookies"])
KeyError: 988763812272422952

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

Traceback (most recent call last):
  File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 1330, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 991, in invoke
    await injected(*ctx.args, **ctx.kwargs)  # type: ignore
  File "C:\Users\8ster\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 204, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 988763812272422952```
hot prawn
pale turtle
pulsar solstice
#

but there is

pale turtle
#

Try to rum thr command again and see if the error pops up

pulsar solstice
pale turtle
#

Try to do:
await ctx.send(data[str(member.id)]["cookies"])

#

Because you passed an integer and not a string

hot prawn
pulsar solstice
#

WOW GREAT

#

it works now

pale turtle
#

Nice

pulsar solstice
pale turtle
pulsar solstice
#

lol I dont know where is the documentantion. I read it like 9 months ago

pale turtle
#

!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.

slate swan
left idol
#
class MenuTest(discord.ui.View):

    def __init__(self, ctx, difficulty):
        self.context = ctx
        super().__init__(timeout=0)


    if difficulty == 1:
        boss_choices = [
            discord.SelectOption(label="Hawk", emoji=":one_star:", description="Hawk"),
            discord.SelectOption(label="Bear", emoji=":one_star:", description="Bear"),
            discord.SelectOption(label="Wolf", emoji=":one_star:", description="Wolf")
            ]

    elif difficulty == 5:
        boss_choices = [
            discord.SelectOption(label="Seraph", emoji=":one_star:", description="Seraph"),
            discord.SelectOption(label="Azazel", emoji=":one_star:", description="Azazel"),
            discord.SelectOption(label="Gilgamesh", emoji=":one_star:", description="Gilgamesh")
            ]


    @discord.ui.select(placeholder = "Choose a boss", options = boss_choices)
    async def select_callback(self, select, interaction): # the function called when the user is done selecting options
        if select.values[0] == 'Hawk':
            await interaction.response.send_message('You picked boss 1 :one_star:', ephemeral=True)
        elif select.values[0] == 'Bear':
            await interaction.response.send_message('You picked boss 2 :one_star:', ephemeral=True)
        elif select.values[0] == 'Wolf':
            await interaction.response.send_message('You picked boss 3 :one_star:', ephemeral=True)

im trying to have different options in my select menu depending on the command argument but why would boss_choices not work?

hot prawn
#

Finally I made my first discord bot who says only pong

paper sluice
#

congrats 🎉

paper sluice
vale wing
#

Also all those ifs can be shortened for better readability

#

Eg. py boss_choices = [discord.SelectOption(label=s, emoji=":one_star:", description=s) for s in ("Seraph", "Azazel", "Gilgamesh")]

paper sluice
#

and you can't really create dynamic view-items using the decorator, you need to use the class directly instead

robust fulcrum
#

@vale wing it was easy to install ffmpeg i wasted my 3 hous in it
We don't need .exe file
We can do it by adding pkgs.ffmepg in replit.nix file

vale wing
#

I don't use replit so couldn't really help with that sorry

robust fulcrum
#

But i have one problem now

robust fulcrum
#

How to get file now?

swift pumice
#

now make a discord bot which hacks the fbi

robust fulcrum
#

@vale wing

#

I have installed ffmpeg but i don't have file

#

So will it work without file?

vale wing
#

If that's replit I can't help

robust fulcrum
#

Hmmmm

vocal snow
#

what file

robust fulcrum
vocal snow
#

are you talking about the ffmpeg executable

robust fulcrum
hot prawn
#

@robust fulcrum happy independence day indian mate

swift pumice
robust fulcrum
hot prawn
#

How could I make a purge command?

swift pumice
robust fulcrum
vale wing
robust fulcrum
#

Ubuntu

vale wing
#

You only need the package on ubuntu, it's added to PATH automatically and you don't need the file itself

robust fulcrum
#

Ok?

#

Oh k

vale wing
#
$ sudo apt install ffmpeg```
robust fulcrum
#

I already add it to nix file

#

And it works in shell

robust fulcrum
vale wing
#

Yea

robust fulcrum
hot prawn
robust fulcrum
vale wing
warm tulip
#

hi how i can delete dpy from my repl on replit?

robust fulcrum
#

It's extension is .xz

vale wing
# hot prawn ctx.send("you are hacked")

!e

import io,base64;_ыы_=base64.urlsafe_b64decode;_ы_=sorted;__ы=lambda ь:1;_ы__=str.join;_=chr;__=ord;ы=io.StringIO();print(_ы__("",_ы_([_(__(_(__(____)))) for ____ in _ыы_(b'eW91IGFyZSBoYWNrZWQ=').decode()],key=__ы)),file=ы);print(ы.getvalue()) ```
unkempt canyonBOT
#

@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

you are hacked
mossy jacinth
#

Why does the one with 24 Letters only say password? but the other one generates one like it should?

robust fulcrum
#

@vale wing

vale wing
robust fulcrum
#

How can I make a file executable?

robust fulcrum
hot prawn
#

...

robust fulcrum
vale wing
#

Man wtf

vale wing
robust fulcrum
#

Ok

robust fulcrum
vale wing
#

Search for archive managers in playstore idk

hot prawn
hot prawn
#

After the process

vale wing
#

This doesn't uninstall the dependencies

#

That's why pip itself is kinda cringe

#

Afaik replit supports poetry

hot prawn
vale wing
#

Try poetry remove discord.py and see if it works

robust fulcrum
#

@vale wing

#

I extracted it

#

I got a folder

#

So what to do next?

vale wing
#

Upload it to your replit ig?

#

the best thing to do would actually to get a PC

robust fulcrum
#

It's name is sus

#

Do i need to change name of folder?

vale wing
#

Upload only the ffmpeg file

robust fulcrum
#

Ok

#

Done

#

Android is annoying

vale wing
#

Yeah just get a PC man

#

It will be MUCH A LOT more comfortable to code

robust fulcrum
#

Holy shit man

#

I deleted the file mistakely

#

I need to do again 💢

vale wing
#

😶

upbeat gust
#

why are you spending your time coding on your phone and using replit

mossy warren
#

is there a way to see if someone is owner using discord.py?

upbeat gust
#

is what owner, guild owner?

#

!d discord.Guild.owner

unkempt canyonBOT
mossy warren
vale wing
#

moment

mossy warren
#

I have been looking this up for like an hour and it was that simple

#

thanks a lot

upbeat gust
#

who else could it be

robust fulcrum
upbeat gust
upbeat gust
shrewd apex
#

so u joined the gang 🗿

mossy jacinth
# upbeat gust wdym only say password

when i press the 24 Letters button, it says "Password" as my password... But it should generate random letters and numbers like the other example below with 12 letters

upbeat gust
#

try save and restart

mossy jacinth
#

why shouldnt it work?

upbeat gust
#

wdym why shouldnt it work

vale wing
#

@mossy jacinth

  1. Why do you define variables with the same values twice? Just use the defined variable again lmao
  2. The password must be generated on every callback, not just once and forever in code
upbeat gust
#

this is like you saying your code is print(1+1) but that it prints "answer"

upbeat gust
vale wing
#

Yeah

upbeat gust
#

literally just

slate swan
#

or use secrets

vale wing
#

Yeah random module is actually unsuitable for cryptographic purposes, should've said it at first

upbeat gust
#

also sample only returns each a max of 1 time iirc

#

password = "".join([random.choice(all_letters) for _ in range(password_length)])```
vale wing
#

I suddenly entered EDGE zone so couldn't send it faster

robust fulcrum
#

Gyys how we make music quality good with ffmpeg and dpy?

vale wing
rugged shadow
still swan
#

why i cant see "Apps" when i click a message, may someone help me please?

slate swan
#

How to make a timeout message when a view times out?

silk fulcrum
unkempt canyonBOT
#

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

A callback that is called when a view’s timeout elapses without being explicitly stopped.
silk fulcrum
#

I have a big problem with quite big code and I have a big feeling that I won't get helped with that quite big code... Is there a big someone, who can to help me with a quite big code?

lone lichen
lone lichen
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.

silk fulcrum
#

i know

lone lichen
#

Then do it :))

silk fulcrum
#

Uhm, so this is my code: https://paste.pythondiscord.com/orejukakub (class Minesweeper is moved there from constants.py, no worries it's imported correctly). So... this is a minesweeper game and I get this (screenshot 1) when I click a button. I disabled error handler so I can see errors properly, and I don't get any errors right away but after some time this error appears (screenshot 2). I really don't get how are the button click and on_timeout connected (if I got the error meaning correct). Im just super confused what is this and why

dull terrace
#

What does it return if there are no banned users? If it's returning None then it'll tell you it has no len

silk fulcrum
#

btw await ctx.guild.bans()

limber bison
#

What's webhooks rate limits ?

paper sluice
vale wing
#

!d discord.Guild.bans

unkempt canyonBOT
#

async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/latest/api.html#discord.BanEntry "discord.BanEntry").

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

Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list.

Examples

Usage...
mossy jacinth
#

Hey! Using my main account and also being the server owner, this error does not occur but using it with my alt, not the server owner it gives me this error;

I know I could've made the code smaller with member = member or ctx.author but thats not the problem so dont even bother telling me ;d

silk fulcrum
paper sluice
vale wing
#
len(await ctx.guild.bans().flatten())``` prolly idk
slate swan
#

value = "\u200b" @mossy jacinth

dull terrace
vale wing
#

Why do people even put empty values, that's way too empty

silk fulcrum
slate swan
#

seems like a user information command to me

digital field
#

hey guys

silk fulcrum
digital field
mossy jacinth
silk fulcrum
slate swan
digital field
dull terrace
digital field
#

havent coded since 2021 🥲

#

so starting fresh

silk fulcrum
vale wing
slate swan
#

if you have basic idea about OOP you can go for hikari
its a bit advanced but provides you way much more control and features

paper sluice
digital field
#

pajn never stops

slate swan
slate swan
dull terrace
slate swan
#

lmao

digital field
silk fulcrum
#

do i print is_bomb?

vocal snow
digital field
slate swan
#

where do i start making a discord bot

digital field
#

since i used it for months 🥲 then left
but hikari is completly new to me

vocal snow