#discord-bots

1 messages · Page 1078 of 1

robust fulcrum
#

How?

slate swan
#

¯_(ツ)_/¯

robust fulcrum
robust fulcrum
slate swan
#

I did tell earlier

robust fulcrum
#

Not understood.....

slate swan
robust fulcrum
#
import os
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from webserver import keep_alive

cogs = ["cogs.invite","cogs.quote","cogs.wanted","cogs.purge","cogs.pot","cogs.image","cogs.spotify","cogs.channel","cogs.pie","cogs.eval"]
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='>',intents=intents)

@bot.event
async def on_ready():
	print("The bot is ready!")                
	print("Loading cogs . . .")               
	for cog in cogs:                          
		try:                                  
			await bot.load_extension(cog)
			print(cog + " was loaded.")
		except Exception as e:               
			print(e)

keep_alive()

Where I have to put load extension

visual island
scarlet sorrel
#

💀

#

🗿

#

it cant end like this

light violet
#

how to send a txt file by writting on it with dsicord py

#

discord py*

scarlet sorrel
#

or you want to send a file

dull terrace
#

You can't put spaces in custom ids can you? 7739monkathink

loud junco
#

2 days without sleep in a nutshell

slate swan
#

totally me

dull terrace
#

Made a button generator function that i need to rethink a little 7739monkathink

loud junco
#

Sleeping ||on someone's shoulder||

#

That guy must be suffering

dull terrace
#

is there a single word i can use for "my art"

slate swan
cloud dawn
#

lies

loud junco
#

But for 30 mins straight 💀

slate swan
glass star
#

is discord .py still active

slate swan
slate swan
glass star
#

but it doesnt get updated anymore right

#

if im not wrong

slate swan
#

to use*, though its in the alpha state

dull terrace
#

Pretty happy with how simple i've gotten this for a lot of buttons

scarlet sorrel
#

how do i get the permissions of a user that i have the ID of?

cloud dawn
scarlet sorrel
#

cuh

scarlet sorrel
cloud dawn
slate swan
scarlet sorrel
#

just guild specific

slate swan
unkempt canyonBOT
#

property guild_permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.

Changed in version 2.0: Member timeouts are taken into consideration.
scarlet sorrel
#

epic

slate swan
#

this will return a Permissions object

scarlet sorrel
#

good

maiden fable
#

Show yr on_application_command_error

cloud dawn
#

passcontext in a slash command is a new one.

maiden fable
#

Hahaha

#

There's an error in that event

loud junco
#

In ur console

placid skiff
#

the file is main.py in your container folder .-.

spring flax
#

why do people use bot.http.send_message

#

is it because you dont need the channel object?

slate swan
terse coyote
#

how to check member top role id?

visual island
unkempt canyonBOT
#

