#discord-bots

1 messages ยท Page 1034 of 1

placid skiff
#

do you have a on_error event?

stable leaf
#

yes

placid skiff
#

can you show it?

stable leaf
#

k

#

wait it will take long time i have over 1k lines

placid skiff
#

well then just tell me if you have this line in the on_error function

vague arrow
#

I'm not sure i follow. Here is the code block that is giving me an error whenever i try to add the role after bot.get_user. Is there a simple fix that i can make?

stable leaf
#

oh fuck

placid skiff
# stable leaf
        else:
            print(f"ignoring exception in command", file=sys.stderr)
            traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
``` Do you have this in your error handler?
stable leaf
#

this

placid skiff
#

you will need to import sys and traceback

stable leaf
#

kk

#

and now?

slate swan
#

@slate swan ๐Ÿ˜” How do i fix this?

placid skiff
stable leaf
#

nothing

placid skiff
#

wtf?

stable leaf
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'url'

placid skiff
#

Oh finally

#

you have to use server.icon.url or ctx.guild.icon.url

stable leaf
#

i have ctx.guild.icon.url

#

still the same error

loud junco
#

hi

stone beacon
#

๐Ÿ—ฟ

slate swan
#

๐Ÿ—ฟ

placid skiff
#

try to remove .url

loud junco
#

as long as the bot has moderator

slate swan
loud junco
#

LOL

#

not dumb

slate swan
#

thanks a lot

loud junco
#

just ashley.exe not responding

slate swan
#

uhhh

stable leaf
loud junco
#

my brain is also not responding now

#

my brain is kinda blank rn

#

lmao

slate swan
loud junco
#

blvcktvrsier joined my server out of nowhere

stable leaf
#

i have different error

loud junco
loud junco
stable leaf
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.thumbnail.url: Scheme "b19286bd77e7fa537d08a5bce4707181" is not supported. Scheme must be one of ('http', 'https').

placid skiff
loud junco
#

LMAO

#

curiosity kills the cat

slate swan
loud junco
slate swan
loud junco
#

my bot got into 75 server but i cant even verify it

stable leaf
#

does someone have any idea how can i fix my command pls?

loud junco
#

my birthday is on december

#

i need to wait for 7 months sharp
9/12 lol

#

looks like no one knows how reaction role works ๐Ÿคฃ

placid skiff
#

i do D_D

stable leaf
#

error

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In embeds.0.thumbnail.url: Scheme "b19286bd77e7fa537d08a5bce4707181" is not supported. Scheme must be one of ('http', 'https').

loud junco
#

๐Ÿคฃ

placid skiff
loud junco
#

im trying to get 2k pepo in there

placid skiff
placid skiff
#

just print them D_D

loud junco
#

lol i ask this also

placid skiff
#

in the console

stable leaf
#

kk

loud junco
#

lemme reply that msg real quick

#

here u go

#

sparky told me this
i havent try yet

#

u can become my little experiment rat

placid skiff
slate swan
#

theyre not equivalent, but yes

placid skiff
#

we're professionals here buddy, we don't take two lines of code for an iterations

loud junco
#

LMAO

stone beacon
#

!d discord.Guild

unkempt canyonBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a โ€œserverโ€ in the official Discord UI...
loud junco
placid skiff
loud junco
#

change server to guild i guess

slate swan
#

how can i make a timer in timestamp like:
user uses ,timer 30m so the bot would send a timestamp of 30 minutes
if the user uses ,timer 56m then bot would send timestamp for 56 minutes from now

loud junco
stable leaf
#

even if i changed the bot bcs i use client

loud junco
stable leaf
#

i did

slate swan
stable leaf
#

i need help

placid skiff
stable leaf
#

where

placid skiff
#

now it is typed correctly, check

stable leaf
#

k

#

no syntax error

#

and what now?

placid skiff
#

?

stable leaf
#

i have the print cmd there

placid skiff
#

what did they print?

stable leaf
#

and what do i need to do with it

stable leaf
placid skiff
#

we are debugging your variables, so we can see what they are

stable leaf
#

just names of servers the bot is in and owners of the servers

placid skiff
#

bruh you had to print ctx.guild.icon and ctx.guild.icon.url lol

#

that was for another thing

slate swan
#

After looking at the code, you are missing

bot.reaction_roles = Document(bot.db, "reaction_roles")

At the bottom of your bot.py file, right after bot.command_usage = .... If you need further help @jade tartan, don't hesitate to ping me.

placid skiff
#

what is the error?

slate swan
stable leaf
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: set_thumbnail() takes 1 positional argument but 2 were given

placid skiff
#

yeah ok i want to see the print, do you add the print statement before the set_thumbnail method?

loud junco
#

ashley gave up playing that bot in 10 seconds

#

๐Ÿคฃ

slate swan
slate swan
placid skiff
#

do it D_D

stable leaf
#

i have no print there

#

what print

#

i am confused

loud junco
stable leaf
#

yes

slate swan
placid skiff
#

bruh before the set_thumbnail method write print(ctx.guild.icon, ctx.guild.icon.url)

stable leaf
#

print is in console ctx.send is chat in ds

placid skiff
#

but can't remember how i fixed it lol

slate swan
loud junco
#

WHAHWAHAWHAW

#

headache => drink more water and go to sleep => no headache

slate swan
placid skiff
stable leaf
#

it didnt print anything

slate swan
loud junco
stable leaf
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'url'

loud junco
#

check ur console not the discord channel

stable leaf
#

i did

placid skiff
#

Sad
then your headache will only increase lmao

loud junco
#

ei it should be string

placid skiff
#

i'm also confused xD

loud junco
#

wait

loud junco
#

is it string where is the docs

stable leaf
#

it is weird

placid skiff
loud junco
#

gg

placid skiff
#

well, it should lol

stable leaf
slate swan
#

@slate swan also also, how do i add choices? ๐Ÿ˜”

placid skiff
stable leaf
#

i made little changes and it printed weird stuff

placid skiff
#

well too late i have a work to do now LMAO

stable leaf
#

aand no error

#

b19286bd77e7fa537d08a5bce4707181

slate swan
loud junco
#

and i have no idea what is a workaround

slate swan
slate swan
slate swan
loud junco
slate swan
stable leaf
#

?

placid skiff
loud junco
#

are u asian? @slate swan

#

but ur online time doesnt look like u are one

slate swan
loud junco
#

LOL

#

no wonder u are a dictionary

slate swan
#

well.....

placid skiff
#

You will just need more check before do what you want

loud junco
loud junco
#

byebye gtg

placid skiff
placid skiff
rapid knoll
#

what is a typing_extensions error?

visual island
exotic maple
#

oh okk i get the concept now thanks

slate swan
#
        ratestaffmsg = await channel3.send(embed=embed)
        await ratestaffmsg.add_reaction('\U00002705')
        def check(reaction, user):
            return not user.bot and str(reaction.emoji) == '\U00002705' and reaction.message == ratestaffmsg
        try:
            reaction = await self.bot.wait_for('reaction_add', timeout=180.0, check=check)
            await channel3.send("approved")
            await ratestaffmsg.clear_reactions()
        except asyncio.TimeoutError:
            await message.clear_reactions()
            await ctx.send(f'no reaction in 180s (DEBUG).')
            return

        await ratestaffmsg.add_reaction('\U0000274C')
        def check(reaction, user):
            return not user.bot and str(reaction.emoji) == '\U0000274C' and reaction.message == ratestaffmsg
        try:
            reaction = await self.bot.wait_for('reaction_add', timeout=180.0, check=check)
            await channel3.send("denied")
            await ratestaffmsg.clear_reactions()
        except asyncio.TimeoutError:
            await message.clear_reactions()
            await ctx.send(f'no reaction in 180s (DEBUG).')
            return

how can i make these appear at the same time vs one after the other?

flint isle
#

whats the ... for

slate swan
#

!pip aiofiles

unkempt canyonBOT
flint isle
placid skiff
placid skiff
slate swan
placid skiff
#

my offer is still valid he_qlash

flint isle
slate swan
boreal ravine
#

Stop providing false information, it is usable

flint isle
#

umm idk what id pass for that. i just need to save the file and then attach it to a message

placid skiff
#

replit is the worst hosting service in the human history

maiden fable
#

I beg to differ I agree

placid skiff
#

Hahahahaha

maiden fable
#

Just use asyncio.sleep

placid skiff
slate swan
flint isle
placid skiff
# slate swan Yes

first you will have to convert the time that user sent in a timedelta object

#

!d datetime.timedelta

unkempt canyonBOT
#

class datetime.timedelta(days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0)```
All arguments are optional and default to `0`. Arguments may be integers or floats, and may be positive or negative.

