#discord-bots

1 messages ยท Page 99 of 1

slate swan
#

bruh?

#

really?

cloud dawn
#

Well if it does what I assume then yes.

cloud dawn
# slate swan bruh?

The reason of the HWID error means you got HardWare ID banned as well as IP.

#

For valid reasons since those bots are malicious but then again something tells me you already knew that.

slate swan
cloud dawn
#

Okay now it's just confusing.. pithink

#

You printed your own hwid? What are you trying to do?

slate swan
wild hearth
#

Was told to ask this here. I understand hosting a discord bot on replit is not recommended but I'm doing something simple. I just sends webhooks but with requests through proxies. Does anyone know if replit blocks request through proxies?

steep river
#

Can I prevent the bot from notifying the author when making a thread from their message?

faint sapphire
#

how dyou do that embed without the left column or left border

#

prob with ffffff ill try

fading marlin
#

only works with dark mode, but you've got 2 ways to achieve this:
0x2F3136 = uses embed background
0x36393E = uses discord background

faint sapphire
#

ight thanks

golden tapir
#

how can i check for a message with ctx

grand willow
golden tapir
#

can someone just tell me if its possible

fading marlin
unkempt canyonBOT
#
Not likely.

No documentation found for the requested symbol.

fading marlin
#

!d discord.ext.commands.Context

#

hmm

#

OH

golden tapir
#

i thought it was smt like if ctx.message.content == "blah blah blah" but that didnt work

fading marlin
#

yes, do you have message content intent enabled?

golden tapir
#

yea

hushed galleon
#

checking message content from ctx is a bit uncommon, whats your use case for it?

#

and just in case, is your message content intent enabled inside your code as well?

golden tapir
#

ok i am back

#

so i wanted to make a bot that when someone said smt it would delete it

#

i dont know if i should use client or bot

hushed galleon
#

commands.Bot is there for writing commands, so if you dont need commands you can do just fine with discord.Client

golden tapir
#

so how would i do it

hushed galleon
#

for checking any message sent you'd want to use the on_message event which gives you the Message object directly rather than a Context

golden tapir
#

how would i make the bot tho

hushed galleon
#

with discord.py? or have you not decided on a library to use with python

golden tapir
#

would this work?

hushed galleon
#

the function has to be named on_message but otherwise maybe

golden tapir
#

it works

#

thx

hushed galleon
golden tapir
#

i broke it

#

i wanted it to only be able to delete my messages so i added this and it stoped working

torn sail
golden tapir
#

still not working

hushed galleon
#

you can print out username to see the actual string its giving you in case you didnt write your username in the correct format, but comparing the user id instead would be more robust since its not affected by name changes

#

if you have Developer Mode enabled in your discord settings (Advanced tab), you can get your own user ID by right clicking the name beside your message

#

comparing to your user id would then look like this: py if message.author.id == 153551102443257856: print('my owner sent this message')

limber bison
#

discord defult emojis are not recog. by discord.Emoji ?

#

me getting error

#

discord.ext.commands.errors.EmojiNotFound: Emoji "๐Ÿ›" not found.

sage glade
#

im trying to add buttons to a message and when i import the dependencies i get this error /bin/python3 "/home/danielchudnovsky154/Shape of an L on the forehead/main.py" Traceback (most recent call last): File "/home/danielchudnovsky154/Shape of an L on the forehead/main.py", line 15, in <module> from discord_components import DiscordComponents, Button, ButtonStyle, InteractionType ModuleNotFoundError: No module named 'discord_components'

hollow agate
sage glade
#

help, Exception has occurred: ImportError cannot import name 'handle_message_parameters' from 'discord.http' (/home/danielchudnovsky154/.local/lib/python3.9/site-packages/discord/http.py) File "/home/danielchudnovsky154/Shape of an L on the forehead/main.py", line 3, in <module> import discord

torn fossil
sick birch
meager chasm
#

Now rewrite it in a competent api wrapper instead of pycord

primal token
#

I was going to review it but when i heard it was written with pycord i just didn't even want to try

torn fossil
#

In the past i used the discord.py but that library doesn`t support buttons

primal token
#

Discord.py, nextcord, disnake, hikari: am i a joke to you?

vocal snow
torn fossil
#

Take a look, i used the multiprocessing and asyncio libraries to make a very fast bot

#

Idk dude they did not supported when i needed it

#

But, why don`t use pycord

vocal snow
#

Pycord is your bottleneck here, if you want it to be faster you should use something that is faster

#

Read their codebase, you'll understand

torn fossil
#

Well, i agree that the pycord source code is a messy but i did not knew the others libraries, thanks for the info

robust fulcrum
robust fulcrum
feral lichen
#

then how r u getting an error?

robust fulcrum
#

Bro just see the errors they not realted to code but realted to discord.py

feral lichen
#

dang idk man

feral lichen
wary shadow
#

All errors are related to code in some way. Give us some details as to when this happens, what you are doing, and what code is running.

sick birch
#

Wait, maybe not. Misread

hushed galleon
wild hearth
#

response = requests.get('https://www.sslproxies.org/')
print(response)
print(response.text)```
#

Just running this crashes my replit?

hushed galleon
#

you might want to claim a help channel for that, none of these topical channels are related to running code with replit

hushed galleon
slate swan
#

Or girl, not sure. Butu either way, super cool person.

sick birch
slate swan
#

No, in general, you are super cool. At least to me

primal token
#

Robin isnt cool to melemon_pensive

slate swan
#

๐Ÿ˜ 

sick birch
primal token
#

Spooky stuff

sick birch
#

wait

#

spooky

#

thats crazy

primal token
sick birch
#

that's even more crazy

primal token
meager chasm
#

Okimi is da best โ˜บ๏ธ

primal token
#

was the best, yes

rugged shadow
#

was ๐Ÿ˜”

primal token
#

Good things always come to an end

#

ยฏ_(ใƒ„)_/ยฏ

meager chasm
#

Anakin skywakr and darh varder is like okiki and noid

rugged shadow
#

i have a theory

#

noid = okimii

meager chasm
#

โ˜บ๏ธ

primal token
#

I wouldnt compare myself with him

meager chasm
#

noid telling us he is not oikimi

hardy yoke
primal token
meager chasm
#

kk

#

Ok i do poll

slate swan
#
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.cogs.embed' raised an error: TypeError: annotation for embed_title must be given in callback 'embed.embed'
#
@app_commands.command(name="embed")
    async def embed(self, interaction: discord.Interaction, embed_title = None, embed_description = None, embed_color = None, embed_footer = None, embed_author, thumbnail_url = None, image_url = None):
        embed = discord.Embed(title=embed_title, description=embed_description, color=embed_color)
        embed.set_footer(text=embed_footer)
        embed.set_author(name=embed_author)
        embed.set_image(url=image_url)
        embed.set_thumbnail(url=thumbnail_url)
        await interaction.response.send_message(embed = embed)

code ^

torn sail
slate swan
#

wb color

#

0xffffff?

torn sail
#

Iโ€™m not sure what to do there but someone else probably does

slate swan
#

something like color="0x"+embed_color?

torn sail
slate swan
torn sail
#

!d discord.Colour.from_str

unkempt canyonBOT
#

classmethod from_str(value)```
Constructs a [`Colour`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Colour "discord.Colour") from a string.

The following formats are accepted...
torn sail
#

And typehint with str

torn sail
#

setup_hook is where u should do it

slate swan
#

!paste

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.