property top_role```
Returns the member’s highest role.

This is useful for figuring where a member stands in the role hierarchy chain.
visual island
#

then use the id attribute

clever field
#

or top_role

visual island
#

what?

#

how to check member top role id?

clever field
#

i copy now from my code, i misunderstood at first

#

how make handle the error ? from on_command_error
Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions

placid skiff
#

error handlers can be specific command handler or general command handler, it depends how you want to do it

clever field
#

I want to make a general error handler for lack of rights

#

BotMissingPermissions does not suit me

royal meteor
#

What parameters do discord.ui.Button and discord.ButtonStyle take?

placid skiff
#
@bot.command()
async def my_command(ctx):
  #whatever

@my_command.error()
async def my_command_error(ctx, error):
  #handling

this is command specific

@bot.listen("on_command_error")
async def handler(ctx, error):
  #handling

This one is general, you can put it whenever in your code, even inside a Cog, it will work for every command exception

clever field
#

thx

maiden fable
#

!d discord.ui.Button

unkempt canyonBOT
#

class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
maiden fable
#

There you go, all the params

royal meteor
#

ty

maiden fable
gaunt mortar
#

Hi, does someone know what would be the cleanest way to i18n (internationalize) a discord bot ?

maiden fable
unkempt canyonBOT
maiden fable
#

But u gotta manually write the translation for different langs or use a translator module

gaunt mortar
heady sluice
tropic burrow
#

why doesn;t this gamble command work


@client.command()
@commands.cooldown(1,30,commands.BucketType.user)
async def gamble(ctx, amount = None):
  await open_acccount(ctx.author)
  
  if amount == None:
    mbed = discord.Embed(
      title="please specify amount",
      description="the fellow monkey gamblers are actually betting their money"
    )
    await ctx.channel.send(embed=mbed)
    return

  bal = await update_bank(ctx.author)

  amount = int(amount)
  if amount > bal[0]:
    mbed = discord.Embed(
      title="imagine poor monkey",
      description="you cannot gamble that much!"
    )
    await ctx.channel.send(embed=mbed)
    return
    
  if amount<0 or amount==0:
    mbed = discord.Embed(
      title="do you have common sense.",
      description="the gamblers watch in confusion, thinking you are a madman, and kick you out of the casino"
    )
    await ctx.channel.send(embed=mbed)
    return
  final = []
  for i in range(3):
    a = random.choice("X","O","Q")
    final.append(a)

  slotsembed = discord.Embed(
    title="The slots roll down in the machine....",
    description=f"The slots in your machine are {final} so...."
  )
  await ctx.channel.send(embed=slotsembed)

  if final[0] == final[1] or final[0] == final[2] or final[2] == final[1]:
    winembed = discord.Embed(
      title="You Won! :D",
      description="Must have the charm of luck with you, you won twice as much as you gambled!"
    )
    await update_bank(ctx.author,2*amount)
    await ctx.channel.send(embed=winembed)
  else:
      loseembed = discord.Embed(
        title="You Lost! :(",
        description="Seems like you dont have any luck in you, i suggest not trying again, because you lost how much you gambled."
      )
      await update_bank(ctx.author,-1*amount)
      await ctx.channel.send(embed=loseembed)
#

nothing happens

#

no errors

slate swan
#

logic error most probably

#

ah, you didn't typehint amount to int

tropic burrow
#

i put amount = int(amount)

heady sluice
#

I would ask what update_bank or open_account and such looks like but I'll probably find it on youtube

tropic burrow
# heady sluice I would ask what update_bank or open_account and such looks like but I'll probab...

async def open_acccount(user):
  users = await get_bank_data()

  if str(user.id) in users:
    return False
  else: 
      users[str(user.id)] = {}
      users[str(user.id)]["wallet"] = 0
      users[str(user.id)]["bank"] = 0

  with open("./data.json","w") as f:
    json.dump(users, f)
  return True
    
async def get_bank_data():
  with open("./data.json","r") as f:
    users = json.load(f)

  return users

async def update_bank(user,change = 0,mode = "wallet"):
  users = await get_bank_data()

  users[str(user.id)][mode] += change

  with open("./data.json","w") as f:
    json.dump(users, f)

  bal = [users[str(user.id)]["wallet"],users[str(user.id)]["bank"]]
  return bal
  
maiden fable
heady sluice
#

that's 3 c's

#

in the name of the function

#

oh you did call it like that

maiden fable
#

istg I have seen that piece of code a thousand times now

heady sluice
#

yes this do be youtube code

maiden fable
#

I know

#

@tropic burrow what is the issue in this

tropic burrow
maiden fable
#

u got an error handler?

tropic burrow
#

no

#

and there is no error

maiden fable
#

Add debug prints

visual island
tropic burrow
maiden fable
#

icy Cirno u still coding bots btw?

tropic burrow
visual island
maiden fable
#

@tropic burrow turn on logging. u r prolly getting ratelimited

tropic burrow
#

i dont ususally turn it on

#

and im kinda new replit

visual island
maiden fable
#

Why everyone coding websites nowadays lmao

visual island
#

Cause why not kobopeek

maiden fable
#

Not games, not apps but websites lmao

visual island
#

Advertising games are hard especially if you're an indie developer, as you need to compete against other big games

maiden fable
#

Agreed

visual island
#

So I choose not to jump there yet

slate swan
robust fulcrum
#

Me done with eval command finally!

slate swan
maiden fable
#

Lmao

visual island
# slate swan *yet*

Yes, yet, I'm the type of person who likes to know everything rather than focusing on one thing, so yeah, I'll jump there some day

visual island
maiden fable
visual island
#

The younger you are, the more potential you have

slate swan
visual island
#

So I'm trying to get as much as possible during these ages

maiden fable
#

Imagine

visual island
#

Don't you?

maiden fable
#

School takes most of the time, so

slate swan
#

7hrs of schoolyert

maiden fable
#

Ding dong I am also in class 12

slate swan
#

welcome to the painful laif

visual island
maiden fable
#

Already started living it in April

maiden fable
#

Well nevertheless I am still learning smth new everyday in one form or another haha

#

Learning never stops

slate swan
#

holidays without alot of homeworks is not a thing~

visual island
maiden fable
maiden fable
shrewd apex
#

they send attendance on phone/whatsapp so its tough to skip

maiden fable
# shrewd apex lmao

I gotta write 3 reports of 30-40 pages each and I am procrastinating it lmao

#

Anyways let's take this to an ot

#

I can sense someone coming here to warn us anyway

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

maiden fable
#

None

#

It sends None on every eval

shrewd apex
#

?

maiden fable
shrewd apex
maiden fable
#

Hahaha its just a small bug where it sends the stdout even when its None

shrewd apex
#

lmao

maiden fable
#

That is why that line

maiden fable
shrewd apex
#

bugs are tough to notice sometimes especially codes which have lots of details

maiden fable
#

Agreed

#

And then there is me, who won't understand my own code if I open it after a week

slate swan
#

🚶‍♂️ thats why you dont write your own code, just copy paste it from stackoverflow!

shrewd apex
#

stacks like got all questions answered a-z

#

0-9

maiden fable
#

My questions get ignored on there 😄

#

Totally not badly worded

shrewd apex
#

lmao sed u need to do some digging to find nearest answer to your question

maiden fable
#

Ik haha

slate swan
#

🤔 i had a question... is it normal for py "[`text`](None)" to show up as None in an embed description?

#

when i do it manually it shows up as text, but in the code it just says None

maiden fable
#

BTW sarth, study maths

shrewd apex
lyric apex
#

raise HTTPException(r, data)
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently. Please read our docs at https://discord.com/developers/docs/topics/rate-limits to prevent this moving forward.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

slate swan
lyric apex
#

Why this error?

maiden fable
lyric apex
#

How to fix it?

maiden fable
#

kill 1

#

in shell and hope for the best

lyric apex
#

I tried Sad_Cat

terse coyote
#

How can I make it so that only a user with the role "..." can press the button? discord-components

lyric apex
lyric apex
#

Sad_Cat its temporarily

terse coyote
shrewd apex
#

if role in user.rolespithink

shrewd apex
slate swan
#

desktop:

maiden fable
#

Lmao my cpu and RAM usage to load a GIF

slate swan
#

Android

maiden fable
#

This is a GIF 💀

slate swan
#

notice the None appearing instead of the names on mobile

maiden fable
slate swan
#

yep

shrewd apex
# slate swan Android

happens i was once working with pil for embed images checking android when i opened on laptop the images became thumbnail size

#

i had to resize all my images afterwards...

shrewd apex
slate swan
#

got it to fix by using str1 if condition else str2

maiden fable
terse coyote
shrewd apex
#

wut gif is it?

terse coyote
# shrewd apex if role in user.roles<:pithink:652247559909277706>
@client.command(aliases = ["репорт"])
async def report(ctx):
    await ctx.message.delete()
    if ctx.channel.id == 976776289186906142:
        author = ctx.message.author
        maincategori = discord.utils.get(ctx.guild.categories, id = 976776105702858802)
        reportchannel = await ctx.guild.create_text_channel(f'репорт-{author.name}', category = maincategori)
        roleforum = discord.utils.get(ctx.guild.roles, id = 976200603694940201)
        rolecur = discord.utils.get(ctx.guild.roles, id = 974282941498814504) #curator role
        roleeveryone = discord.utils.get(ctx.guild.roles, id = 853219278945255434)
        await reportchannel.set_permissions(roleforum, manage_channels = True)
        await reportchannel.set_permissions(author, send_messages = True, read_messages = True)
        await reportchannel.set_permissions(roleeveryone, view_channel = False)
        embed = discord.Embed(description = f'Шановний учасник!\n\n Напишіть сюди своє питання і чекайте відповіді <@&976200603694940201>', timestamp=ctx.message.created_at, color = 0x6d41a8)
        embed.set_thumbnail(url = author.avatar_url)
        await reportchannel.send(f'{author.mention} <@&976200603694940201>', embed = embed, components = [
            Button(style = ButtonStyle.green, label = "Закрити репорт", emoji = "♻️")
        ])
        
        response = await client.wait_for("button_click")
        await response.respond(
            embed = discord.Embed(
                description = f'Кнопку може натиснути тільки людина з роллю <@&976200603694940201> і вище.'
                ))```