Only *days*, *seconds* and *microseconds* are stored internally. Arguments are converted to those units...
dull terrace
#

Anyone got creative promotion ideas for a discord bot? 7739monkathink

placid skiff
#

then you just take the current time using datetime.datetime.now() or datetime.datetime.utcnow() and sum the two dates

#

then you can convert in any format you like using strftime()

slate swan
#

        ratestaffmsg = await channel3.send(embed=embed)
        await ratestaffmsg.add_reaction('\U00002705')
        await ratestaffmsg.add_reaction('\U0000274C')
        def check(reaction, user):
            return not user.bot and str(reaction.emoji) in ['\U00002705','\U0000274C'] and reaction.message == ratestaffmsg
        try:
            reaction = await self.bot.wait_for('reaction_add', timeout=180.0, check=check)
            if str(reaction.emoji) == '\U00002705':
                await channel3.send("APPROVED")
            elif str(reaction.emoji) == '\U0000274C':
                await channel3.send("DENIED")
            else:
                await channel3.send("wtf")

any reason why this wouldn't work?

placid skiff
#

What is the problem? D_D

slate swan
#

it applies the emojis and then nothing happens when i click either

quaint epoch
#

hey who was that guy that found a way to determine if someone is lurking or not?

#

dm me the command

#

plz i need it desperately

slate swan
#
  File "C:\Users\allan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\allan\OneDrive\Documents\mootbot\cogs\Commands.py", line 1159, in rate
    if str(reaction.emoji) == '\U00002705':
AttributeError: 'tuple' object has no attribute 'emoji'

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

Traceback (most recent call last):
  File "C:\Users\allan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\allan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\allan\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'tuple' object has no attribute 'emoji'
slate swan
#

whoops thought i had sent the error, mb

placid skiff
#

seems like that your wait_for is returning a tuple, dunno why tbh

placid skiff
slate swan
#

so any idea on how i can fix / alternatives? :/

slate swan
#

reaction, user = await bot.wait_for("reaction_add")

#

it worked fine when i only had 1 emoji

#

it was since i added py in ['\U00002705', '\U0000274C']
and

            if str(reaction.emoji) == '\U00002705':
                print(reaction.emoji)
                await channel3.send("APPROVED")
            elif str(reaction.emoji) == '\U0000274C':
                print(reaction.emoji)
                await channel3.send("DENIED")
            else:
                await channel3.send("wtf")```
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.

placid skiff
#
import datetime
time_formats = {"s": "seconds", "m": "minutes", "h": "hours", "d": "days", "w": "weeks", "y": "years"}
time = "30m"
if time[-1] in time_formats.keys():
  delta = datetime.timedelta(time_formats[time[-1]] = time[:-1])
print(delta)

dunno if this works but you can get the idea

quaint epoch
#

try Greedy[disnake.Member]

slate swan
#

i got an arg in my command and i wanna do like if user only sends the command the bot should respond with something like "do this or put thi"

exotic maple
#

i forgot which one but ik its 1

#

or you can make a command error

slate swan
#

what does 'ERROR:discord_webhook.webhook:[1/1] Webhook status code 400: {"embeds": ["0"]}' mean?

#

im using discord_webhook lib

quaint epoch
#

if i have a dir tree like ```
discord-bot(dir)
|
|
|-----cogs(dir)
| |
| |-----mute.py(has mute cog subclass, all functions related to muting)
| |-----ban.py(has bancog subclass, all functions related to banning)
| |-----bookmark.py(has bookmark cog subclass, all functions related to bookmarking)
|
|-----main.py(should get all cog classes from .py files in cogs dir)

#

how would i get the cogs from the .py files in the cogs dir

#

that was a pretty nice dir tree if i do say so my self

white plume
boreal ravine
quaint epoch
quaint epoch
slate swan
quaint epoch
#

lol

white plume
white plume
quaint epoch
white plume
#

I think perhaps not.

#

Where can I install it

#

This one?

#