tough lance
#
Ignoring exception in view <Menu timeout=30 children=5> for item <Button style=<ButtonStyle.secondary: 2> url=None disabled=True label=None emoji=<PartialEmoji animated=False name='โ—€๏ธ' id=None> row=None>:
Traceback (most recent call last):
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/disnake/ui/view.py", line 370, in _scheduled_task
    await item.callback(interaction)
  File "/home/runner/Bot/views.py", line 81, in prev_page
    await inter.response.edit_message(embed=self.embeds[self.index], view=self,)
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/disnake/interactions/base.py", line 1088, in edit_message
    await adapter.create_interaction_response(
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/disnake/webhook/async_.py", line 173, in request
    async with session.request(
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/client.py", line 1141, in __aenter__
    self._resp = await self._coro
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/client.py", line 508, in _request
    req = self._request_class(
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 313, in __init__
    self.update_body_from_data(data)
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 505, in update_body_from_data
    body = body()
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/formdata.py", line 170, in __call__
    return self._gen_form_data()
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/formdata.py", line 163, in _gen_form_data
    self._writer.append_payload(part)
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/multipart.py", line 829, in append_payload
    size = payload.size
  File "/home/runner/Bot/venv/lib/python3.8/site-packages/aiohttp/payload.py", line 379, in size
    return os.fstat(self._value.fileno()).st_size - self._value.tell()
ValueError: I/O operation on closed file
#

I can't understand this error

glad cradle
slate swan
# slate swan 0xffffff?

you can also do this and take hex input as normally that's what users are used to.

color = "#FFFFF"
color = color.split("#")[1]
embed.color = int(f"0x{color}", 16)
slate swan
glad cradle
#

@tough lance what lib are you using? I've made a pull request in disnake to fix this bug

glad cradle
#

Read the error

slate swan
#

I/O operation on closed file

#

?

glad cradle
#

that's not the important part

glad cradle
#

Read the second path

tough lance
#

oh so i found a bug

glad cradle
slate swan
#

oh i see

glad cradle
slate swan
#

views are shit lol

#

low level sm better

glad cradle
#

it's not a views problem

#

it's a File problem

#

disnake.File or discord.File

tough lance
#

Yea discord.File is rather glitchy I've been working for it since yesterday and I had to find many workarounds

glad cradle
slate swan
#

yeeee i just seen it

glad cradle
slate swan
slate swan
frank pollen
#

guys isnt their any way to pass args contain spaces to a function?

#

function x(lol):
print(lol)

lol = 'hi hru'
function(lol)

i tried the * thing but it print the lol like this: "hi hru"

#

oh sht wrong channel

slate swan
glad cradle
frank pollen
#

because i want to run it in the terminal

glad cradle
#

in real life?

#

it's a discord thing

vale wing
#

A popup with input fields

vale wing
#

If you print any string it won't print quotes

#

Like text input

#

Some people say you can put buttons and select menus into them but I have never seen them in action and furthermore, I can't find any examples of it neither in docs nor on repos

#

It is a component, it is not linked to the server anyhow

grizzled sundial
vale wing
#

Bot*

#

@tribal spindle

tough lance
#

can you get the value a param of the slash command in autocomplete

limpid otter
#

is it possible to make it so that you entered a command and pinged the participant and he cannot write some command for exactly 1 hour, and then he can write it, do not tell me?

glad cradle
leaden solar
#

yo

#

do you make a multiple config system to a bot?

#

or more like how does it work?

#

do i have to somehow make a database with sqlite3 that creates a table for each server when inviting the bot?

#

and then make the bot use the seperate tables for each server?

vale wing
leaden solar
vale wing
#

Then just have server id column and id column

#

What the heck for would you need many tables for many servers

#

You only have id as primary key and other columns as settings

leaden solar
#

well idk i am not that familiar with sqlite3 so i thought it would do the job to use more tables

#

in order to store prefix data and more

#

like configs from commands

#

and such

vale wing
#

Looking at your logic you aren't familiar with relational databases at all

#

Lookup some courses about them

leaden solar
#

alr.

slate swan
#

so my button isnt working everytime i run the bot, how do i make it stay also if i run the doe afte changes

vale wing
#

Not working in what terms

slate swan
#

Wd

#

Wdym

vale wing
#

I asked almost same question

slate swan
#

Like

#

If i tap on it it sayd the the interaction was failed smt like that

vale wing
#

Do you get errors

slate swan
#

No

vale wing
#

Do you have error handler

slate swan
#

No

vale wing
#

Ok show code

slate swan
#

Okay ine moment

tired hinge
#

so basically i wanna add a banned words filter command.
but with one key difference - instead of instantly deleting the message, it checks the channel every 10 minutes for messages with the banned words and then purges them.
can i accomplish this using tasks.loop or something? im kinda lost here

vale wing
#

Yeah tasks.loop and channel.history

tired hinge
#

alr ty

vale wing
#

!d discord.TextChannel.history

unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destinationโ€™s message history.

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

Examples

Usage...
tired hinge
#

tysm

tired hinge
slate swan
#

@bot.command()
async def verify(ctx: commands.Context):
Channel = bot.get_channel(664843752342552577)
em = discord.Embed(title="palmtree Gal Cohen Verify palmtree", type='rich', description=" ืฉืœื•ื ืœื›ืœ ืžืฉืชืžืฉื™ ื”ืฉืจืช \n ื›ื“ื™ ืœื”ื™ื•ืช ืžืžื‘ืจื™ื ืจืฉืžื™ื™ื ื‘ืฉืจืช ื™ืฉ ืœืœื—ื•ืฅ ืขืœ ื”ืจื™ืืงืฉืŸ ืœืžื˜ื” - galcohen", color=0x9497d8 ,timestamp=None)
em.set_footer(text="Gal Cohen System", icon_url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
em.set_thumbnail(url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
await ctx.send(embed=em, view=VerifySystem())

class VerifySystem(discord.ui.View):
def init(self):
super().init()
self.value = None

@discord.ui.button(label="Verify", emoji="![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")", style=discord.ButtonStyle.green, custom_id="verify_system:green")
async def verify_system(self, interaction: discord.Interaction, button: discord.ui.Button):
    Role = discord.utils.get(interaction.guild.roles, name="Member")
    await interaction.response.send_message(content=f"You Have Been Successfully Verified {interaction.user.mention} ! ", ephemeral=True)
    await interaction.user.add_roles(Role)
vale wing
naive briar
vale wing
#

That would increase efficiency

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

tired hinge
vale wing
#

10 minutes isn't a long period

#

You don't need long term storage

slate swan
#

@bot.command()
async def verify(ctx: commands.Context):
    Channel = bot.get_channel(664843752342552577)
    em = discord.Embed(title="![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree") Gal Cohen Verify ![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree")", type='rich', description=" __**ืฉืœื•ื ืœื›ืœ ืžืฉืชืžืฉื™ ื”ืฉืจืช**__ \n __**ื›ื“ื™ ืœื”ื™ื•ืช ืžืžื‘ืจื™ื ืจืฉืžื™ื™ื ื‘ืฉืจืช ื™ืฉ ืœืœื—ื•ืฅ ืขืœ ื”ืจื™ืืงืฉืŸ ืœืžื˜ื” - ![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")**__", color=0x9497d8 ,timestamp=None)
    em.set_footer(text="Gal Cohen System", icon_url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    em.set_thumbnail(url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    await ctx.send(embed=em, view=VerifySystem())
    
    
class VerifySystem(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    @discord.ui.button(label="Verify", emoji="![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")", style=discord.ButtonStyle.green, custom_id="verify_system:green")
    async def verify_system(self, interaction: discord.Interaction, button: discord.ui.Button):
        Role = discord.utils.get(interaction.guild.roles, name="Member")
        await interaction.response.send_message(content=f"You Have Been Successfully Verified {interaction.user.mention} ! ", ephemeral=True)
        await interaction.user.add_roles(Role)

tired hinge
tired hinge
#

okay i see how that'd work

vale wing
#

And yeah you can use history method on startup so bot does just one big API call instead of doing it every 10 minutes

tired hinge
vale wing
#

!d discord.TextChannel.delete_messages requires list of Message objects

unkempt canyonBOT
#

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

Deletes a list of messages. This is similar to [`Message.delete()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message.delete "discord.Message.delete") except it bulk deletes multiple messages.

As a special case, if the number of messages is 0, then nothing is done. If the number of messages is 1 then single message delete is done. If itโ€™s more than two, then bulk delete is used.

You cannot bulk delete more than 100 messages or messages that are older than 14 days old.

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

tf did i mess up here

vale wing
#
await channel.delete_messages(bad_messages)```
Don't delete them one by one
tired hinge
#

..yeah this would get me rate limited

frail sedge
#

how to fix failed to import "option" from discord

frail sedge
#

i uninstalled and downloaded it multiple times already

#

it still wont work

vocal snow
#

There is no discord.option

#

What are you trying to do

frail sedge
#

it was working until i used "py pip freeze --user > requirements.txt"
inside was discord.py and requests

#

from discord import option

vocal snow
frail sedge
vocal snow
#

Are these supposed to be slash command options

frail sedge
#

yes

frail sedge
#

so import discord, requests, json from discord.ext.commands import Bot from discord.ext import commands from discord import option
is this correct or no

frail sedge
vocal snow
#

You shouldn't have both

frail sedge
#

ImportError: cannot import name 'option' from 'discord still

tired hinge
#

i forgor how to get a channel using id, can someone help

#

because in order to use delete_messages i need the channel object

faint sapphire
#

case_insensitive=True
doesnt work, i also use aliases

and different cases for the original name dont work

slate swan
tired hinge
#

tysm

#

and bot.get_guild(id) for guild?

slate swan
#

yea

tired hinge
#

ty

#

and are ids ints or strings?

slate swan
#

or you can just bot.get_channel()

#

ints

tired hinge
frail sedge
slate swan
# frail sedge

can you not just type hint a member? or do you have to do it through ID

slate swan
#

your banning members of a server right?

tired hinge
frail sedge
#

with reason it's not a server ban it's a roblox game ban where if u do a command it will request to a website endpoint

#

but my error is the options thing idk where to get tha

slate swan
#

ohhhhhh

frail sedge
#

that

tired hinge
#
guild = bot.get_guild(insert id here)
id = os.getenv('CHANNEL_ID')
id = int(id)
gc = guild.get_channel(id)
print(gc.id)
#

the print statement gives an error, cuz gc is none

slate swan
#

are you sure channel_id exist and is correct

faint sapphire
#

case_insensitive doesnt work
and have 2 options

where would I place this```py
await bot.process_commands(msg.content.lower())

or is this preferable
```py
if message.content.lower().startswith('command'):
tired hinge
#

wait lemme try directly entering the id

slate swan
frail sedge
#

slash is easy but where do u get the options form

tired hinge
#
guild = bot.get_guild(997511813157634079)
gc = guild.get_channel(1026390764516802560)
print(gc.id)
slate swan
#

whats the actual error?

tired hinge
#
  File "main.py", line 21, in <module>
    gc = guild.get_channel(1026390764516802560)
AttributeError: 'NoneType' object has no attribute 'get_channel'```
slate swan
#

oh

slate swan
#

thats because you are not actually getting a guild object

tired hinge
#

i right clicked on the server name and clicked copy id.

slate swan
tired hinge
#

okay i'll try bot.get_channel(id)

slate swan
#

Bot has a get_channel method as well

#

yes

#

yea but i don't think their bot object is setup correctly. they should still be able to get guild object.

tired hinge
#

same error again.

#
prefix = os.getenv("PREFIX")
intents = discord.Intents.all()
bot = commands.Bot(command_prefix=";",
                   help_command = None,
                   intents=intents,
                   case_insensitive=True)

bad_messages = []

# guild = bot.get_guild(997511813157634079)
# gc = guild.get_channel(1026390764516802560)

gc = bot.get_channel(1026390764516802560)

print(gc.id)
slate swan
#

is the bot present in that guild? do you have proper intente?

#

yeah no, the bot should be running
you can't use cache methods like that

tired hinge
#

can you elaborate?

half musk
#

Halo I'm From Indonesia๐Ÿค“

slate swan
faint sapphire
tired hinge
#

i'll use it inside a function, brb

gaunt ice
#

whats the issue

tired hinge
#
@tasks.loop(seconds=10)
async def delete_bad_messages():
    gc = bot.get_channel(1026390764516802560)
    await gc.delete_messages(bad_messages)
#

sorry just a sec

slate swan
#

you can add await bot.wait_until_ready() on the first line of the task for that

faint sapphire
#

im not sure ab how to use the first one, should it be in a bot.listen?
or on message

await bot.process_commands(msg.content.lower())

or is this preferable

if message.content.lower().startswith('command'):
slate swan
#

the first one will never work

#

the second one does what?

faint sapphire
#

its to c

#

make commands case insensitive

#

cause case_insensitive doesnt work

slate swan
#

use case_insensitive = True in bot

slate swan
#

how does it not work?

faint sapphire
tired hinge
#

ayy it works! tysm sarth and Jaymart!

slate swan
slate swan
#

do you have them?

faint sapphire
#

i have them, message and members

slate swan
#

you need message_content intents.

faint sapphire
#

i do

slate swan
#

mind showing ur full code

faint sapphire
#

ill try this in on message
await bot.process_commands(msg.content.lower())

faint sapphire
slate swan
#

wtf

faint sapphire
#

ik i havent used cogs yet

#

idk if classes can help use diff files

slate swan
#

send your bot vars code and 2-3 commands that don't work along with ur .run()

#

remove your token tho

faint sapphire
#

ight ill make a pastebin without whats irrelevant, thanks

slate swan
#

yep

faint sapphire
#

wait u planning on testing my script?
or just look at it

slate swan
#

look at it ofc

faint sapphire
#

ight safe

faint sapphire
#

just saw i have 2 on ready funcs

#

i know i should use setup hook instead

slate swan
faint sapphire
#

one sec, i think i see what u mean

#

ima pull up an example i saw

#
class MyCoolBot(commands.Bot):
    def __init__(self):
        intents = discord.Intents.default()
        intents.members = True
        intents.message_content = True
        
        super().__init__(
            command_prefix=["!", "?"],
            description="My Cool Bot!!!",
            intents=intents,
        ) 
#

this bot class u mean?

slate swan
#

Every time i run the bot again the button isnt working it sayd that the interaction was failed thats the code -


@bot.command()
async def verify(ctx: commands.Context):
    Channel = bot.get_channel(664843752342552577)
    em = discord.Embed(title="![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree") Gal Cohen Verify ![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree")", type='rich', description=" __**ืฉืœื•ื ืœื›ืœ ืžืฉืชืžืฉื™ ื”ืฉืจืช**__ \n __**ื›ื“ื™ ืœื”ื™ื•ืช ืžืžื‘ืจื™ื ืจืฉืžื™ื™ื ื‘ืฉืจืช ื™ืฉ ืœืœื—ื•ืฅ ืขืœ ื”ืจื™ืืงืฉืŸ ืœืžื˜ื” - ![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")**__", color=0x9497d8 ,timestamp=None)
    em.set_footer(text="Gal Cohen System", icon_url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    em.set_thumbnail(url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    await ctx.send(embed=em, view=VerifySystem())
    
    
class VerifySystem(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    @discord.ui.button(label="Verify", emoji="![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")", style=discord.ButtonStyle.green, custom_id="verify_system:green")
    async def verify_system(self, interaction: discord.Interaction, button: discord.ui.Button):
        Role = discord.utils.get(interaction.guild.roles, name="Member")
        await interaction.response.send_message(content=f"You Have Been Successfully Verified {interaction.user.mention} ! ", ephemeral=True)
        await interaction.user.add_roles(Role)

frail sedge
slate swan
frail sedge
#

how do u fix this'

faint sapphire
#

ooh thanks

slate swan
frail sedge
#

pycordidk

slate swan
#

Every time i run the bot again the button isnt working it sayd that the interaction was failed thats the code -


@bot.command()
async def verify(ctx: commands.Context):
    Channel = bot.get_channel(664843752342552577)
    em = discord.Embed(title="![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree") Gal Cohen Verify ![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree")", type='rich', description=" __**ืฉืœื•ื ืœื›ืœ ืžืฉืชืžืฉื™ ื”ืฉืจืช**__ \n __**ื›ื“ื™ ืœื”ื™ื•ืช ืžืžื‘ืจื™ื ืจืฉืžื™ื™ื ื‘ืฉืจืช ื™ืฉ ืœืœื—ื•ืฅ ืขืœ ื”ืจื™ืืงืฉืŸ ืœืžื˜ื” - ![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")**__", color=0x9497d8 ,timestamp=None)
    em.set_footer(text="Gal Cohen System", icon_url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    em.set_thumbnail(url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    await ctx.send(embed=em, view=VerifySystem())
    
    
class VerifySystem(discord.ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    @discord.ui.button(label="Verify", emoji="![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")", style=discord.ButtonStyle.green, custom_id="verify_system:green")
    async def verify_system(self, interaction: discord.Interaction, button: discord.ui.Button):
        Role = discord.utils.get(interaction.guild.roles, name="Member")
        await interaction.response.send_message(content=f"You Have Been Successfully Verified {interaction.user.mention} ! ", ephemeral=True)
        await interaction.user.add_roles(Role)

slate swan
frail sedge
#

slasgh

slate swan
#

yeaaa i know that

#

how do you have your bot object setup compared to that? @frail sedge

frail sedge
#
@bot.slash_command(name="getinfo", description="Get information of the user id.")
@commands.has_role(mod_roles)
@discord.commands.option("userid", description="userid", required=True)
async def modcommand(ctx, userid: int):
faint sapphire
slate swan
#

dpy?

#

yes

#

i think you have to set timeout to None

#

for it to be persistent

#

you already have custom id

#

yes i do

#

oh

slate swan
#

did you add the view?

#

in the setup_hook

gilded gust
#

basically youre having a problem because callbacks of discord.ui.button take in interaction in the second position

slate swan
#

let me check

#

no

slate swan
#

how do i fix it then

gilded gust
#
class myview(View):
  @discord.ui.button(...)
  async def callback(self, button, interaction):
    ...
#

self, button, interaction

slate swan
#

added timeout

#

yes and you need to add view as well

#

but timeout goes in init

#

i did

frail sedge
slate swan
#

^

#

class VerifySystem(discord.ui.View): def __init__(self): super().__init__() self.value = None self.timeout = None

#
super().__init__(timeout=None)
#

"with the timeout kwarg"^

#

oh

faint sapphire
slate swan
#

*args **kwargs

faint sapphire
#

oh it doesnt anymore (only slash commands now)

slate swan
slate swan
#

but yes, they did

slate swan
slate swan
#

@bot.command()
async def verify(ctx: commands.Context):
    Channel = bot.get_channel(664843752342552577)
    em = discord.Embed(title="![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree") Gal Cohen Verify ![palmtree](https://cdn.discordapp.com/emojis/1010539024206803027.webp?size=128 "palmtree")", type='rich', description=" __**ืฉืœื•ื ืœื›ืœ ืžืฉืชืžืฉื™ ื”ืฉืจืช**__ \n __**ื›ื“ื™ ืœื”ื™ื•ืช ืžืžื‘ืจื™ื ืจืฉืžื™ื™ื ื‘ืฉืจืช ื™ืฉ ืœืœื—ื•ืฅ ืขืœ ื”ืจื™ืืงืฉืŸ ืœืžื˜ื” - ![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")**__", color=0x9497d8 ,timestamp=None)
    em.set_footer(text="Gal Cohen System", icon_url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    em.set_thumbnail(url="https://cdn.discordapp.com/icons/393401064264564746/7d905b9f7b3645e6c4f50da49019826d.png?size=4096")
    await ctx.send(embed=em, view=VerifySystem())
    
    
class VerifySystem(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
        self.value = None
        self.timeout = None

    @discord.ui.button(label="Verify", emoji="![galcohen](https://cdn.discordapp.com/emojis/513115174044172309.webp?size=128 "galcohen")", style=discord.ButtonStyle.green, custom_id="verify_system:green")
    async def verify_system(self, interaction: discord.Interaction, button: discord.ui.Button):
        Role = discord.utils.get(interaction.guild.roles, name="Member")
        await interaction.response.send_message(content=f"You Have Been Successfully Verified {interaction.user.mention} ! ", ephemeral=True)
        await interaction.user.add_roles(Role)
gilded gust
#

sir i tested it out interaction definitely goes in third place ๐Ÿ˜ญ

slate swan
#

yeah

#

that matters? wtf

gilded gust
slate swan
#

why lmfao

#

yep those are passed as positional arguments

gilded gust
#

cuz they are positional args

slate swan
#

it used to be interaction,button earlier but it was changed for consistency

jagged brook
#

simple question= how to fix this simple problem

slate swan
#

yea but that really shouldn't matter lol. kinda weird tbh.

jagged brook
slate swan
#

you need intents

jagged brook
#

just add a space?

slate swan
#

commands.Bot(...., intents=intents)

slate swan
#

they should prob fix

faint sapphire
#

how scalable is my bot without docker (using pm2 rn)
and this

slate swan
slate swan
#

lmfao so they changed back from button, inter to inter,button

#

they needa chill

#

its stable now so yeah

frail sedge
#

so is tehre any fix for it?

slate swan
#

you just need to add the view

#

look at this example

frail sedge
slate swan
#

it won't be same for pycorf

#

wrong person

#

ooops

slate swan
# frail sedge ``` @bot.slash_command(name="getinfo", description="Get information of the user ...

this isnt your bot object your error specified that your bot object had no slash_command attr. so something is wrong there here is an example
https://github.com/Pycord-Development/pycord/blob/master/examples/app_commands/slash_basic.py

GitHub

Pycord, a maintained fork of discord.py, is a python wrapper for the Discord API - pycord/slash_basic.py at master ยท Pycord-Development/pycord

vale wing
frail sedge
#

ah aoky'

faint sapphire
#

some commands do calculations, but ima use numpy

slate swan
faint sapphire
slate swan
#

yea pm2 is fine

faint sapphire
#

what db

slate swan
#

guys i know it isnt connected to here but does anyone know why o cant change language in my keyboradd?

#

postgres

#

board

#

i was using sqlite lmaooo until like 600 servers. oddly enough i never had any blocking issues

faint sapphire
#

which vps u use / stats

slate swan
#

aws lightsail and 8gb ram, 2core.

faint sapphire
#

ight

slate swan
#

which u can prob go lower on ram but i do alot of mem caching.

faint sapphire
#

my bot is kinda niche
so i dont see them being in more than 1.3k servers (2 diff bots)
but one would be getting used all the time in around 600 servers

slate swan
#

my bot purely uses presence intent. i tried using oracle cloud because they have a always free tier 4core 24gb ram but i guess my bot like unintentially "ddosed" their servers.

#

and they banned me wouldn't give me a reason but that's the only thing i could think of.

faint sapphire
#

damn

faint sapphire
#

i tried, they had unavailability issues

#

ill try again later or make an alt

slate swan
#

the arm instance?

faint sapphire
#

yh

slate swan
#

damn

#

everyone hopping aboard probably

faint sapphire
#

digital ocean has 200 credits which last 2 months
and if u are a student (and verified that on github)
I think u get unlimited time to use those credits

#

then vultr also has 100 credits, soo theres always some way not to pay

faint sapphire
slate swan
#

nah the workload is nuts lol. cause of the amount of events im receiving

#

it watches users custom status tho

#

and gives role when they have a specific status set by the guild to watch

faint sapphire
#

interesting

slate swan
#

i ran into issues with db and had to create a cache cause of the amount of calls to db i was making lul

faint sapphire
#

cache is like files instead?

slate swan
#

nah memory.

faint sapphire
#

yh i have a lot to catch up XD

slate swan
#

there are diff types of caching tho

faint sapphire
#

yh damn that must be a lot of work
checking each online user in each guild each minutes or smmtg

vale wing
slate swan
faint sapphire
#

oh yh

#

idk if u know the game destiny 1, but my second bot is to make a global LFG for d1
cause the game so dead

slate swan
slate swan
faint sapphire
vale wing
#

Depends on how often members update the presence, basically event frequency

slate swan
#

it was a game changer fr

slate swan
vale wing
#

What does your bot do

faint sapphire
#

i quit playstation in 2019 tho, ; (
i miss it, u still have it?

slate swan
#

nah i had it on 360

slate swan
#

also sends a notification, i had to make a custom cooldown cause of the spam it was causing

vale wing
#

Ok cool

#

Idk why my bot doesn't get invited, that's literal AI antispam bot

slate swan
#

discord killed most moderation bots IMO

faint sapphire
slate swan
#

with their own automod

vale wing
vale wing
faint sapphire
#

is that an api?

vale wing
#

!pypi scikit-learn

unkempt canyonBOT
faint sapphire
#

interesting thanks

jagged brook
#
@bot.command(name='help')
async def help (ctx):
  """for problems, use me!"""
  embed=discord.Embed(title='**commands**', description='**/dice** \n `roll a dice!` \n \n **/poll** \n `make a poll to see opinions!` \n \n **/pat** \n `pat a user to show your love!` \n \n **/suggest** \n `suggest a suggestion for this server!` \n \n **/tic** \n `play a tictactoe game!`', color=0xffb588)
  embed.set_thumbnail(url=a)
  embed.set_author(name="-|Dragonbot|-", icon_url=a)
  await ctx.respond(embed=embed)```
this dont work, no errors (yes bot has perms)
vale wing
#

What is a

faint sapphire
jagged brook
vale wing
#

Also uh does Context even have respond? Isn't it reply or send

#

Do you have an error handler

slate swan
#

pretty sure there is already a default help command, no?

vale wing
#

Doesn't exist as expected

slate swan
#

ctx.channel.send ?

jagged brook
vale wing
#

Then it's a conflict with help command

jagged brook
slate swan
#

you have message_content ?

jagged brook
#

where?

#

the command is just >help (yes the prefix has no issues)

slate swan
#

you need to enable in dev portal and in your intents

jagged brook
slate swan
#

also again im almost positive there is already a built-in default help command.

#

i wouldn't suggest enabling all

slate swan
#

or can try this bot.remove_command('help')

slate swan
#

then probably your intents

jagged brook
#

after enabling, I re invite the bot?

slate swan
#

i don't think u have to, not sure

#

wouldnt hurt to tho

jagged brook
#

yeah lemme try once cuz this didnt work

jagged brook
slate swan
#

and you passed help_command = None in your bot object?

jagged brook
#

y

#

yes*

slate swan
#

weird

#

can you show full code?

jagged brook
#
import os
from pickle import NONE
from tkinter.messagebox import NO
import discord
from random import randint
from discord.ext import commands
import asyncio
import random
import dotenv
from typing import List
dotenv.load_dotenv()
intents = discord.Intents.none()

bot = commands.Bot(intents=intents, command_prefix='>', help_command=None)

token = os.environ['token']

help1 = 'help'

a = "https://images-ext-2.discordapp.net/external/MLGbMXD4W75DfT7OV3sHHHw4PiuPNRWYlT4Nv5dQSkA/https/media.discordapp.net/attachments/890979488664518687/918402050956619806/unknown.png"

b = "https://media.discordapp.net/attachments/882284727652991008/920340228898689054/heart.png?width=670&height=670"


@bot.event
async def on_ready():
  print(f'{bot.user} has connected to Discord!')
  await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Dragonman playz"))


@bot.event
async def on_application_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown): 
        msg = '**Still on cooldown**, please try again in {:.2f}s'.format(error.retry_after) 
        await ctx.respond(msg)


@bot.command(name='help')
async def help (ctx):
  embed=discord.Embed(title='**commands**', description='**/dice** \n `roll a dice!` \n \n **/poll** \n `make a poll to see opinions!` \n \n **/pat** \n `pat a user to show your love!` \n \n **/suggest** \n `suggest a suggestion for this server!` \n \n **/tic** \n `play a tictactoe game!`', color=0xffb588)
  embed.set_thumbnail(url=a)
  embed.set_author(name="-|Dragonbot|-", icon_url=a)
  await ctx.channel.send(embed=embed)
slate swan
#

thats why

jagged brook
#

hm?

slate swan
#

you have discord.Intents.none()

#

you need message_content intent as well

jagged brook
#

in the code?

slate swan
#

yes

#
intents = discord.Intents.default()
intents.message_content=True
jagged brook
#
import os
from pickle import NONE
from tkinter.messagebox import NO
import discord
from random import randint
from discord.ext import commands
import asyncio
import random
import dotenv
from typing import List
dotenv.load_dotenv()
intents = discord.Intents.default()
intents.message_content=True

bot = commands.Bot(intents=intents, command_prefix='>', help_command=None)

token = os.environ['token']

help1 = 'help'

a = "https://images-ext-2.discordapp.net/external/MLGbMXD4W75DfT7OV3sHHHw4PiuPNRWYlT4Nv5dQSkA/https/media.discordapp.net/attachments/890979488664518687/918402050956619806/unknown.png"

b = "https://media.discordapp.net/attachments/882284727652991008/920340228898689054/heart.png?width=670&height=670"


@bot.event
async def on_ready():
  print(f'{bot.user} has connected to Discord!')
  await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Dragonman playz"))


@bot.event
async def on_application_command_error(ctx, error):
    if isinstance(error, commands.CommandOnCooldown): 
        msg = '**Still on cooldown**, please try again in {:.2f}s'.format(error.retry_after) 
        await ctx.respond(msg)


@bot.command(name='help')
async def help (ctx):
  embed=discord.Embed(title='**commands**', description='**/dice** \n `roll a dice!` \n \n **/poll** \n `make a poll to see opinions!` \n \n **/pat** \n `pat a user to show your love!` \n \n **/suggest** \n `suggest a suggestion for this server!` \n \n **/tic** \n `play a tictactoe game!`', color=0xffb588)
  embed.set_thumbnail(url=a)
  embed.set_author(name="-|Dragonbot|-", icon_url=a)
  await ctx.channel.send(embed=embed)
slate swan
#

yes

jagged brook
#
  File "main.py", line 234, in <module>
    bot.run(token)```
slate swan
#

post full traceback?

jagged brook
#

ye

unkempt canyonBOT
#

Hey @jagged brook!

You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.

smoky cedar
#

hi

jagged brook
honest shoal
slate swan
#

you are cf banned

jagged brook
#

whats a cf ban...

#

and what did I do....

slate swan
#

you sent too many request

#

its just temp

honest shoal
#

hosting on replit most probably

jagged brook
#

ah thank god

slate swan
#

also yea wouldn't recommend replit

jagged brook
slate swan
#

lmfaoooo

#

yeaaa thats how they get everyone

jagged brook
#

I know its bad but I just... yk

jagged brook
pliant gulch
#

What does vsc have anything to do with repl.it

honest shoal
#

use heroku before they shut down free tier

slate swan
#

railway is the new heroku

slate swan
pliant gulch
#

It's an IDE... Nothing about VSC is hosted

slate swan
#

holy shit ur being weird. you know what he meant chill

pliant gulch
#

๐Ÿค”

slate swan
#

ur like one of them language specialist who corrects ever grammatical error someone makes

honest shoal
pliant gulch
#

lmao

honest shoal
#

and it exists

pliant gulch
#

mmmm oyes i used to host bots on notepad++

slate swan
#

cringe

pliant gulch
honest shoal
jagged brook
#

btw is it just me or many prefer the old way discord.py worked

honest shoal
#

the new tree shit is weird

jagged brook
#

fr

slate swan
#

the tree shit is monkaS

#

i left dpy when i found out disnake already had implemented slash commands

#

when they first released them

honest shoal
#

same

jagged brook
#

I switched to pycord

honest shoal
#

I find it worse than current dpy

#

they mix interaction and context

slate swan
#

yup ignorant

jagged brook
#

hmm I see

#

Opinions on nextcord?

cold sonnet
#

why does it always have to be pycord or nextcord

#

they both suck

slate swan
#

disnakeeeeeeeeeeeeeeeeeeeeeeeeee on top

honest shoal
slate swan
#

this chart doesn't tell about code quality and other features tho

#

disnake got really awesome stuff

#

also disnake released forums

#

like 2 days ago

#

to stable

#

as for pycord I can't think of anything other than voice recieve ( the .ext modules are trash)

cold sonnet
#

why did dpy even remove it

slate swan
cold sonnet
#

I see

honest shoal
slate swan
#

didnt a kid make that website

#

advaith or sumn like that

honest shoal
#

yeah

pliant gulch
#

The voice PR was never finished, and I don't even think pycord development team is competent enough to add voice receive

#

Unless they have already?

slate swan
slate swan
honest shoal
#

oh...

#

I didn't cross-check, that guy pranked

pliant gulch
#

How would you even manage to procedurally generate that kind of data

slate swan
slate swan
#

lol

#

nice they adding regex to automod for keywords

#

wtf is community onboarding

pliant gulch
#

But the problem is that people would actually need to agree on something

#

And you know how the python discord API community is like

slate swan
#

yeah exactly, even python alone has lib wars gooing on

pliant gulch
#

I will put the end to the war with Rin .

slate swan
#

put an end to the first release first

pliant gulch
#

Bro I swear I'll do it

#

Just give me like 5 more months

slate swan
#

it's already been a year isn't it

pliant gulch
#

5-6 months since I last touched Rin

#

My main qualms about developing was how time consuming making all the models were, hell it took me less time to make my own programming language compared to where Rin is now

#

But now that I really think closely, I could just do a serialise method of models

#

But I'd still need to document them all

slate swan
#

unless you've not updated it on GitHub

pliant gulch
#

Interactions, channels guilds members users embeds

#

I think...?

#

singleton cache was a mistake .

#

I repeat a huge mistake, never use singleton cache

slate swan
#

why is it bad?

pliant gulch
#

because two bots in the same project are now impossible unless you want to share state

slate swan
#

i mean, whats the point of having 2 bots in the same code

pliant gulch
#

Who knows, but it's a huge possibility

#

That needs to be accounted for when designing

#

If you have two bots since the cache is a singleton, basically global. You also have a higher chance of having a very large dictionary

#

And I don't think python is the best options out there for a large dictionary

#

Although previously my plan was to make cache drivers to have an external caching

#

E.g making Redis available, postgresql etc

#

There was less problems from that idea since objects can be serialised relatively easy since it's really just a json

slate swan
#

hikari implemented something like that

pliant gulch
#

I still don't understand why discord.py doesn't make their objects serialisable

slate swan
#

you could change the cache state to a redis cache

slate swan
#

they even removed serialisation in embeds

#

cant be stored in dictionaries anymore

pliant gulch
#

what

#

!d discord.Embed.to_dict

unkempt canyonBOT
slate swan
#

storing the object in a dictionary i mean

pliant gulch
#

LIke {"foo": discord.Embed(...)}?

slate swan
#

yep

vocal snow
pliant gulch
#

Yea I thought so as well

vocal snow
#

Just that they cannot be keys

#

No hashable any more !!

slate swan
#

i wonder why

pliant gulch
#

So no sets either

vocal snow
#

๐Ÿ˜”

pliant gulch
#

Well

#

I don't understand why you'd use an Embed as a key anyways

#

As long as it's a value that makes sense for me

slate swan
#

i had a Dict[discord.Embed, discord.File] dictionary for a paginator earlier

#

and it broke cuz of the same

pliant gulch
#

A better implementation imo would've been to bind the file to the embed

#

You can just make your own subclass of embed

slate swan
#

i changed the key-value pair order

pliant gulch
#

Kek

#

Mmm but yea, there should be no real issue when it comes to making objects serialised

#

Bc they are really just json

#

Only problem would be binding objects to another, E.g member -> guild

#

Which can still be done relatively easily

mental hollow
#

Hey, anyone know why Iโ€™m getting this error?

Traceback (most recent call last):
  File "/home/container/main.py", line 51, in <module>
    bot = Bot()
  File "/home/container/main.py", line 26, in __init__
    self.topggpy = topgg.DBLClient(self, os.getenv('TOPGG'), autopost = True, post_shard_count = True)
TypeError: __init__() takes 2 positional arguments but 3 were given
robust fulcrum
naive briar
robust fulcrum
unkempt canyonBOT
#

topgg/client.py lines 59 to 66

def __init__(
    self,
    token: str,
    *,
    default_bot_id: t.Optional[int] = None,
    session: t.Optional[aiohttp.ClientSession] = None,
    **kwargs: t.Any,
) -> None:```
mental hollow
slate swan
#

can u show the actualcode?

robust fulcrum
naive briar
mental hollow
#

yeah

slate swan
#

i have mine setup in a cog

mental hollow
naive briar
#

It's the same one I sent

slate swan
#
class Topgg(Cog):
    def __init__(self, bot):
        self.bot = bot
        bot.topggpy = topgg.DBLClient(
            bot, config.TOPGG, autopost=True, post_shard_count=True
        )

    @Cog.listener()
    async def on_ready(self):
        if not self.bot.ready:
            self.bot.cogs_ready.ready_up("Topgg")

    @Cog.listener()
    async def on_autopost_success(self):
        logging.info("Autopost successful")


def setup(bot):
    bot.add_cog(Topgg(bot))
naive briar
#

Weird pithink

mental hollow
#

very

sick birch
#

!d discord.ui.View.interaction_check

unkempt canyonBOT
#

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

A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.

This is useful to override if, for example, you want to ensure that the interaction author is a given user.

The default implementation of this returns `True`.

Note

If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
sick birch
#

Should return a bool

grand willow
#

Alr thanks

slate swan
faint sapphire
#

need help with tasks.loop
I want to begin a loop on the second iteration
Ig I prob have to use a class and do self.index, but that isnt ideal on the long term I think, cause the number would get big after a year

what is rly happening is that rn I have a loop that does a check every 8 hours if the database is up to date
and I want a second loop that does a full update each 44 hours regardless
problem is, when starting the bot, both loop start and that can cause sql lock i think
(I use only 1 db connection in the whole script)

mental hollow
mental hollow
#

thanks Iโ€™ll try that :)

slate swan
#

the library is not anylonger dependent on Discord.py

#

so it doesn't need ur bot

#

thats not stable, thats latest. so make sure u get the correct version installed

#

latest version is 1.4.0 and its the doc for that

mental hollow
#

seems like Iโ€™m not getting any errors

#

and Iโ€™m using 1.4.0

#

aaaaaaa tysm @slate swan and ty @slate swan aswell

slate swan
#

the old docs had 1.0.0 as latest

#

old docs have 1.4 as well

#

stable

slate swan
#

yes but it is still requiring an instance of client

#

which is probably why most people are having issues

#

they use the old version for stable... and have the latest branch uploaded on pypi

#

lastest is 1.4 correct?

#

cause

class Topgg(Cog):
    def __init__(self, bot):
        self.bot = bot
        bot.topggpy = topgg.DBLClient(
            bot, config.TOPGG, autopost=True, post_shard_count=True
        )

and i have no issues lmao so idfk

#

im also using disnake and not dpy

#

yeah he installed latest ver not stable is why

mental hollow
#

Iโ€™m using pycord btw

slate swan
#

which pypi has 1.4 not 2.0

mental hollow
slate swan
#

nah

mental hollow
#

oh phew kk good

slate swan
#

makes sense now tho

#

oh wait latest is 2.0.0a

#

don't know how it works for chaze but yeah

#

might be using the pre release

mental hollow
#

I downloaded it from got

#

git

#

bcz pip install topgg wasnโ€™t working

slate swan
#

no clue cause even git is 1.4 lol idk at least its working now lol

#

do pip freeze and see what ver ur topgg is

#

on GitHub its 2.0

unkempt canyonBOT
#

topgg/__init__.py line 15

__version__ = "2.0.0a1"```
slate swan
#

how did u get that release tho? i tried lmao

#

the pypi one? just see the release option

#

yea nvm i see

#

i like this ver more cuz it works for all libs, even non bot programs

#

i didn't even know it existed

robust fulcrum
slate swan
#

do u have any blocking code?

robust fulcrum
faint sapphire
#

how do I delay the beginning of a task.loop

slate swan
#

@before_loop

faint sapphire
#

idk ab using asyncio.sleep cause im delaying by 2 days

#

ok thanks

slate swan
#

dpy?

#

!d discord.ext.tasks.Loop.before_loop

unkempt canyonBOT
#

@before_loop```
A decorator that registers a coroutine to be called before the loop starts running.

This is useful if you want to wait for some bot state before the loop starts, such as [`discord.Client.wait_until_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.wait_until_ready "discord.Client.wait_until_ready").

The coroutine must take no arguments (except `self` in a class context).

Changed in version 2.0: Calling [`stop()`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop.stop "discord.ext.tasks.Loop.stop") in this coroutine will stop the initial iteration from running.
robust fulcrum
#

Whats blocking code?

slate swan
#

non async

robust fulcrum
slate swan
#

how many servers?

#

and members

robust fulcrum
#

my bot?

slate swan
#

i had an issue to where i had to shard my bot already due to high member count.

slate swan
slate swan
#

oh uhhh maybe host issue?

robust fulcrum
#

I am using termux

#

Termux runs bot on my device

sick birch
robust fulcrum
#

Termux is not a issue

sick birch
#

Discord may be blocking termux users for whatever reason

robust fulcrum
sick birch
robust fulcrum
#

Unfair for mobile coders

slate swan
#

i think alot of spammer/nukers use termux

#

could be why

sick birch
slate swan
#

if u google termux discord, it legit pops up spammer lmao

sick birch
#

Not trying to diminish you of course but thatโ€™s just the fact of the matter

robust fulcrum
slate swan
#

how is ur interaction a member lmao

robust fulcrum
#

No proof of that

slate swan
#

i dont think they would publicly announce it if they were to do so

grand willow
#

lmao

slate swan
#

are you passing a member to that?

faint sapphire
#
Mycog.start()

class MyCog():
    @tasks.loop(hours=44)
    async def dbloop():
        await dbUpdate()

    @printer.before_loop
    async def before():
        stop()
```would this work?

or i have to do```py
Mycog.start()

class MyCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @tasks.loop(hours=44)
    async def dbloop(self):
        await dbUpdate()

    @printer.before_loop
    async def before(self):
        stop()
slate swan
#

!docs

faint sapphire
#

idk fam

slate swan
#

How does the docs feature work now

slate swan
#

!source docs

unkempt canyonBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
slate swan
#

also what dani said lmao

cold sonnet
#

put self.dbloop.start() in the __init__() I suppose

faint sapphire
# slate swan what are you trying to do exactly?

rn i have a loop which checks something every 8 hours
it looks for a message on a website and compares it to the db

but sometimes there are changes and the message doesnt change
so i wanna do a full update every 2 days

but if i both say start in on_ready, theyre both using the db, may cause sql lock

slate swan
#

also it should be dbloop.before_loop

cold sonnet
#

and two days are 48 hours not 44 :kekw:

faint sapphire
#

i know, i do 44 so both loops dont conflict

slate swan
#
class MyCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @tasks.loop(hours=48)
    async def dbloop(self):
        await dbUpdate()

    @dbloop.before_loop
    async def before(self):
        bot.wait_until_ready()
faint sapphire
#

but they conflict at the start

slate swan
#

you have 2 loops checking db?

faint sapphire
#

yh

slate swan
#

also why not use connection pool

cold sonnet
#

await wait_until_ready

faint sapphire
#

but diff things, i use 1 conn for the script cause it helps avoid sql lock

slate swan
faint sapphire
#

aiosqlite rn

faint sapphire
# unkempt canyon
class MyCog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @tasks.loop(hours=48)
    async def dbloop(self):
        await dbUpdate()

    @dbloop.before_loop
    async def before(self):
        stop()
```the docs says putting stop in before will cancel the first itter, so ig that solves it
grand willow
faint sapphire
#

thanks ill test this out

slate swan
faint sapphire
#

we talking like 700 lines and 10 columns

#

and 22 webpages

slate swan
#

then just start dbloop using @after_loop

#

and remove the @before_loop

faint sapphire
#

u mean @after_loop for the 8hr loop?

slate swan
#

so ```py
@tasks.loop(hours=8)
async def firstloop(self):
....

@firstloop.after_loop()
async def dbloop():
await dbUpdate()

faint sapphire
#

i put it there?

#

then ittl start the loop every 8 hours :/

mental hollow
#

Iโ€™m receiving this error when Iโ€™m trying to use bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "pass here"):

Docs say .dbl_webhook can take 2 params but my error says I can only take 1.

slate swan
#

change ur doc from stable to latest

faint sapphire
#

i think im gonna stick with 2 cogs, even tho its not preferable

slate swan
#

what's the reasoning for waiting so long to update the db tho, doesn't seem logical

robust fulcrum
slate swan
faint sapphire
#

the websites have values, and a message for their last update
sometimes they make some changes without updating the message

so each 8hrs it compares the message with the previous one
and updates everything if needed

otherwise each 44hrs it will update everything regardless bc of those exceptions

and the hours I set is to optimise things ig, also bc the update is blocking

robust fulcrum
mental hollow
robust fulcrum
#

Ah i am tired of finding blocking code in my bot

slate swan
slate swan
mental hollow
sick birch
#

Either that or youโ€™re overloading discords servers

#

Considering the socket is almost a minute behind

robust fulcrum
sick birch
#

Doesnโ€™t have to be an API

robust fulcrum
#

My code is big and my mid would blast searching code

sick birch
#

just any external, blocking libraries

slate swan
faint sapphire
mental hollow
slate swan
robust fulcrum
#

No i not using any other
I using

asyncio
discord.py
random
dotenv
aiosqlite
inspect
io
textwrap
traceback
contextlib
json
collections
sick birch
#

those donโ€™t seem to be blocking

#

io might be

mental hollow
slate swan
mental hollow
#

in reality couldnโ€™t it be any url since authentication exists?

slate swan
#

i guess technically?

mental hollow
#

or alternatively I could use an API

mental hollow
#

๐Ÿ˜‚

#

anyway, how would I go about implementing it with new docs? havenโ€™t got the foggiest of clues

slate swan
#

i have no clue lmaooo

mental hollow
#

so then I can send messages to channels in discord ect ect.

meager chasm
#

Ok, do you know how to use top gg api

mental hollow
#

not much, Iโ€™ve looked at docs and they donโ€™t help

meager chasm
#

I think they even has api wrapper fr easy integration with discord.py

mental hollow
#

Iโ€™m using pycord

meager chasm
meager chasm
mental hollow
#

kinda late

mental hollow
meager chasm
#

Well you'll have to implement the api stuffs urself then

mental hollow
meager chasm
#

And pycord is very shitty lib anyways

mental hollow
#

how so

meager chasm
#

read their source

mental hollow
#

thatโ€™s very vague

meager chasm
#

no it's not

#

Just go through the changes they've made to the original discord.py code

#

Very easy to understand why pycord is bad

#

But ofc if you want to use it go ahead, but u might face issues using it with topggpy

robust fulcrum
#
Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/discord/client.py", line 627, in connect
    await self.ws.poll_event()
  File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/discord/gateway.py", line 646, in poll_event
    raise ConnectionClosed(self.socket, shard_id=self.shard_id, code=code) from None
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 1000

Guys why i getting this error?

wicked atlas
#

When does this error occur?

robust fulcrum
#

After every 1-2 minutes

wicked atlas
#

Does the script exit after you get it?

#

Fatal error?

meager chasm
#

Have u set up logging

robust fulcrum
meager chasm
#

do u know about logging lib

robust fulcrum
mental hollow
#

Iโ€™m torn between the two tho

meager chasm
#

Use whichever u like

robust fulcrum
meager chasm
#

Whichever u want

robust fulcrum
#

Idk

meager chasm
#

important thing is to set logging level to DEBUG and send the log here so we can diagnose

meager chasm
#

U can copy the config from second example

robust fulcrum
#

But then it not shows the logs

#

I mean print the logs

meager chasm
#

No second example put log in file

#

Not to stdout

robust fulcrum
#
import discord
import logging
import logging.handlers

logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
logging.getLogger('discord.http').setLevel(logging.INFO)

handler = logging.handlers.RotatingFileHandler(
    filename='discord.log',
    encoding='utf-8',
    maxBytes=32 * 1024 * 1024,  # 32 MiB
    backupCount=5,  # Rotate through 5 files
)
dt_fmt = '%Y-%m-%d %H:%M:%S'
formatter = logging.Formatter('[{asctime}] [{levelname:<8}] {name}: {message}', dt_fmt, style='{')
handler.setFormatter(formatter)
logger.addHandler(handler)

# Assume client refers to a discord.Client subclass...
# Suppress the default configuration since we have our own
client.run(token, log_handler=None)

This?
@meager chasm

meager chasm
#

ya

robust fulcrum
#

Ok

robust fulcrum
#

@meager chasm what will that file do?

slate swan
#

hello

#

i tried to install this plugin , i have very low understanding on python
so anyways i tried to install the requirements and everything installed unless the discord module so i need help with it

cold needle
#

hi

#

someone know how to fix discord 50001 forbidden

quaint epoch
unkempt canyonBOT
#

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

quaint epoch
#

Usually you're missing credentials

#

Otherwise, you just can't interact with that resour e

cold needle
vale wing
pliant lily
#

Hello!
I'm trying to make a modal (I will use buttons but wanted to check how it looks first).

class Questionnaire(discord.ui.Modal, title="Crรฉez votre ticket !"):
    select = Select(
        placeholder="Sรฉlectionnez le type de votre ticket !",
        options=[
            discord.SelectOption(
                label="Modรฉration",
                emoji="โ›”",
                description="Tout ticket relatif ร  la modรฉration."
            ),
            discord.SelectOption(
                label="Suggestions",
                emoji="๐Ÿ“",
                description="Pour toutes suggestions."
            ),
            discord.SelectOption(
                label="Bot",
                emoji="๐Ÿค–",
                description="Tout tickets relatifs au bot."
            )
        ]
    )
    explication = ui.TextInput(label="Votre explication", required=True, style=discord.TextStyle.paragraph)

    async def on_submit(self, interaction: discord.Interaction):
        await interaction.response.send_message(f"Merci ! Votre ticket viens d'รชtre envoyรฉ aux modรฉrateurs!")

    async def on_error(self, interaction: discord.Interaction, error: Exception) -> None:
        await interaction.response.send_message("Quelque chose s'est produit... Impossible d'envoyer le ticket")

        traceback.print_tb(error.__traceback__)

@bot.hybrid_command(name="create_ticket")
async def create_ticket(ctx):
    await ctx.send(Questionnaire())

I have done this and get this error when I try to send it to a channel: <Questionnaire timeout=None children=2>
Is it because I'm trying to send a modal without the use of a button?

pliant lily
#

This is what the / command return

#

I forgot to put the command in my code sorry

naive briar
#

I see no error message

#

Also, why is there a dropdown in there?

pliant lily
#

I might have messed up the tutorial I was watching lol
The guy used the Select to make the dropdown but didn't use a class

#

He used a view instead

#

Isn't the Select a dropdown?

sick birch
#

Only TextInput

pliant lily
#

I see, thank you very much :)
I'll put a dropdown using a view before the modal then

glad cradle
#

@tough lance soon the disnake bug will be resolved, waiting for approval for my pull request to be merged, when it'll be merged you should use the dev version of disnake (2.7) you install it using

pip install git+https://github.com/DisnakeDev/disnake
dull terrace
#

could do with checkboxes and other stuff froggy_chill

slate swan
#

nope they just removed buttons and select support tho

dull terrace
slate swan
#

on API level

dull terrace
#

where can i find news on stuff like that

#

official discord-developers server has no mention of that in their api news

glad cradle
shut tendon
#

Hi guys, I know you can use a decorator to handle errors with commands, but what if I want to handle more than one error. What should I do?

hushed galleon
#

for example: py @bot.event async def on_command_error(ctx, error): if isinstance(error, commands.MissingRequiredArgument): # one message here elif isinstance(error, commands.NotOwner): # another message here else: # show traceback in the console raise error

shut tendon
#

I see, thank you!!

dull terrace
#

is there a way to defer a response but only if it takes too long

#

or am i gonna have to create a task and run it with a flag to tell if the message has sent yet

wicked atlas
#

It's usually best to just defer and then edit the response, no matter what. Then you don't need to worry about any of that

dull terrace
#

i don't want a "bot is thinking" thing every time