slate swan
maiden fable
shrewd apex
#

lmao

slate swan
#

thats an image~

shrewd apex
#

ur rich presence?

maiden fable
#

nvm

#

Discord fucked

lyric apex
slate swan
#

well. you made too many requests to the API and now you are ratelimited

#

what can you do? : wait

lyric apex
#

Requests mean?

slate swan
shrewd apex
#

like i call u on phone 10 times in a min u get pissed and block me

maiden fable
lyric apex
#

Then should i change my host?

shrewd apex
#

just an example😂

slate swan
maiden fable
#

Yes

slate swan
shrewd apex
#

lmao discord throwing tantrums

lyric apex
slate swan
#

waiting would be the best choice then

shrewd apex
#

its prolly the only choice...

maiden fable
#

Lmao

slate swan
#

running it on some other device may work, just like you reset the IP on replit

maiden fable
#

Or just go to your nearest Discord Data Center, start a fire to get discord's attention and then tell them to remove yr bot's ratelimit

maiden fable
lyric apex
shrewd apex
lyric apex
#

If i wait how much time will that take?

maiden fable
#

first*

shrewd apex
#

do google maps give location of discord data center?

maiden fable
#

prolly 2 hours

lyric apex
#

It can be permanently also?

maiden fable
#

No

lyric apex
shrewd apex
slate swan
maiden fable
#

Just do what u would have done, when u load up GTA 5

clever gazelle
#

Oop

lyric apex
maiden fable
clever gazelle
#

Hey

shrewd apex
#

hello

maiden fable
#

nice pfp

tacit token
#

Hi ? how can i check member banned with whois? Example:

if member banned:
baninfo=No banned
else:
baninfo=reason

slate swan
#

why would a member be banned

unkempt canyonBOT
#

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

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

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

Examples

Usage...
maiden fable
tacit token
#

i have this but i want to check

#

so i have this:

@client.command()
async def baninfo(ctx,*,user:discord.User):
    bans = await ctx.guild.bans() #Getting a list of all ban entries
    for ban_entry in bans: #Looping through all entries
        user = ban_entry.user #Getting user
        reason = ban_entry.reason #Getting Reason
maiden fable
#

Seems like there is a code error

#

Since the coloring ain't right

slate swan
#

thats just discord being dumb

maiden fable
#
@client.command()
async def baninfo(ctx,*,user:discord.User):
    bans = await ctx.guild.bans() #Getting a list of all ban entries
    for ban_entry in bans: #Looping through all entries
        user = ban_entry.user #Getting user
        reason = ban_entry.reason #Getting Reason
shrewd apex
#

seems fine

maiden fable
#

Or they not using the correct lang

shrewd apex
#

whats other langs?

maiden fable
#

there are many

#

js, cs, cpp, rs

slate swan
#

dont think any other language uses list , its mostly array for all of them

tacit token
slate swan
#

python and julia are the only ones im aware of

shrewd apex
#

rs is rust?

tacit token
#

wow

slate swan
shrewd apex
#

mhm

maiden fable
tacit token
#

so anybody have an idea how to check the member banned or not?

shrewd apex
#

if the member is in ctx.guild.bans he is if not he is not banned

maiden fable
#

@tacit token

@client.command()
async def baninfo(ctx,*,user:discord.User):
    bans = await ctx.guild.bans() #Getting a list of all ban entries
    async for ban_entry in guild.bans(): #Looping through all entries
        user = ban_entry.user #Getting user
        reason = ban_entry.reason #Getting Reason
#

smth like this

shrewd apex
#

u can iterate and check

maiden fable
#

(I forgot how an async iter works)

shrewd apex
#

he already returned a list of bans why not use that?