Sorry I'm completely new to python

quaint epoch
#

it should come with every build

white plume
#

ok I'll try it thanks

slate swan
white plume
#

Totally agree

#

loool

maiden fable
#

@white plume what's yr Python version?

white plume
#

3.8.10

maiden fable
#

Can you paste the whole error?

supple thorn
#

Hi hunhun

maiden fable
#

Hi

unkempt canyonBOT
#

Hey @white plume!

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

quaint epoch
maiden fable
#

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

white plume
jovial plover
#

How to use User timeout discord feature in discord bot?
I want to track the time

slate swan
#

anybody know why my webhook is not sending?

jovial plover
#

unknown

slate swan
#

im getting '[1/1] Webhook status code 400: {"embeds": ["0"]}'

#

and its not sending the webhook

#

im using discord_webhook

slate swan
slate swan
#

!pip discord_webhook

unkempt canyonBOT
slate swan
#

from discord_webhook import DiscordWebhook, DiscordEmbed

webhook = DiscordWebhook(url="my hook")
embed = DiscordEmbed(title="Error", description="aborted", color='ff8a00')
webhook.add_embed(embed)
webhook.execute()

slate swan
#

the webhook is correct too

#

ohh wait

#

Bro wtf

#

Ur code

#

Is

#

?

vapid grove
#

you set up embed incorrectly

slate swan
#

Yes it is correct

slate swan
#

Very

slate swan
#

what's wrong with it?

#

its import discord
then discord.Embed()

#

what?

#

It does, but not in your example

#

Seems correct to me I guess, tried without embed?

flint isle
#

Code

    
@bot.command(name="lnk")
async def lnk(ctx, link):
    print(Fore.YELLOW + ctx.message.content + Fore.WHITE)
#assuming this is inside a command
# I recommend creating a single ClientSession and storing it in a botvar
    async with aiohttp.ClientSession() as session:
        image = await session.get(link)
    async with aiofiles.open('image.png', 'wb') as f:
        await f.write(image.content)

How do I attach the retrieved file to a message?

slate swan
#

Color is most likely 0xff8a00 no?

slate swan
#

you can change it

slate swan
#

Oh yeah docs says it works like that - horrible way of doing it

slate swan
#

i don't know why it doesn't now

#

all you want to do is send a webhook message right? nothing to do with a bot?

#

Yep

#

nothing to do with a bot

#

just use this

#

what is this

#

this sends 1 message and i have to do it manually

#

how can i do the way they've done that syntax box in an embed?

slate swan
#

ohh, u mean the color?

#

the box yea

#

code blocks

#

how do you do the small one like they've done around p.help <command>

#

and idk what the formatting thingy is

slate swan
#

just 1 ` on each side

#

ok thanks

slate swan
#

!d discord.Webhook.from_url

unkempt canyonBOT
#

classmethod from_url(url, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") from a webhook URL.

Changed in version 2.0: This function will now raise [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.10)") instead of
`InvalidArgument`.
slate swan
#

!d discord.Webhook.send

unkempt canyonBOT
#
await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`...
slate swan
#

doesn't really asks you to create a bot, needs a basic async fucntion tho

vapid grove
#

how to add required options and options description to slash commands in nextcord

spring flax
#

Use docstrings for descriptions and for required options do not set a default value

quaint epoch
stone beacon
#

When you realize all these api wrappers break all this down to a json string

slate swan
#

hellish

#

json string? what part do you mean

slate swan
#

hm they are json payloads.. not a string though isn't it

#

yeah

stone beacon
#

Although

slate swan
#

i forgor how to install discord.py 2.0, someone tell me lol

jovial plover
#

from discord import Client, Intents, Embed
from discord_slash import SlashCommand, SlashContext

bot = Client(intents=Intents.default())
slash = SlashCommand(bot)

@slash.slash(name="test")
async def test(ctx: SlashContext):
    embed = Embed(title="Embed Test")
    await ctx.send(embed=embed)

bot.run("token")

When i run this, and type/test in discord, I don't see it. Why?

stone beacon
#

The reason I said that was because I rmr when dealing with apis the json obj gets stringify-ied

slate swan
jovial plover
#

What should i do

stone beacon
stone beacon
#

As long as u have git installed u can get the latest from there

vapid grove
quaint epoch
#

you're doing it perfectly

#

it's a mandated arg, name

stiff gorge
#

how to use hybrid cmnd ?

vapid grove
quaint epoch
#

do description="description" in the decorator

slate swan
slate swan
vapid grove
flint isle
# slate swan ```py await ctx.send("image underneath", file=discord.File("image.png"))```
Starting Bot
Connecting to Discord API.
Please Wait
Loading Developer Features cog
[โœ“][Developer Features Cog] Loading Complete
Connected!
Bot is ready!
Waiting For Commands
$lnk https://cdn.discordapp.com/attachments/798726720181633047/968876223637893210/unknown.png
Ignoring exception in command lnk:
Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 169, in wrapped
    ret = await coro(*args, **kwargs)
  File "<string>", line 114, in lnk
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/aiofiles/threadpool/utils.py", line 45, in method
    return (yield from self._loop.run_in_executor(self._executor, cb))
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
TypeError: a bytes-like object is required, not 'StreamReader'

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

Traceback (most recent call last):
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/bot_base.py", line 570, in invoke
    await ctx.command.invoke(ctx)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 920, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 178, in wrapped
    raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: a bytes-like object is required, not 'StreamReader'
stiff gorge
slate swan
vapid grove
slate swan
#

An example would be

@commands.slash_command( 
ย ย ย ย ย name="kick", 
ย ย ย ย ย description="Kickย aย userย outย ofย theย server.", 
ย ย ย ย ย options=[ 
ย ย ย ย ย ย ย ย ย Option( 
ย ย ย ย ย ย ย ย ย ย ย ย ย name="user", 
ย ย ย ย ย ย ย ย ย ย ย ย ย description="Theย userย youย wantย toย kick.", 
ย ย ย ย ย ย ย ย ย ย ย ย ย type=OptionType.user, 
ย ย ย ย ย ย ย ย ย ย ย ย ย required=True 
ย ย ย ย ย ย ย ย ย ), 
ย ย ย ย ] 
)
quaint epoch
slate swan
#

they are using nextcord, from what they said

#

In that case use a default value to your option to SlashOption(description="Description here")