tacit token
maiden fable
slate swan
#
banned_users = [ m.user async for m in Guild.bans() ]``` 🚶‍♂️
#

and then you can check if the user is in the list

tacit token
#

im a clown but how

slate swan
#

!e py print( 1 in (1,2,3))

unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

True
shrewd apex
#
lst = [ban_entry.user for ban_entry in await ctx.guild.bans()]
#

this should work as well

maiden fable
#

Lmao did u try to eval that

shrewd apex
#

mistake

#

habit from help channels

maiden fable
#

Lmao

shrewd apex
maiden fable
#

soo many bans

shrewd apex
tacit token
#

So i try this:

@client.command(aliases=["hackwhois"])
async def hackuserinfo(ctx, *,member:discord.User,baninfo="No banned"):
    bans = await ctx.guild.bans() #Getting a list of all ban entries
    for ban_entry in bans: #Looping through all entries
        baninfo = ban_entry.reason #Getting Reason
        embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
        embed.set_thumbnail(url=member.avatar_url)
        embed.set_footer(text=f"Lekérte {ctx.message.author}",
                    icon_url=f"{ctx.message.author.avatar_url}")
        embed.add_field(name="ID:", value=member.id)
        embed.add_field(name="Nickname:", value=member.display_name)
        embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
        embed.add_field(name="Ban info:",value=baninfo)
        await ctx.send(embed=embed)
shrewd apex
slate swan
shrewd apex
slate swan
#

nope it wont

shrewd apex
#

it worked on 1.7.3 when i used it

#

i never tried on 2.0

tacit token
slate swan
shrewd apex
#

hmm

#

could be lemme try

slate swan
#

well, it works in 1.7.3

shrewd apex
#

can u try this

shrewd apex
shrewd apex
slate swan
#

cause in 1.7.3, its a coroutine which returns list[BanEntry]
in 2.0 its an async for returning BanIterator

shrewd apex
#

then just check if user is in the the list with ur member parameter

shrewd apex
#

i didnt work with mod commands only mostly interaction in 2.0 so...

slate swan
#

😔 makes me realise 2.0 is really breaking

shrewd apex
#

i solely used 2.0 just for the interactions

slate swan
#

mod commands are meh~
i'd prefer to use a public bot instead of adding mod commands to my bot

shrewd apex
#

otherwise i wouldnt even bother updating

slate swan
#

pBear i migrated to hikari and no going back now

#

its just full of Mapping s and Iterators

shrewd apex
#

nice is hikari drastically better than dpy?

slate swan
#

4x faster + better typehinted + multiple command handlers

shrewd apex
#

4x faster srsly?

slate swan
#

try it and see

shrewd apex
#

ok any drastic changes from like normal dpy?

tacit token
shrewd apex
#

urs might be 1.7.3

slate swan
#

Better cache, everything is built so you can make your own impl of each part if you want. Customizable cache as well as working well with intents, doesn't break if discord adds a new field to some object (something that d.py has done in the past). Hikari will support cython speedups for the base impl, which is basically python compiled to C, which makes it run on steroids. Overall, faster than d.py and built to last and be extendable

  • davfsa#7026

Consistency, strictness, strong typing, modularity, composition and cache independence is what makes Hikari better than d.py

  • vicky5124#2207
shrewd apex
#

lmao i googled hikari first result i got was japanese fish

slate swan
shrewd apex
#
Hikari is a line of specialty fish food brand manufactured by Kyorin Food Industries, Ltd. in Japan
slate swan
#

lmao

tacit token
#

how can i avoid this error?

shrewd apex
#

number of words are too many

#

reduce em

worthy tree
#

Hi guys how does anyone know how to put a post request and post it to to chats with discord border : python

tacit token
# shrewd apex np

i have a problem, if i use the command in 1 member the bot list of all member bans

shrewd apex
#

what is your command as of now

tacit token
#

hackwhois

#
@client.command(aliases=["hackwhois"])
async def hackuserinfo(ctx, *,member:discord.User):
    bans = await ctx.guild.bans() #Getting a list of all ban entries
    for ban_entry in bans: #Looping through all entries
        baninfo = ban_entry.reason #Getting Reason
        lst = [ban_entry.user for ban_entry in await ctx.guild.bans()]
        if member in lst:
            embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
            embed.set_thumbnail(url=member.avatar_url)
            embed.set_footer(text=f"Lekérte {ctx.message.author}",
                        icon_url=f"{ctx.message.author.avatar_url}")
            embed.add_field(name="ID:", value=member.id)
            embed.add_field(name="Nickname:", value=member.display_name)
            embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
            embed.add_field(name="Ban info:",value=baninfo)
            await ctx.send(embed=embed)
        else:
            embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
            embed.set_thumbnail(url=member.avatar_url)
            embed.set_footer(text=f"Lekérte {ctx.message.author}",
                        icon_url=f"{ctx.message.author.avatar_url}")
            embed.add_field(name="ID:", value=member.id)
            embed.add_field(name="Nickname:", value=member.display_name)
            embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
            embed.add_field(name="Ban info:",value="Nincs bannolva")
            await ctx.send(embed=embed)
slate swan
#

its under the loop... so yeah

#

it gets executed the number of times there are people banned in the server

tacit token
#

any idea?

slate swan
#

just remove that loop

shrewd apex
#

u can do for i in lst if i==member

tacit token
#

do u have any example?

worthy tree
#

Is it best to code in js for disc bots

shrewd apex
#

js should have larger userbase than py i think

cloud dawn
slate swan
#
lst = [ban_entry for ban_entry in await ctx.guild.bans()]
if not member in list: return
ban_reason = ban_entry.reason
``` this are all the fields you need, other stuff is extra
minor totem
shrewd apex
#

considering the number of js tutorials

tacit token
minor totem
#

Are there more JS tutorials than Python tutorials?

#

Most suggest using JS because a lot of it can be done straight in the browser so it's easier to get started

worthy tree
#

So js is easier then for discord bots

#

In regards to functionality

slate swan
#

depends on your knowledge about the respective languages

cloud dawn
lament mesa
#

imagine debugging js

minor totem
lament mesa
#

ts is nice though

slate swan
worthy tree
#

True I’m comfortable with both but debugging is a butch

shrewd apex
#

u can go with what u feel will help u in the long run

cloud dawn
#

Python is like the error is on line 90 man
JS is like error ??

slate swan
#

pithink errors in python 3.10 are very specific and neat

lament mesa
minor totem
#

I am still really curious in like, what is the easiest framework. Like- what type of design could create a dead simple framework for beginners...

paper sluice
#

rust errors are supreme

minor totem
#

I know a lot of people who I'd love to recommend Discord bots, but it's rather difficult anywhere you go and none of the frameworks are designed for beginners really

shrewd apex
#
Python 3.11 is up to 10-60% faster than Python 3.10. On average, we measured a 1.25x speedup on the standard benchmark suite.
slate swan
#

this gets interesting 👀

shrewd apex
#

yeah

lament mesa
slate swan
#

pithink yes but websockets are painn

tacit token
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: argument of type 'type' is not iterable

@client.command(aliases=["hackwhois"])
async def hackuserinfo(ctx, *,member:discord.User):
        bans = await ctx.guild.bans() #Getting a list of all ban entries
        for ban_entry in bans:
            baninfo = ban_entry.reason #Getting Reason
            lst = [ban_entry for ban_entry in await ctx.guild.bans()]
            if member not in lst:
                ban_reason = ban_entry.reason
                embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
                embed.set_thumbnail(url=member.avatar_url)
                embed.set_footer(text=f"Lekérte {ctx.message.author}",
                                icon_url=f"{ctx.message.author.avatar_url}")
                embed.add_field(name="ID:", value=member.id)
                embed.add_field(name="Nickname:", value=member.display_name)
                embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
                embed.add_field(name="Ban info:",value=ban_reason)
                await ctx.send(embed=embed)
            else:
                embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
                embed.set_thumbnail(url=member.avatar_url)
                embed.set_footer(text=f"Lekérte {ctx.message.author}",
                                icon_url=f"{ctx.message.author.avatar_url}")
                embed.add_field(name="ID:", value=member.id)
                embed.add_field(name="Nickname:", value=member.display_name)
                embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
                embed.add_field(name="Ban info:",value=ban_reason)
                await ctx.send(embed=embed)

slate swan
#

if member not in lst*

tacit token
#

This member never banned but she have ban reason

lament mesa
minor totem
lament mesa
#

oh nice

minor totem
slate swan
#

true that, 😔 you can make a new beginner friendly library then,
im sure many people here will contribute

minor totem
#

I've made no progress in like 6 months, but I've had it in the back of my mind but not sure what to do with it.

#
from simplediscord import *  # TODO: Come up with a non-used better name

def on_message_create(event):
    if event['content'] == 'Hi':
        add_reaction('👋')

run('ABC123.XYZ789', on_message_create)

Here's a code example I've thrown around a few times

#

event is a dictionary of the event, and those functions there use underlying variables that keep track of the current event which means that you don't need to pass which message (it already knows it is the one that was created)

tacit token
slate swan
#

so the library still doesnt have models? based on the `event['content']

minor totem
slate swan
minor totem
#

I feel like it's easier to teach someone about dictionaries and have them learn it that way. Classes confuse some people, although it's easier to do like x.y yeah

worthy tree
#

How would one relay a picture

#

I just get colons

honest laurel
minor totem
#

This is typed dictionaries, they have autocomplete

slate swan
# tacit token <@456226577798135808> do u have any idea?

you can actually just get the member in the list ```py
member: discord.User

lst = [ban_e for ban e in await Guild.bans() if ban_e.user.id == member.id]

then check if the list is not empty

if lst == []: return # the member is not banned

send your embed now

in case you want to get the member's ban entry you can just do `lst[0]`
honest laurel
#

I believe i had some problems with typeddicts so 😅

maiden fable
#

Oh hi there blue

tacit token
minor totem
#

I am really up for discussing it, because this is a decision I am not still sure about. I know I want to strip out async, decorators, and classes (especially subclassing). I see the benefit of having model classes though thinkmon

slate swan
# honest laurel `if not lst`

pWut yes thanks for pointing it out, i thought it would be wrong to use it here since it works for not "" and not None too

maiden fable
#

Actually using not lst is slower than list == [0] or len(list) == 0

slate swan
# tacit token

ban_e and Guild should be an instance ( ctx.guild) in your case

tacit token
#

ctx.guild.bans() ?

slate swan
#

yes

loud junco
#

how long does it take till my bot go offline in replit (if no command running)

maiden fable
#

30 min

slate swan
maiden fable
#

After u close the tab

minor totem
#

Also, besides @honest laurel. There's no typing here because I don't want people to start doing that. Even if it was a class they (the very early beginners who don't know close to anything about Python yet) wouldn't get autocomplete.

maiden fable
slate swan
#

*mins, my bad

minor totem
honest laurel
#
%timeit not some_list
25.6 ns ± 0.483 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)

%timeit len(some_list) == 0
61.3 ns ± 2.37 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)

%timeit some_list == []
42.8 ns ± 0.304 ns per loop (mean ± std. dev. of 7 runs, 10,000,000 loops each)
tacit token
#

This is good?

@client.command(aliases=["hackwhois"])
async def hackuserinfo(ctx, *,member:discord.User):
        bans = await ctx.guild.bans() #Getting a list of all ban entries
        for ban_entry in bans:
            baninfo = ban_entry.reason #Getting Reason
            lst = [ban_e for ban_e in await ctx.guild.bans() if ban_e.user.id == member.id]
            if lst == []: 
                ban_reason = ban_entry.reason
                embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
                embed.set_thumbnail(url=member.avatar_url)
                embed.set_footer(text=f"Lekérte {ctx.message.author}",
                                icon_url=f"{ctx.message.author.avatar_url}")
                embed.add_field(name="ID:", value=member.id)
                embed.add_field(name="Nickname:", value=member.display_name)
                embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
                embed.add_field(name="Ban info:",value=ban_reason)
                await ctx.send(embed=embed)
            else:
                embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
                embed.set_thumbnail(url=member.avatar_url)
                embed.set_footer(text=f"Lekérte {ctx.message.author}",
                                icon_url=f"{ctx.message.author.avatar_url}")
                embed.add_field(name="ID:", value=member.id)
                embed.add_field(name="Nickname:", value=member.display_name)
                embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
                embed.add_field(name="Ban info:",value=ban_reason)
                await ctx.send(embed=embed)
minor totem
maiden fable
honest laurel
minor totem
loud junco
minor totem
honest laurel
#

Also what's up with globals?

minor totem
#

When variables are in locals they can be looked up in an array, this is faster. Test it inside of a function, because the majority of code will be inside a function.

honest laurel
#

I'm using timeit, not sure if it matters here

#

We care about difference in timings, not timings themselves

worn folio
#

hi everyone! i am trying to fetch the member counts keep on getting an error say {"message": "401: Unauthorized", "code": 0} please help:


reqUrl = "https://discord.com/api/v9/guilds/guild_id?with_counts=true"
headersList = {
  "Authorization": "token"
}
payload = ""
response = requests.request("GET", reqUrl, data=payload,  headers=headersList)
print(response.text)```
minor totem
# honest laurel not start, but eventually people should learn these things

Yup definitely. I feel like they can do that with another framework maybe? Should there perhaps be multiple APIs one can progress through? 🤔

Also the thing with decorators is that it's somewhat simple to learn to place a decorator, but I really want people to learn how and why to do something other than just how to write that thing. Decorators themselves (how to write them) are pretty complicated so I want to not do that if possible.

minor totem
desert moss
#

Hi all! What database do you recommend for a small bot? I thought about YAML files since I love their simplicity

worn folio
desert moss
honest laurel
#

files (yaml, json) - idk, you can't go wrong with any sql db though

minor totem
lament mesa
past aspen
#

sorry to interrupt

honest laurel
#

Or put everything into functions?

cedar goblet
#

your function is meaningless

honest laurel
#

@minor totem Also wouldn't it have to look up len in locals anyway then? I think not is simply faster here

tacit token
#

i don't know i'm very confused with this and i can't adjust to it

heavy shard
cedar goblet
#

imagine how your function would work in your head and you will realize the problem normally

minor totem
tacit token
#

I got 3 different things to do with it and none of it was good unfortunately so I don't know what I wanted anymore

honest laurel
#

Not that you should worry about speed here...

worn folio
honest laurel
#

For example Bot abcdefg...

shrewd apex
#

in discord.py selection row how to find which selection option was chosen?

worn folio
cedar goblet
# tacit token I got 3 different things to do with it and none of it was good unfortunately so ...
@client.command(aliases=["hackwhois"])
async def hackuserinfo(ctx, *, member:discord.User):
        bans = await ctx.guild.bans() #Getting a list of all ban entries
        lst = [ban_e for ban_e in await ctx.guild.bans() if ban_e.user.id == member.id]
        embed = discord.Embed(color=0x669999, timestamp=ctx.message.created_at,title=f"Felhasználó információk - {member}")
        embed.set_thumbnail(url=member.avatar_url)
        embed.set_footer(text=f"Lekérte {ctx.message.author}",
                        icon_url=f"{ctx.message.author.avatar_url}")
        embed.add_field(name="ID:", value=member.id)
        embed.add_field(name="Nickname:", value=member.display_name)
        embed.add_field(name="Lérrehozva:", value=member.created_at.strftime("%a, %#d %B %Y, %I:%M %p UTC"),inline=False)
        if lst != []:
              ban_reason = lst[0].reason
              embed.add_field(name="Ban info:",value=ban_reason)
        await ctx.send(embed=embed)

I think it's better.

slate swan
shrewd apex
#

oh ok lemme try

cedar goblet
slate swan
#

What I use

shrewd apex
#

i should set the values in selection option(values)

#

right?

shrewd apex
#

or just label and desc is enough

worn folio
tacit token
#

@cedar goblet = King

cedar goblet
tacit token
cedar goblet
slate swan
slate swan
shrewd apex
#

ok thx

cedar goblet
# tacit token yess

try to compare the solution with your old function to understand and find your mistakes

#

it's better for you

tacit token
#

ok ty sir

cedar goblet
#

sir ahah

slate swan
shrewd apex
#

in view.add_item(select, items) here items is a list?

visual island
shrewd apex
#

oh ok my bad

#

linter was acting up

slate swan
#

Label is the big like title and description is like description

shrewd apex
#

yeah i got it

slate swan
#

Why I can't see bold words 💀

#

Bold
normal

#

probably related to ur device fonts

#

Ye ig

minor totem
unkempt canyonBOT
#

@minor totem :white_check_mark: Your timeit job has completed with return code 0.

1000000 loops, best of 5: 198 nsec per loop
slate swan
#

nano sec

shrewd apex
#

how to add items to select row?

minor totem
#

Are you sure this isn't just occasional? It looks like a race condition in your library.

visual island
slate swan
unkempt canyonBOT
#

class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.

This is usually represented as a drop down menu.

In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.Select.values "discord.ui.Select.values").

New in version 2.0.
slate swan
#

the options kwarg

shrewd apex
#

no i mean if u choose a option it sends a certain embed

slate swan
#

or Select.add_option

shrewd apex
#

where do I add this embed object

slate swan
# shrewd apex where do I add this embed object

Example

options = [] 
for sdf in lip: 
  options.append(disnake.SelectOption(label = sdf, description=anything)) super().__init__(placeholder='Skmething', min_values=1, max_values=1, options=options)
#

Lip is a list of values

slate swan
#

I thought he was asking how to add option

shrewd apex
#

hmm ok

visual island
slate swan
slate swan
#

I literally gave a full-fleshed example 😔 in the morning

proven aurora
#

question do people still use discord.py? like

import discord```
lament mesa
#