#

Need to import using from nextcord import SlashOption though

#

So like

async def command(interaction: Interaction, arg: str = SlashOption(description="Description here")):
slate swan
#
    @commands.command(name="rate")
    async def rate(self,ctx,member: discord.Member=None, rating=None, *, reason=None):
        await ctx.message.delete()
        membermention = member.mention
        pfp = member.avatar_url
        guildicon = ctx.guild.icon_url
        if member == None:
            await ctx.send("Please mention the member you wish to rate!", delete_after=5)
            return

anyone know why this just doesn't send anything if i solely do -rate? it should send the message, no?

stable leaf
#

there is problem with line ctx.guild.icon_url i have the same problem in my code

#

delete that line and it should work

slate swan
slate swan
#

nothing happens, nothing in cmd and nothing in discord

exotic maple
#

Does anyone know how i can make a /setupchannel [DISCORDCHANNEL] and store the guild ID : setupchannel for that guild to an SQLite database

#

no video tutorials seem to show me

sacred oyster
uncut comet
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice i have discord py voice installed and pynacl installed

fluid zodiac
#

hey guys i'm trying to add interaction in the next code but founding myself stuck,

@Mybot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingAnyRole):
        await ctx.message.delete()
        await interaction.response.send_message("Sorry but you dont have the permissions required for this command.", ephemeral=True)
        return

need to make line 5 working with interaction.response.send_message

vale wing
#

Nice 4 problems to solve

vale wing
exotic maple
vale wing
#

You mean sql statement or smth

uncut comet
# vale wing How did you install pynacl

i did it once manually and it didn't work so i uninstalled discord py and pynacl and reinstalled to let it be installed automatically and still doesn't work

exotic maple
#

How do i set it up? And to prevent SQL injections

#

@vale wing

slate swan
#

!sql-fstrings

unkempt canyonBOT
#

SQL & f-strings
Don't use f-strings (f"") or other forms of "string interpolation" (%, +, .format) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it presents a major security risk via SQL injection.

Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, safely.

For example, the sqlite3 package supports using ? as a placeholder:

query = "SELECT * FROM stocks WHERE symbol = ?;"
params = ("RHAT",)
db.execute(query, params)

Note: Different database libraries support different placeholder styles, e.g. %s and $1. Consult your library's documentation for details.

See Also
โ€ข Extended Example with SQLite (search for "Instead, use the DB-API's parameter substitution")
โ€ข PEP-249 - A specification of how database libraries in Python should work

slate swan
#

this is for sql injections

vale wing
#

Pretty sure they have docs on their repo on github and yeah it works just like common sqlite but with coros

#

And yeah wdym "prevent sql injections"

#

Why'd you want to prevent them

fluid zodiac
exotic maple
#

lol

vale wing
#

Man wtf

#

You do that, nobody else

vale wing
exotic maple
#

as im taking user input

vale wing
#

Anyways idk about that I don't use dpy 2.0

sacred oyster
vale wing
#

CommandOnCoolDown

#

Big D, it needs to be low

sacred oyster
#

"CommandOnColdown"?

vale wing
#

Ctrl+c

fluid zodiac
sacred oyster
#

it's only tht?

vale wing
#

Yes if you read the error

fluid zodiac
#

oh

vale wing
#

Search event reference

fluid zodiac
#

ok thanks

vale wing
sacred oyster
#

i want to do a chat filter i have a variable with a list and i want to read all the messages and if is in the list delete the message, but i don't know how to read all the messages

exotic maple
#

do