yeah

paper sluice
#

yes

proven aurora
#

i saw a video saying its outdated

lament mesa
#

not anymore

loud junco
#

like this?

slate swan
loud junco
#

@slate swan

placid skiff
#

Nowadays things get outdated really fast D_D

loud junco
#

LOL

slate swan
loud junco
#

my console looking weird

#

should have those red and white words

shrewd apex
#

here is my callback

    async def call(interaction):
        if interaction.user != ctx.author:
            return await interaction.response.send_message(f"**⛔Don't disturb {ctx.author.mention} {interaction.user.mention}!**",
                                                           ephemeral=True)
        embed = embeds[interaction.values[0]]
        interaction.response.edit_message(embed=embed)
#
AttributeError: 'Interaction' object has no attribute 'values'
slate swan
#

does only disnake support that

#

!d disnake.MessageInteraction.values

unkempt canyonBOT
loud junco
slate swan
#

hm.

slate swan
slate swan
loud junco
#

its not working and the console looks weird

shrewd apex
loud junco
#

;-;

slate swan
shrewd apex
#
{'values': ['Items'], 'custom_id': '2d9c3a0e0c34e0108c7c66b17ebeeaef', 'component_type': 3}
slate swan
shrewd apex
#

yeah...

slate swan
#

i wonder why discord.py could not simply add it 🚶‍♂️

#

weird though, self.values should work

loud junco
#

its not loaded

slate swan
#

hm

slate swan
loud junco
#

but on_ready is ran

slate swan
#

weird lemme see

loud junco
slate swan
#

there's Select.values, but thats the list of values in the select, not the selections made by user

loud junco
slate swan
#

bot.start is blocking

loud junco
#

?

slate swan
#

move the print above that

slate swan
loud junco
heavy folio
loud junco
#

its printed

shrewd apex
#

yeah working now

slate swan
heavy folio
#

Where

slate swan
shrewd apex
#

lemme now try paginating them

loud junco
#

but my bot not doing anything

slate swan
loud junco
#

:/

slate swan
loud junco
unkempt canyonBOT
#

examples/views/dropdown.py line 31

await interaction.response.send_message(f'Your favourite colour is {self.values[0]}')```
slate swan
#

yeah yeah, i edited the msg

#

im blind nn

#

🚶‍♂️ thats why you dont use multiple libraries

loud junco
#

help me after he is done with his problem?

slate swan
#

without the await

loud junco
#

so

slate swan
#

you should do that in setup_hook instead

loud junco
#

just realised

#

althought i wrote import asyncio

#

but its not in my packages

slate swan
#

asyncio is always installed

#

wonderful, its inbuilt

minor totem
#

Wait how is that causing a failure?

slate swan
#

not inbuilt

loud junco
#

hmm

#

ok

#

so what do i do now

slate swan
loud junco
#

how

#

i have no idea what is that

slate swan
#

are you subclassing bot or just commands.Bot(command_prefix=...)

cloud dawn
#

remove the last comma after defining Embed

slate swan
#

remove the , in the embed var

spring flax
#

where can I find the methods available with bot.http?

loud junco
#
from discord.ext import commands

class MyBot(commands.Bot):
  def __init__(self):
    super().__init_(command_...)
  
  async def setup_hook(self): #this function will be triggered automatically on startup and before any event is dispatched, you DO NOT have to run it explicitly
    await self.load_extension(...)
    await do_more_things_if_required()
```this one?
cloud dawn
slate swan
loud junco
slate swan
loud junco
slate swan
#

its an async function whats the issue with awaiting there?

loud junco
#

so i copy pasta ?

#

the whole thing and replace it?

slate swan
#

sure

loud junco
#

@slate swan

#

this code that u gave me

from discord.ext import commands

class MyBot(commands.Bot):
  def __init__(self):
    super().__init_(command_...)
  
  async def setup_hook(self): #this function will be triggered automatically on startup and before any event is dispatched, you DO NOT have to run it explicitly
    await self.load_extension(...)
    await do_more_things_if_required()
#

what to write in the ...

#

command_...

shrewd apex
#

in the callback for interactions can u pass more parameters than just interaction?

slate swan
#

nope

#

no

spring flax
shrewd apex
#

so how would I get back which page the user was on?

slate swan
shrewd apex
#

i am not subclassing it

minor totem
slate swan
spring flax
shrewd apex
#

how give an example

slate swan
loud junco
slate swan
#

select.index = 0

on next page

select.index +=1

on previous page

select.index -=1

loud junco
#

what to write in ...

shrewd apex
#

oh ok

slate swan
minor totem
slate swan
# loud junco help

the init function accepts all the parameters you pass to commands.Bot, self.load_extension() is just bot.load_extension

loud junco
#

i still dont understand

slate swan
spring flax
slate swan
slate swan
loud junco
#
command_prefix = prefixxx, case_insensitive=True, activity=discord.Game(name="rpm start"),intents=intents
#

this one?

slate swan
minor totem
slate swan
#

there are more tricky confusing stuff inside the http, so ill recommend not using it

loud junco
#

what about this

spring flax
#

are there any simple open source projects showing simple examples for a example for me to see?

unkempt canyonBOT
#

discord/http.py lines 714 to 716

def get_channel(self, channel_id: Snowflake) -> Response[channel.Channel]:
    r = Route('GET', '/channels/{channel_id}', channel_id=channel_id)
    return self.request(r)```
slate swan
slate swan
loud junco
slate swan
loud junco
#

@slate swan

slate swan
#

read the whole message

loud junco
#

oo ok

spring flax
slate swan
spring flax
#

then yes, that's what I want

slate swan
loud junco
#
(await bot.load_extension(f"commando.{file[:-3]}") for file in os.listdir("commando/") if file.endswith(".py"))
```this?
slate swan
#

unlike discord.py, they have a complete different restclient

minor totem
# spring flax REST API
GitHub

Discord API Wrapper - Easy enough for Wumpus, and fast enough for Clyde! - wumpy/library/wumpy-rest at main · wumpyproject/wumpy

loud junco
#

ok

slate swan
slate swan
#

lets uhh not talk about it now

minor totem
loud junco
#

am i doing this correctly

#

wait gg

slate swan
#

await do_more_...
isnt a function

loud junco
#

ikik

minor totem
shrewd apex
#

what was the command for delete?

slate swan
heavy folio
#

!d discord.Interaction.delete_original_message

unkempt canyonBOT
#

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

Deletes the original interaction response message.