if any(x for x in [LIBRARY] if x in [MESSAGE]:

zealous jay
#

Can someone help me loading cogs with d.py 2.0?

exotic maple
exotic maple
vale wing
zealous jay
#

I have this

#

AttributeError: 'client' object has no attribute 'load_extension'

#

that's where the error is

slate swan
#

you need to subclass the Bot class

zealous jay
#

Im sorry but, how do I do that?

slate swan
#

use discord.ext.commands.Bot instead of discord.Client

zealous jay
#

oh okay

stone beacon
#

Noice

zealous jay
#

class client(discord.ext.commands.Bot):
    def __init__(self):
        super().__init__(
            command_prefix = '$',
            intents = discord.Intents.default(),
            application_id = 770696433573036054),
        self.synced = False
    
    async def setup_hook(self):
        await self.load_extension(f"cogs.estado")
        await client.app.sync(guild = discord.Object(id=770698123915165747) )

    async def on_ready(self):
        await self.wait_until_ready()
        print("El bot estรก ONLINE.")
        if not self.synced:
            await client.app.sync(guild = discord.Object(id=770698123915165747))
            self.synced = True

aclient = client()

aclient.run(os.getenv("TOKEN"))```
slate swan
#

should comamnds.Bot subclass ( in case its raising an error)

zealous jay
#

๐Ÿ‘

slate swan
#

Why does it say the extension is already loaded? It should unload it

#

oh

#

thats not how arguments in python work

#

i think i know why

sacred oyster
#

i want to use it

#

@slate swan

slate swan
#

thats a cog...

slate swan
crimson compass
#

why is it total black?

slate swan
#

wdym

quaint epoch
#

discord bot testing be like

fluid zodiac
#
@Mybot.event
async def on_command_error(ctx, error):
    if isinstance(error, commands.MissingAnyRole):
        await ctx.message.delete()
        await interaction.response.send_message("Sorry but you dont have the permissions required for this command.", ephemeral=True)
        return

how can i make my interaction work here?

quaint epoch
paper sluice
fluid zodiac
quaint epoch
fluid zodiac
#

1sec

fluid zodiac
# quaint epoch errors?
Ignoring exception in on_command_error
Traceback (most recent call last):
  File "E:\Softwares\PyCharm\PyCharm 2021.3.3\pythonProject\venv\lib\site-packages\nextcord\client.py", line 417, in _run_event
    await coro(*args, **kwargs)
  File "E:\Softwares\PyCharm\PyCharm 2021.3.3\pythonProject\DiscordBot\main.py", line 13, in on_command_error
    await ctx.response.send_message(f"Sorry but you dont have the ability to perform actions here", ephemeral=True)
AttributeError: 'CachedSlotProperty' object has no attribute 'send_message'
quaint epoch
#

i don't know what that object is, can't help

slate swan
#

how can i let my bot say something if he didnt find any warns about the user?

fluid zodiac
# quaint epoch uhhh, nextcord

all im trying is when error will apear will send back to the user on hidden message in the same channel that he cant use this action

quaint epoch
hybrid fjord
#

ever since i switched to pycord, all my dropdowns stopped working. any ideas why?

#

different syntax to d.py 1?

quaint epoch
hybrid fjord
#

but there's no error in the console

quaint epoch
hybrid fjord
quaint epoch
#

idk pycord but this isn't how most ppl do it

hybrid fjord
#

it was working fine before i switched

quaint epoch
#

bruh

cloud dawn
#

hmm

quaint epoch
#

nope i can't help

#

pycord docs are way to damned

slate swan
#

dhooks is saying my discord webhook is invalid when it is

cloud dawn
#

pycord uses the discord namespace.

slate swan
#

anybody know why??

hybrid fjord
cloud dawn
hybrid fjord
cloud dawn
#

No.

#

It uses the discord namespace.

hybrid fjord
#

oh right

quaint epoch
#

switching from one lib to another, and your code working, is even scarier than it not

cloud dawn
#

Why would you even switch from dpy to pycord.

hybrid fjord
#

not really, pycord is just discord.py but maintained

quaint epoch
#

gotta test each and every single command to make sure they work

cloud dawn
hybrid fjord
#

not entirely sure, i think i did it for a specific feature

#

well 2.0 is

#

but when i tried switching my whole entire code broke

quaint epoch
#

dpy prolly has it

cloud dawn
quaint epoch
#

switch back

hybrid fjord
#

I'm not experiencing any issues.

#

I also don't understand why that concerns you. I was aware of that when I made my choice.

slate swan
hybrid fjord
#

Thank you.

sick birch
#

I think itโ€™s more important we help someone with an issue they have instead of pestering them about their choice of library

cloud dawn
#

I think it's more important of making people aware that certain forks/ extensions are poorly made. Switching to a library out of ease isn't something I support.

crimson compass
#

WHY IS EVERYTHINMG SO FU*** TOTAL BLACK

slate swan
quick gust
#

tf

slate swan
#

That's unfortunate

#

Not related to discord bots though

crimson compass
#

I CANT SEE THE CHANNEL IM WRITING IN FELLA

slate swan
#

crazy how you can typelemon_glass

crimson compass
#

THE LEFT OF MY SCREEN IS BLACK

slate swan
#

without grammar mistakes

#

How about stopping the trolling, thanks.

crimson compass
#

I CAN SEE MY KEABOARD DUMBO

slate swan
#

May you stop?

cloud dawn
#

<@&831776746206265384>

crimson compass
#

why you ping

slate swan
#

wasnt your screen black?

#

Apparently you can fully read our messages.

slate swan
crimson compass
#

yes i can i cant see the left of my screen

#

dumbo

slate swan
#

but you said total.

crimson compass
#

total black

slate swan
#

Then keep this out of here please, also no need to insult .

crimson compass
#

i mean black

velvet compass
crimson compass
#

you guys trolling?

slate swan
#

I believe you are the one doing so

#

no.

crimson compass
crimson compass
slate swan
#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

crimson compass
#

i keep telling you that i cant see other channels

slate swan
crimson compass
#

do you even know what dumbo means

slate swan
#

!ot

unkempt canyonBOT
slate swan
#

guys stop

crimson compass
#

thank

#

lemme leave krypton you spastic

slate swan
#

<@&831776746206265384>

#

@velvet compass ^

crimson compass
#

bye

slate swan
#

Logs exist, no need to edit your messages

crimson compass
#

ok

#

such a crybaby

slate swan
#

stop.

crimson compass
#

how old are you.

slate swan
#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

slate swan
#

Yet again.

cloud dawn
#

Just don't react guys, let mods handle this.

slate swan
#

bro actually evel stop

crimson compass
#

ok

#

ping the off topic channel again

#

please

slate swan
#

pls stop disrespecting orders given by moderators

quick gust
crimson compass
#

thanks.

slate swan
#

Your mouse wheel is most likely working, you can scroll up

slate swan
#

Krypton forget it.

quick gust
#

krypton dont reply to him he'll keep talking then

slate swan
#

pls lets go on topic

crimson compass
#

right click leave

#

@slate swan

slate swan
#

shhh

#

.topic

lament depotBOT
#
**Do you think there's a way in which Discord could handle bots better?**

Suggest more topics here!

crimson compass
#

shh mana s

velvet compass
#

Sorry was afk

#

!mute 951510224047583242 1d Take a break, and re-read our #code-of-conduct and #rules. Spamming a topical channel and insulting other server members are things we do not care for here.

unkempt canyonBOT
#

:x: The user doesn't appear to be on the server.

cloud dawn
#

๐Ÿฅณ

velvet compass
#

Oh they left

#

Sorry folks

jovial plover
#

is there an example of slash commands in discordpy 2.0

cloud dawn
crimson compass
velvet compass
#

!mute 951510224047583242 1d Take a break, and re-read our code-of-conduct and rules. Spamming a topical channel and insulting other server members are things we do not care for here.

unkempt canyonBOT
#

:x: The user doesn't appear to be on the server.

cloud dawn
slate swan
jovial plover
cloud dawn
jovial plover
#
import discord

bot = discord.Bot()

@bot.event
async def on_ready():
    print(f"We have logged in as {bot.user}")

@bot.slash_command(guild_ids=[973254205567549510])
async def hello(ctx):
    await ctx.respond("Hello!")```
cloud dawn
jovial plover
#

Yes, but with only commands.
New to slash commands

#

Not sure what to do

slate swan
#

Aren't they @app_commands.command()?

#

Never got into 2.0 slash commands yet

frail notch
#

Heya, I wasn't sure how to explain my problem - the first part of the video is to demonstrate how the bot works, from 00:25 onwards it demonstrates the problem
(u can probs understand the problem directly just by skipping to that part - aka 00:25)

cloud dawn
#

errm, I will make an example today, @jovial plover It's a bit hard to explain. It also needs much custom solutions since not everything is build-in.

worldly solstice
#

Heya guys, is it allowed to ask questions in here yeah?

jovial plover
#
import interactions

bot = interactions.Client(token="enter_token")

@bot.command(
    name="my_first_command",
    description="This is the first command I made!",
    scope=973254205567549510,
)
async def my_first_command(ctx: interactions.CommandContext):
    await ctx.send("Hi there!")

bot.start()

@cloud dawn this worked

cloud dawn
zealous jay
slate swan
#

It used to be "good" when discord.py had no slash commands and got discontinued

#

Then forks came with slash commands, already at that point it became kind of 'pointless' to rely on that library

zealous jay
#

yeah

exotic maple
slate swan
zealous jay
exotic maple
#

its probably easy but my dumbass took ages

exotic maple
zealous jay
#

good for you ๐Ÿ˜„

placid skiff
#

Without having any issue

zealous jay
#

๐Ÿค”

exotic maple
#

now i have to embed it into my previous bot which will set off hours of error fixing

uncut comet
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice i have discord py voice installed and pynacl installed

slate swan
#

PyNaCl is most likely not installed, otherwise you wouldn't get that error

uncut comet
#

i do have it installed

slate swan
#

Double check, that error wouldn't come

uncut comet
#

PyNaCl==1.5.0

#

i do have it

sick birch
#

Are you using a venv?

uncut comet
#

uh sorry what is that

sick birch
#

Ah

uncut comet
#

i have it working fine on one pc

sick birch
#

I would strongly suggest you use venvs to avoid issues like these

uncut comet
#

i will go google what that is haha

sick birch
#

Good idea

slate swan
#

!venv

unkempt canyonBOT
#

Virtual Environments

Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.

To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)

Then, to activate the new virtual environment:

Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate

Packages can then be installed to the virtual environment using pip, as normal.

For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.

Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.

Note: When using Windows PowerShell, you may need to change the execution policy first. This is only required once:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

sick birch
#

Or that

uncut comet
#

will i have to manually reinstall the all the modules in the virtual environment?

hollow agate
#

Any good MySQL libraries?

sick birch
#

But it isolates your packages so you donโ€™t have to deal with these issues

slate swan
unkempt canyonBOT
hollow agate
#

Thank you!

uncut comet
#

hmm okay ill look into it

#

thanks

slate swan
#

considering you are using an async Library ( as per the channel topic)

sick birch
#

Does sqlalchemy support asyncio?

slate swan
#

iirc ,yes

sick birch
#

Interesting. I would suggest that then

keen mural
#

how would i send a value from a sql table

cloud dawn
#

For an dpy slash example best to do an advanced version?

cloud dawn
sick birch
#

Isnโ€™t there on already?

#

I was trying to make one when dpy first unarchived but I got too lazy lol

#

My plan was to just port the one in the gist, if you want to an one doesnโ€™t already exist you can do that if youโ€™d like

cloud dawn
#

But those are single file.

sick birch
#

You want a multi file example?

#

Iโ€™d say go for it, but we donโ€™t have any multi page examples atm

slate swan
#

how to do that if the user writes something his AFK goes away?

hybrid fjord
#

how would i make a list of specific options using slash as shown here using discord-slash

slate swan
#

this library does not, and will never support autocompletes

#

i have a list i loop through till it reaches it end and every loop i add a field
how can i do if the embed has more than 5 fields it makes a pagination?

slate swan
placid skiff
slate swan
#

last updated on December 2021

keen mural
#

Hey I need some help with sqlite3 with my discord bot. My table has the column Wallet, and i want it to send the Wallet number for the specified user id

"SELECT User_Id, Wallet FROM Database WHERE User_Id = 704839281838915675"

I have this for selecting what I want, i just dont know how to make the bot say the Wallet value

and sometimes the bot would just send the content in the image below, but now i just dont know how i can do anything

slate swan
cloud dawn
keen mural
slate swan
keen mural
#

i did that once then #'d it out

slate swan
#

ah, great you sure that data with thst user_id is in the db?

#

you can use this to see

keen mural
#

when i print it i can see it i just dont know how to make it go into lets say an embed

slate swan
#

oh, may i see your code

slate swan
#

because getting information involves fetchone()/fetchall() too

keen mural
#
@client.command()
async def wallettest(ctx):
  con = sqlite3.connect("TEST.db")
  cur = con.cursor()
  cur.execute("SELECT User_Id, Wallet FROM Database WHERE User_Id = 704839281838915675")
  pprint(cur.fetchall()[0:5])
  row = "SELECT User_Id, Wallet FROM Database WHERE User_Id = 704839281838915675"
  userid = row("User_Id"[1:-1])
  ctx.reply(f"{int(userid)}")# format(row["userid"], row["Wallet"[1:-1]]))
  con.close()
slate swan
#

cur.fetchall() is the all results, why not send it?

keen mural
#
@client.command()
async def wallettest(ctx):
  con = sqlite3.connect("TEST.db")
  cur = con.cursor()
  cur.execute("SELECT User_Id, Wallet FROM Database WHERE User_Id = 704839281838915675")
  pprint(cur.fetchall()[0:5])
  await ctx.reply(f"{cur.fetchall()}")
  con.close()```
there @slate swan
#

it sends [] again

slate swan
#

and what does it print?

keen mural
slate swan
#

assign a single variable to fetchall and use it in both print and send

keen mural
#

ok ill try

slate swan
#
data = cur.fetchall()
print(data)
await send(data)
#

i guess that happens because the cursor resets the selection when a fetch is called, not sure though

keen mural
#

how would i make it so there are no () or []

slate swan
#

[] is the list of ()s ,
where () is your selections ( select user_id, wallet )

#

what data do you want to show?

keen mural
#

wallet, i dont need userid

slate swan
#

well then just select the wallet from the database

#

select wallet from database where ... ;

#

it will appear as a list of wallet data

vapid grove
#

whats the best way to make it so that every time an error occurs discord bot/webhook will send out that error

slate swan
#

!d discord.on_error

unkempt canyonBOT
#

discord.on_error(event, *args, **kwargs)```
Usually when an event raises an uncaught exception, a traceback is
printed to stderr and the exception is ignored. If you want to
change this behaviour and handle the exception for whatever reason
yourself, this event can be overridden. Which, when done, will
suppress the default action of printing the traceback.