This is a lower level interface to [`InteractionMessage.delete()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.delete "discord.InteractionMessage.delete") in case you do not want to fetch the message and save an HTTP request.
shrewd apex
slate swan
#

asyncio has a method with the same name as a keyword for some reason

loud junco
#
class MyBot(commands.Bot):
  def __init__(self):
    super().__init_(command_prefix = prefixxx, case_insensitive=True, activity=discord.Game(name="rpm start"),intents=intents)
  
  async def setup_hook(self):
    (await self.load_extension(f"commando.{file[:-3]}") for file in os.listdir("commando/") if file.endswith(".py"))
slate swan
#

#bot-commands for bot commands

minor totem
#

Why is asyncio inside of your site-packages?

slate swan
loud junco
minor totem
minor totem
slate swan
#

pypi*

loud junco
#

i download from packages site

slate swan
#

!pip asyncio

unkempt canyonBOT
slate swan
#

i hate phone

loud junco
#

auto correct

minor totem
#

Yeah this is for way older Python versions, before asyncio actually was a thing.

shrewd apex
slate swan
slate swan
shrewd apex
#

is it fine if u don't add a description in the selection option

slate swan
#

python 3.3 to be specific

slate swan
slate swan
#

😔 read the message and that project's description pls

#

i did

minor totem
#

Hm? Yes the asyncio on PyPI is an outdated one designed as the very first asyncio. You should not install it

slate swan
#

installs it

#

This version is only relevant for Python 3.3, which does not include asyncio in its stdlib.

Master repo: https://github.com/python/asyncio

asyncio wasnt a part of stdlib in 3.3

slate swan
loud junco
#

what kind of error is this

#

nvr seen this in my life before

slate swan
loud junco
slate swan
#

pyproject.toml or the the tab

loud junco
slate swan
#

why is it in the site-packages folder pithink

#

did you ever install it?

loud junco
#

ya

#

like last hour

#

i deleted it

slate swan
#

can you send me your poetry.lock

loud junco
slate swan
#

so thats not in there, try uninstalling asyncio using pip, if that doesnt work just fork your repo to a new one 🚶‍♂️

loud junco
#

pip uninstall asyncio?

slate swan
#

yea

heady sluice
slate swan
#

no they installed asyncio from pip

loud junco
#

i got syntax error

#

jesus christ

heady sluice
slate swan
#

🫂 so you fork it now

loud junco
#

how

#

use the version i use before i pip install that?

#

or make a new one

slate swan
#

uh i mean just create a fork of your repl

loud junco
slate swan
loud junco
slate swan
#

see the image

loud junco
#

oo

#

i found it

#

alright

#

its still the same @slate swan

#

;-;

heady sluice
#

it's not because of the library

#

it's a syntax error

#

you cannot put the word async in the middle of a line

#

that's old python

loud junco
#

but i nvr does that

slate swan
#

!pip asyncio the old python

heady sluice
#

async probably changed it too

unkempt canyonBOT
slate swan
#

they installed this.

loud junco
#

kinda

#

and im in deepshit trouble

#

10 different library with one name

slate swan
#

what made you think of installing it

heady sluice
#

oh the syntax error is in the lib

slate swan
#

delete pls

heady sluice
#

me: bruhkitty

loud junco
loud junco
#

so what can i do

slate swan
loud junco
#

;-;

#

so what do i do now

slate swan
#

simply uninstalling the library worked for me

loud junco
#

but how

heady sluice
#

yes

loud junco
heady sluice
#

yes

slate swan
#

try poetry remove asyncio

loud junco
#

ok

heady sluice
#

why poetry

slate swan
heady sluice
#

what's poetry

#

oh it's repl shit

slate swan
loud junco
heady sluice
#

pip on top

loud junco
#

pip poetry remove asyncio?

#

=.=

slate swan
#

not the main repo

loud junco
#

the main repo is called database

heady sluice
#

uh

worn folio
#

Hey everyone, i am trying to get the daily communicator (voice or text) for a community server, can anyone please help with this?

slate swan
# heady sluice pip on top

poetry is kinda easier and better to use, its more customisable, you can mention project dependencies, dev dependencies and more seperately and use proper flags to install only the stuff you want

heady sluice
#

P I P O N T O P

slate swan
#
  • it works with Venvs so pogg-er
loud junco
#

@slate swan

#

still the same even after i forked it again

slate swan
#

yeah, try running the forked repo now

loud junco
#

🥲

robust fulcrum
#

Guys how can we make custom prefix command with json?

loud junco
#

i want to cry @slate swan

robust fulcrum
#

What happened?

#

Tell me maybe I could help

loud junco
#

i accidentally downloaded asyncio

#

and now its haunting me

robust fulcrum
#

Maybe try overwrite poetry?

loud junco
#

how

robust fulcrum
#

Hmm go to replit server

#

And ask there

#

Want link or already there?

loud junco
#

i need the link

robust fulcrum
#

Go to #python help and ping python role and ask for help

heavy folio
heavy folio
#

use an actual database like postgresql or asqlite

loud junco
robust fulcrum
#

So can't.....

heavy folio
heavy folio
loud junco
#

@heavy folio

robust fulcrum
heavy folio
#

so? poetry is not made by replit lmao

robust fulcrum
#

And maybe it can be a replit error

robust fulcrum
heavy folio
loud junco
#

ok

robust fulcrum
#

Do pip uninstall

#

Pip uninstall asyncio

mellow hound
#

im having little problem can someone help

heavy folio
#

dont ask to ask

slate swan
# loud junco

why not just a local ide, its a thousand times better.

loud junco
mellow hound
slate swan
unkempt canyonBOT
#

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

heavy folio
# loud junco

asyncio isnt installed
did you use pip to install or poetry

mellow hound
slate swan
#

the error.

mellow hound
#

ok

loud junco
slate swan
loud junco
#

packages

#

this thing

slate swan
#

nvm

loud junco
#

yes

slate swan
#

i dont think it is

loud junco
#

i did that

#

and its still haunting me

#

yes

#

and i even did kill 1

slate swan
slate swan
#

I think I do need sleep now

#

no, notice that its in site-packages folder

robust fulcrum
#

It's packager

#

And yes it's there uninstall option

#

@loud junco don't use packager to install use pip

slate swan
#

i doubt it

robust fulcrum
#

Guys is there any database which I can use in my discord bot prefix me asking cause me on mobile

slate swan
#

they use poetry

robust fulcrum
#

In discord bots

slate swan
#

sure, but dont
use motor instead

robust fulcrum
#

What motor

slate swan
#

thats the weird issue here~

#

lemme try in my venv

#
┌──(env)─(sarthak㉿kali)-[~/Documents/testing]
└─$ poetry remove asyncio
Updating dependencies
Resolving dependencies... (0.1s)

Writing lock file

Package operations: 0 installs, 0 updates, 1 removal

  • Removing asyncio (3.4.3)
``` worked for me
slate swan
#

!pip motor

unkempt canyonBOT
heavy folio
#

or even better just use postgresql or asqlite

robust fulcrum
robust fulcrum
slate swan
#

nope

robust fulcrum
#

Can we use the on Android also?

slate swan
#

you can use sqlite3 anywhere

robust fulcrum
#

@slate swan can you tell mongo is better or sqlite

slate swan
#

sql

#

in my opinion^

robust fulcrum
#

Will you help me if you know SQL cause me at now learning python and cant learn SQL together

slate swan
#
@bot.command(description='test')
async def group(ctx):
    tag = 'group'
    async with aiohttp.ClientSession() as sess:
        async with sess.get(f'https:/tag/{tag}/popular') as res:
            page = await res.text()
    tree = html.fromstring(page)
    x = random.randint(1, 25)
    link = f'https://' + tree.xpath(f"/html/body/div[2]/div[2]/div[{x}]/a/@href")[0]
      await ctx.respond(f'{link}')
``` library = py-cord
I am trying to get 1 url from a website using aiohttp but i am having error of
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: IndexError: list index out of range
#

tree.xpath is an empty list

#

i tried printing it but it errors in the link statement and even checked the xpath multiple times on the website and its correct

slate swan
honest laurel
#

I mean traceback, not just error

slate swan
#

File "C:\Users\Admin\Desktop\pythonProject\main.py", line 45, in group
link = f'https://.net' + tree.xpath(f"/html/body/div[2]/div[2]/div[{x}]/a/@href")[0]
IndexError: list index out of range
this?

honest laurel
#

Looks like that's an empty list

slate swan
honest laurel
#

You sure it's not zero indexed btw?

#

i.e. div[1] instead of div[2]

slate swan
#

help please

#

nhentai has an API, why not use it instead of webscrapping?

honest laurel
#

They don't have an api

slate swan
#

they used to have one

honest laurel
#

Not anymore

honest laurel
heady sluice
#

I'm not sure I understand the point of the name

slate swan
honest laurel
honest laurel
slate swan
honest laurel
#

So there's no api then 🤷

royal meteor
#
@app_commands.command(name = "help", description = "Displays all commands for bot.")
    async def help(self, interaction: discord.Interaction):
        embed_list = []
        for chunk in self.grouper(4, self.bot.walk_commands()):
            embed = discord.Embed(
                title = "Help & Support",
                description = f"{interaction.user} requested for support!",
                colour = interaction.user.colour
            )

            for command in chunk:
                embed.add_field(
                    name = f"`{command.name}`",
                    value = command.description,
                    inline = False
                )

            embed_list.append(embed)

        previous_button = discord.ui.Button(label = "Back", emoji = ":arrow_left:")
        next_button = discord.ui.Button(label = "Next", emoji = ":arrow_right")
        page_counter_style = discord.ButtonStyle
        initial_page = 0
        timeout = 100

        await Paginator.Simple(
            PreviousButton = previous_button,
            NextButton = next_button,
            PageCounterStyle = page_counter_style,
            InitialPage = initial_page,
            timeout = timeout).start(interaction, pages = embed_list)```

I am making a Help embed pagination but I keep getting error:

```discord.app_commands.errors.CommandInvokeError: Command 'help' raised an exception: AttributeError: 'Interaction' object has no attribute 'send'```
honest laurel
royal meteor
#

ive tried that, i dont think its the error though

honest laurel
#

I think it is 🤔

robust fulcrum
#

Guys is there any way to make per server prefix without database?

slate swan
#

🚶‍♂️ json/pickle files but thats bad

royal meteor
#

It might be the library I am using, as discord.py-pagination uses ctx not interaction?

robust fulcrum
dense coral
#

How do I make a bot uptime in Python?

robust fulcrum
#

Hmm 😢

#

Me on Android no option for me :(

slate swan
robust fulcrum
#

Oh

#

Ok

#

Will you help me make commmands means i not need all help I'll use my Brain too

slate swan
robust fulcrum
#

Like we do in replit

slate swan
#

well uptime generally means the time for which bot has been running

robust fulcrum
#

Ok