The information of the exception raised and the exception itself can
be retrieved with a standard call to [`sys.exc_info()`](https://docs.python.org/3/library/sys.html#sys.exc_info "(in Python v3.10)")...
jade tartan
edgy mantle
#

How do I make it show up normally

#

With their name not ID

cloud dawn
#

.name not .mention

edgy mantle
#

I wanna mention thi

#

I think its a mobile issue

#

This is from PC

midnight gorge
#
@bot.event
async def on_ready():
    print("bot running")
    async with aiosqlite.connect("spooky.db") as db:
        async with db.cursor() as cursor:
            await cursor.execute('CREATE TABLE IF NOT EXISTS users (channel_id INTEGER , guild_id INTEGER , welcome TEXT, goodbye TEXT , message TEXT)')
        await db.commit()โ€Š

does this look good or do i replace welcome and goodbye with INTEGER instead of TEXT?

terse coyote
#

how to get the id of the role that the bot made
guild.create_role()

jade tartan
#

@slate swan for filename in os.listdir('./cogs'): if filename.endswith('.py'): client.load_extension(f'cogs.{filename[:-3]}')

#

Is that what you're talking about?

sick birch
#

Are you on 2.0?

#

There was a breaking change where load_extensions was made a coroutine

jade tartan
boreal ravine
boreal ravine
midnight gorge
#

but i do have the welcome table

#

so I suspect is the variable TEXT

boreal ravine
jade tartan
#

Is that it?

midnight gorge
sick birch
# jade tartan

Yup, looks like you're on the old version, so it's fine

jade tartan
#
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 979, in on_message
    await self.process_commands(message)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 976, in process_commands      
    await self.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1348, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
    await self.prepare(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 777, in prepare
    if not await self.can_run(ctx):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1087, in can_run
    return await discord.utils.async_all(predicate(ctx) for predicate in predicates)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\utils.py", line 350, in async_all
    elem = await elem
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\cogs\reactions.py", line 15, in wrap_func
    data = await ctx.client.config.find(ctx.guild.id)
AttributeError: 'Context' object has no attribute 'client'
#
    @commands.guild_only()
    #@commands.has_guild_permissions(administrator=True)
    @is_setup()
    async def rr_toggle(self, ctx):
        """Toggle reaction roles for this guild."""
        data = await self.client.config.find(ctx.guild.id)
        data["is_enabled"] = not data["is_enabled"]
        await self.client.config.upsert(data)

        is_enabled = "enabled." if data["is_enabled"] else "disabled."
        await ctx.send(f"I have toggled that for you! It is currently {is_enabled}")```
#

Does that mean i have to add a json file?

boreal ravine
frozen patio
#

It does I am pretty sure

sick birch
#

yes and not sure

frozen patio
#

I just got into Flask

#

Is it possible to create a bot dashboard in flask?

cloud dawn
#

A sync web library?

#

Not optimal no.

frozen patio
#

I tried in quart and did not go well

#

I want to try in flask

#

But I am not sure if it's possible so I thought I would ask

oak oar
oak oar
#

I was changing my tag...

torn sail
#

yes to both

boreal ravine
reef trail
fringe harness
#

Anyone here know how to take input from a user from a discord bot in dpy

jade tartan
#
Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\cogs\reactions.py", line 84, in rr_channel
    reaction_roles = await self.client.reaction_roles.get_all()
AttributeError: 'Reactions' object has no attribute 'client'

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

Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 27, in on_command_error
    raise error
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1348, in invoke
    await ctx.invoked_subcommand.invoke(ctx)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Reactions' object has no attribute 'client'
fading marlin
unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message,
or to react to a message, or to edit a message in a self-contained
way...
boreal ravine
supple thorn
boreal ravine
jade tartan
# boreal ravine What's `Reactions`?

Ok what am trying to do cuz my english is my 2nd language and itโ€™s hard for my to explain but my point that I am trying to make is I am making a reaction role that users can react like emoji reactions and when someone reacts to this emoji they will be able to see the rest of of my server

keen mural
#

with buttons, how do i detect the user who clicked

sick birch
keen mural
#

and how do i disable a button after 5 minutes if nobody clicked it?

keen mural
#

can u elaborate a bit

sick birch
#

Sure. Pass in the timeout= kwarg to your discord.ui.View() instance, and override the async def on_timeout(...):, and disable it from there

keen mural
#

๐Ÿ˜ถ

sick birch
#

You're gonna have to subclass ui.View for this by the way

cloud dawn
#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
keen mural
#

where can i read about everything u just said cuz i dont understand that and i dont want to bother u more

sick birch
#

I'd suggest the examples on github

keen mural
#

ok will check it out

maiden fable
#

@keen mural

#

Do pip install git+https://github.com/Rapptz/discord.py.git

keen mural
#

what would that do

maiden fable
#

Install discord.py with button and components support

maiden fable
keen mural
#

req alr satisfied

slate swan
#

Hi

maiden fable
#

@cloud dawn

sick birch
cloud dawn
keen mural
#

i did pip install discord_components

sick birch
#

discord_components... distasteful

#

It's usually a better choice to use components provided by the mainstream libraries rather than 3rd party ones

keen mural
#

so what do you recommend i use

sick birch
keen mural
sick birch
#

Not 2.0

keen mural
#

how do i get 2.0 then

slate swan
#

Use views!!

sick birch
keen mural
#

how is github mainstream tho

sick birch
#

If we're talking about version control systems, github is mainstream

slate swan
stone beacon
#

Quickly stopped myself

#

It was a pain to use properly

sick birch
sick birch
keen mural
#

will it mess up my button things now?

pliant gulch
#

GitHub is mainstream enough to overlook the issue with microsoft backing it, but tbh I'll prob switch to gitlab

sick birch
#

What are you using now?

keen mural
#

discord_components

sick birch
#

Yes, it's going to be different

slate swan
#

Discord components + views smh

cloud dawn
slate swan
stone beacon
keen mural
stone beacon
#

I'd say the docs has good examples of how to implement the new features easily

#

Really is straightforward

keen mural
sick birch
#

Yeah you're gonna need to install git

slate swan
#

Ig

torn sail
stone beacon
pliant gulch
#

you need to prefix it with git+

slate swan
sick birch
slate swan
#

..

sick birch
#

Still prefer sudo pacman -S git

slate swan
#

pacman

keen mural
#

i am kinda confused i just wanna know how to download this lmao

pliant gulch
slate swan
#

Listen

pliant gulch
#

doas pacman -S git

slate swan
#

U need to download git

keen mural
#

isnt git dangerous

sick birch
#

No?

keen mural
#

somewhat

slate swan
keen mural
#

ok where to download

sick birch
#

It's the most used version control system, it's completely safe

#

Given that you're not cloning random repos

keen mural
slate swan
#

yes?

#

Search download git

sick birch
#

speaking of pacman, just got a notification that polybar made it into the community repo ๐ŸŽ‰

keen mural
pliant gulch
#

Polybar is nice, but you really need to rice in order to make it look good

sick birch
sick birch
#

What do you use, if any?

pliant gulch
sick birch
#

Fancy, polybar?

pliant gulch
#

Only issue is the time is off by 4 minutes, and I use 24hr so it's kind of itching me

rustic onyx
#

Traceback ```
Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\schus\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 352, in _run_event
await coro(*args, **kwargs)
File "D:\Discord Bots\JSON Formatter\main.py", line 21, in on_message
trade_side = ast.literal_eval(data["side"])
File "C:\Users\schus\AppData\Local\Programs\Python\Python310\lib\ast.py", line 108, in literal_eval
return _convert(node_or_string)
File "C:\Users\schus\AppData\Local\Programs\Python\Python310\lib\ast.py", line 107, in _convert
return _convert_signed_num(node)
File "C:\Users\schus\AppData\Local\Programs\Python\Python310\lib\ast.py", line 81, in _convert_signed_num
return _convert_num(node)
File "C:\Users\schus\AppData\Local\Programs\Python\Python310\lib\ast.py", line 72, in _convert_num
_raise_malformed_node(node)
File "C:\Users\schus\AppData\Local\Programs\Python\Python310\lib\ast.py", line 69, in _raise_malformed_node
raise ValueError(msg + f': {node!r}')
ValueError: malformed node or string on line 1: <ast.Name object at 0x000002B88283E110>

Code ```py
data = ast.literal_eval(message.content)
tps = ast.literal_eval(data["tps"])
trade_side = ast.literal_eval(data["side"])
pliant gulch
#

Yea it's polybar, I ripped some config off github, got it copied in my dotfiles repo

keen mural
#

64 bit windows?

#

im guessing

sick birch
#

if you're on windows and a 64 bit system, yes

sick birch
rustic onyx
#

by any chance?

keen mural
sick birch
#

yup

pliant gulch
#

The time investment will return you very well

sick birch
#

I just have trouble with the icons honestly

#

I think icons would greatly improve how it looks

pliant gulch
#

Don't even get me started on fonts

sick birch
#

Yeah that's part of the problem

keen mural
#

which ones

sick birch
#

Dealing with fonts and polybar's configs is just... ugh

sick birch
slate swan
sick birch
#

If you wanna reduce bloat, take some time and tinker with it

pliant gulch
#

I'm feeling a bit bloated as well, got like 1000 some odd packages, before I only had 600

#

Gonna try my best to switch from BSPWM to xmonad as well

sick birch
#

It's surprising how fast you forget how to install arch

sick birch
pliant gulch
#

Just read the wiki and you'll be done in 3 mins

#

Excluding compile time

sick birch
#

I've considered xmonad but the haskell configs are kind of scaring me

pliant gulch
#

That's why I want to try it

#

Flex on my dotfiles repo that I use haskell

#

Without actually knowing haskell

sick birch
#

Lmao, you've haskell experience?

pliant gulch
#

๐Ÿ˜Ž

keen mural
#

use windows?

sick birch
#

Haha, not a language I see used often. Interesting though

sick birch
keen mural
#

i feel like im downloading a virus lmao

sick birch
#

If you feel that way, remember that Torvalds himself made git

pliant gulch
#

I also know there is a haskell library for discord bots

#

crazy what you can do without OOP

sick birch
pliant gulch
#

Well, to be fair brainfuck could work. It's turing complete

sick birch
#

These days it seems like having a discord wrapper library is a pre-requisite to being recognizes as a language

pliant gulch
#

So given enough time it'll work

#

Hell, you could probably even write a bot in x86_64

sick birch
#

Probably, real question is do you want to

keen mural
#

whats the install link again

sick birch
#

I suppose it'd be a fun side project however, just for the silies

pliant gulch
#

No way I would want to do that

keen mural
sick birch
#

Oh

keen mural
#

the pip install

pliant gulch
#

I tried taking my hand at some ASM when working on my "compiled" lang which I never finished

sick birch
pliant gulch
#

mostly cause I didn't understand ASM that well

sick birch
#

Well there's no reason a compiler has to be written in ASM

keen mural
slate swan
#

what's the topic going on?

pliant gulch
#

It was written in C++, It compiles to ASM then get's turned into binary

#

That was the plan at least

slate swan
sick birch
keen mural
#

vvvvvvvvv

sick birch
#

Hmm, is it in your PATH?

#

you might have to restart for it to pick it up

pliant gulch
cloud dawn
slate swan
pliant gulch
keen mural
#

its working now

pliant gulch
#

If I continued I would've made it bootstrap

keen mural
#

do i have to uninstall smth

slate swan
sick birch
#

Personally I'm trying my hand at creating a simple kernel using rust

slate swan
pliant gulch
#

Ohhh kernel in rust

#

I made one following a blog post

#

Fun project

sick birch
#

I'm willing to bet it's the same one I'm following

keen mural
#

what do i need for the imports

#

or is that in the docs

sick birch
#

The imports are included in the examples

keen mural
#

so i dont need stuff like
from discord_components import DiscordComponents, ComponentsBot, Button, SelectOption, Select

sick birch
#

Nope

slate swan
#

why not use View?

sick birch
#

You may as well uninstall discord_components so the interpreter throws an error if you do happen to be using it somewhere

keen mural
#

ok

#

its saying

client = commands.Bot(command_prefix= ",")

needs intents

slate swan
#
intents = discord.Intents.default()
intents.x = True
bot = commands.Bot(command_prefix=",",intents=intents)```
#

@keen mural

keen mural
#

ok

#

its saying import discord is invalid syntax

sick birch
#

Let's see the syntax then

keen mural
slate swan
#

code

#

from line 1 to 10

keen mural
#
import discord```
#
import discord
import os
import requests
import json
from discord.ext import commands
#from keep_alive import keep_alive
#from discord_components import DiscordComponents, ComponentsBot, Button, SelectOption, Select
import random
import asyncio
import datetime```
slate swan
#

show ss

keen mural