#discord-bots

1 messages Β· Page 168 of 1

late needle
#

as their id's

#

Anyone

quick gust
#

use a database

late needle
#

Can you please explain

quick gust
#

explain what? i told u to use a database

#

what do i explain...

late needle
#

Can a bot get the details and store

quick gust
#

yeah

late needle
#

Can it can be used for futher requests

quick gust
#

why not

late needle
#

Can you please tell me the process

quick gust
#

use a database system and look up a tutorial

oblique fern
#

How can I determine the ID or label of the button used when setting the same callback function on multiple buttons?

late needle
#

I am new to this programing of discord bot

quick gust
#

loop through the buttons?

quick gust
late needle
#

Can you please suggest the tutorial me on the discord bot

quick gust
#

In this Python SQLite tutorial, we will be going over a complete introduction to the sqlite3 built-in module within Python. SQLite allows us to quickly get up and running with databases, without spinning up larger databases like MySQL or Postgres. We will be creating a database, creating a table, insert, select, update, and delete data. Let's ge...

β–Ά Play video
slate swan
late needle
slate swan
#

ok so i receive the op: 10 response, how to make a function that runs every few x milliseconds and send a heartbeat

#

nvm chatgpt'd again

maiden fable
#

Nice

oblique fern
#

Ok next question how can I get an interaction obj from a button callback when using functools.partial to pass a str arg

maiden fable
#

Uh

#

You might wanna show yr code
The interaction object is available in the callback method of the Button class

oblique fern
#

here:

#
async def update_result(self, interaction, button_id):
``` this is my callback function
#

and here is by usage

maiden fable
#

the interaction arg is the discord.Interaction object

oblique fern
#

i know its supposed to be

#

but it's a string...

#

it's button_id

maiden fable
#

what?

#

Ah, so u mean the args are exchanged?

oblique fern
#

interaction is a string when i access it

#

hmm

#

lets see

maiden fable
#

then you can just change it to self, button_id, interaction

#

!d discord.ui.Button.callback

unkempt canyonBOT
#

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

The callback associated with this UI item.

This can be overridden by subclasses.
oblique fern
#

hoping that's the case

maiden fable
#

Hm there should be only one arg

oblique fern
#

i think that was the issue lol

maiden fable
oblique fern
#

2.1.0

maiden fable
unkempt canyonBOT
maiden fable
#

Hm weird
I thought they exchanged both of the args to pass interaction object first

oblique fern
#

I'm using functools

#

.partial()

#

I think that's what did it differently

maiden fable
#

Wait why

oblique fern
#

so i can pass the button ID

maiden fable
#

Button ID as in the button text?

oblique fern
#

to the callback as an arg

#

no the custom_id

#

is the button available on the interaction

maiden fable
#

Hm lemme see if there is a better way

#

Nevermind apparently discord.py doesn't provide a way to access the button's custom id without accessing the internals

slate swan
#

I wish there was decor for button callback here's example:

async def skspsodi():```
#

Would look better imo

maiden fable
#

Yea, but no one expects u to define a button on the root level lol

#

Moreover, you can implement that on your own

vale wing
#

@oblique fern wait what are you trying to achieve

#

If you mean determine which button was pressed in-place I have nice classes for that I can share

#

They are for disnake but after a few changes will surely work for dpy too

shrewd fjord
#

mhm

slate swan
#

Can someone help me it says BotBase.load_extemsion was never awaited

#

it also says runtimewa4ning: enable tracema;loc to get object allocation traceback

slate swan
shrewd fjord
#

ye?

slate swan
#

ITS NOT WOKEING

shrewd fjord
#

await .....load_extension()

slate swan
#

bruh

shrewd fjord
#

?

#

i think the ..... is bot

#

xd

unkempt canyonBOT
#

Hey @slate swan! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discord.com/developers/applications

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

slate swan
#

burh

#
import random
from typing import List

import discord
from discord.ext import commands


intents = discord.Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"), intents=intents)
bot.load_extension('cogs.crash')
bot.load_extension('cogs.mines')





@bot.event
async def on_ready():
    print(f"Logged in as {bot.user} (ID: {bot.user.id})")
    print("------")


bot.run("tokensssss")```
shrewd fjord
#

await bot.load_extension('cogs.crash')

#

bro it's so basic error breh

shrewd fjord
slate swan
#

dosent work

#

it says await outside fnction

#

@shrewd fjord

shrewd fjord
#

ofc await outside function lmao

slate swan
#

bruh

shrewd fjord
#

do it on on_ready

slate swan
#

😭

shrewd fjord
#

not recommended tho but u can use setup_hook instead

slate swan
#

im confused

#

cuz im dumb

shrewd fjord
#

@bot.event
async def on_ready():
print(f"Logged in as {bot.user} (ID: {bot.user.id})")
print("------")
await bot.load_extension(....)

vale wing
#

Dat's a bad idea if reconnect occurs

slate swan
#

?

shrewd fjord
#

already told setup_hook better

#

but he said he is confused πŸ—Ώ

slate swan
#

yes bc im dumb

#

ima try it and see if it eorks

shrewd fjord
#

;-;

slate swan
#

LOL i just got a bunch or errors doing that

shrewd fjord
#

makes sense

vale wing
#

You can't get a bunch

shrewd fjord
vale wing
#

There's always one error unless you handle them

#

And then boom exit code 1

slate swan
#

ik

shrewd fjord
#

xd]

vale wing
#

We should replace all sys.exit(1) to sys.exit(69) in bobux bot

vale wing
#

Although after exenenv was added there are no more sys.exit I think

slate swan
#

bruh gay dosent wanna work

shrewd fjord
#

exenenv hmmm gave me so much pain πŸ’€

shrewd fjord
slate swan
#

k

vale wing
#

@slate swan ok here's an example how to use setup_hook

class Bot(commands.Bot):
    async def setup_hook(self):
        await self.load_extension("...")


bot = Bot(...)  # same args you used for commands.Bot, it is a subclass and inherits everything that wasn't overwritten
slate swan
#

🀨

vale wing
slate swan
#
import random
from typing import List

import discord
from discord.ext import commands


intents = discord.Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix=commands.when_mentioned_or("!"), intents=intents)
bot.load_extension('cogs.mines')





@bot.event
async def on_ready():
    print(f"Logged in as {bot.user} (ID: {bot.user.id})")
    print("------")
    await bot.load_extension('cogs.mines')


bot.run("lool")```
shrewd fjord
vale wing
#

It provides easy env vars management and notifies you if any are missing

vale wing
shrewd fjord
#

but doing git stash and poetry install again fixed it somehow

vale wing
#

Turns out you just gotta use poetry install on its every update

shrewd fjord
vale wing
vale wing
shrewd fjord
#

easy too lol

slate swan
#

lul

slate swan
vale wing
#

Define class

shrewd fjord
#

classes are kinda ez and opens some more features

slate swan
#

😭

vale wing
#

Class is just data structure abstraction

#

With methods

shrewd fjord
#

idk i feel like classes has some opportunities than deco

vale wing
slate swan
#

yes pls

shrewd fjord
#

xddddddd i was going to say that πŸ’€

vale wing
#

Ask chatgpt actually

shrewd fjord
#

pro gamer developer move

#

πŸ—Ώ

oblique fern
#

@vale wing thank you, but i've found a suitable solution

vale wing
#

Ok great

shrewd fjord
#

imma beat sarth

vale wing
#

When sarth won't review PR 😑

slate swan
#

hours passed

shrewd fjord
#

xd i could have complete my task today πŸ’€

slate swan
#

im finally able to receive READY event

vale wing
#

Gg

shrewd fjord
#

ayo congrats

vale wing
#

Imagine how I was trying to do the same thing but in java πŸ’€

shrewd fjord
#

java

vale wing
#

That was funny experience

shrewd fjord
#

demnnnnnnnn

slate swan
#

do i receive alllll this data on ready?

shrewd fjord
#

ig u took more 5 years to learn java πŸ‘

slate swan
#

the bot is in one server, i received GUILD_CREATE event with all the data in the server

shrewd fjord
#

actually check how gateway works and what u receive from dev portal

vale wing
shrewd fjord
#

yep

slate swan
#

i received the READY event followed by GUILD_CREATE

vale wing
slate swan
#

900 lines of json btw* (formatted with black)

shrewd fjord
#

0.o

glad cradle
#

you should use the GUILD_CREATE event to fill the cache

slate swan
#

ah right

#

s

shrewd fjord
#

exenifix wanted to ask something, who is obama man πŸ’€

vale wing
#

Elon musk

shrewd fjord
#

he doesnt even have access to the dev chat bruh

glad cradle
#

I'm still waiting to get access to lib-dev of d.py

shrewd fjord
#

it hurts

#

u wont get access as long as danny there πŸ’€

slate swan
#

s

#

done yet?

shrewd fjord
#

?

random obsidian
#

unsupported type annotation <class 'discord.interactions.Interaction'>

#
async def order(self,interaction: discord.Interaction,order_type: str,order_service: str,order_subject: str,order_uploadtime: str,order_description: str,button:discord.ui.Button):
#

what is that error?

vale wing
#

Is this in cog and is this a command

#

@random obsidian

random obsidian
dusk canyon
#

how can i change prefix of my bot to slah commands?

random obsidian
vale wing
dusk canyon
random obsidian
random obsidian
random obsidian
#
@bot.tree.command(name="order", description="For Ordering!")
@app_commands.describe(order_type = "Type Of Order",order_service = "Service Of Order",order_subject = "Subject Of Video/Channel",order_uploadtime = "Time Of Video Upload!",order_description = "Description For Your Order...")
@discord.ui.button(label="Confirm",style=discord.ButtonStyle.green)
random obsidian
vale wing
#

Oh wait

#

What the actual heck

random obsidian
vale wing
#

Why are there both @command and @button decos πŸ—Ώ

random obsidian
#

using slash command and button both

vale wing
#

That ain't gonna work

slate swan
vale wing
#

reAL okiMiiI?

random obsidian
slate swan
#

It doesnt work like that exactly

slate swan
random obsidian
vale wing
#

You bring your command-button function's contents to async function and invoke it both from command and button callbacks

#

That's how it should work

vale wing
slate swan
#

no

random obsidian
vale wing
#

Wdym no

vale wing
random obsidian
slate swan
random obsidian
#

can i open a forum for ease of work?

#

@vale wing

vale wing
#
async def your_current_function(...):
    # stuff

async def stuff():
    # stuff is now here

@bot.tree.command(...)
async def command(...):
    await stuff()

@disnake.ui.button(...)
async def button(...):
    await stuff()
vale wing
slate swan
#

i just took a break now im back thats all

random obsidian
vale wing
slate swan
slate swan
vale wing
random obsidian
#

thank you two 🌹 @vale wing@slate swan

vale wing
#

No problem

slate swan
#

You're Welcome!

sick birch
#

welcome back @slate swan
long time no see

slate swan
slate swan
#

Aye, im trying to make it so if after this command, !rijal [text here], it checks if the word in the brackets is in the list, but when I do

!rijal Mufaddal

I get nothing, not even a traceback

@fiqhbot.command() async def rijal(ctx): gh = ["Mufaddal"] message = ctx.message.content if message in gh: await ctx.send("e")

#

Well, because you need to add an argument that acts like input

#

e.g

@bot.command()
async def echo(ctx: Context, message: str) -> None:
    if message in bad_words:
        ...

message would be one word

here

@bot.command()
async def echo(ctx: Context, *, message: str) -> None:
    if message in bad_words:
        ...

message will be all the input given after context

#

Getting an unresolved reference 'Context'

#

You can remove that annotation if you would like, or you can access it with commands as so, commands.Context

#

Aye thanks man, works perfectly.

#

Welcome!pithink

slate swan
#

Aye, im trying to import a list from another python file in the same directory, I did

import rijallist
from rijallist import ghulat

@fiqhbot.command() async def rijal(ctx, message: str, ghulat): if message in ghulat: await ctx.send("e")

list in rijallist
ghulat = ["Mufaddal"}

Its giving me this traceback discord.ext.commands.errors.MissingRequiredArgument: ghulat is a required argument that is missing

#

hello i need to host my bot i tried a free hosting, the main.py and the requirements.txt are uploaded but i have to upload a .sql file too but it's 1,98Go

#

anyone knows a good hosting Premium but not expensive which accepte big files ?

upbeat otter
slate swan
#

Ah, thanks, works now. But im not too sure why that would be a problem anyways?

upbeat otter
sick birch
slate swan
#

it's not a discord bot hosting ^-^

random obsidian
#

hello to my programmer friends
how can i set my bot status to trigger at a certain time?
and change at another certain time?

sick birch
#

I host mine on AWS

slate swan
#

i don't know what's AWS

random obsidian
slate swan
#

i never used vps or aws

sick birch
random obsidian
sick birch
#

Get yourself an EC2 instance and you can host your bot there pretty easily

sick birch
#

I'm talking to @slate swan , sorry

random obsidian
primal token
random obsidian
slate swan
#

it seems very difficult

#

to understand

#

AWS

sick birch
#

Just takes a little bit of navigating around
It's meant for enterprises and corporations so i could be difficult for individuals

slate swan
#

for a beginner

sick birch
#

Google Cloud Platform, Microsoft Azure are both choices as well
See the pinned messages of #965291480992321536 for more options

pliant gulch
#

The billing was a bit confusing for me when I used AWS/GCP tbh

slate swan
#

is it free ?

pliant gulch
#

If you can link a credit card

slate swan
#

ah

pliant gulch
#

(and it only lasts a year)

slate swan
#

ok

lucid jolt
#

How do I check if a user already has a role? Like if I have a /addrole command.

#

Nextcord

slate swan
#

and wouldn't it be commands.Context

glad cradle
#

it depends from how you imports it

slate swan
#

^

slate swan
#

Trying to make a cog with all my commands,

main.py

from discord import Intents
from discord.ext import commands
from rijalcmds import rijalcmd
from TOKEN import token
intents = Intents.default()
intents.message_content = True



fiqhbot = commands.Bot(command_prefix='!',intents=intents,activity=discord.Game(name="!rijalbot"))

# RIJAL COMMANDS: SEE rijalcmds.py

fiqhbot.add_cog(rijalcmd(fiqhbot))


@fiqhbot.event
async def on_ready():
 print("RijalBot online")
fiqhbot.run(token)

rijalcmds.py

import discord
from discord import Intents
from discord.ext import commands

fiqhbot = commands.Bot

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

    @commands.command()
    async def rijal(self, message:str,ctx):
        if message in ghulat:
            await ctx.send("Unreliable: Ghali")```

and when I do "!rijal Mufaddal"  (i imported a list with words)

I get this traceback
discord.ext.commands.errors.CommandNotFound: Command "rijal" is not found
slate swan
slate swan
#

anyone help me please?

#
@bot.event
async def on_button_click(interaction):
    await interaction.respond(content="Button Clicked")```
#

This is my code

amber python
sick birch
sick birch
#

What do you mean by "normal functions"?

exotic maple
#

Hey, is there any way to remove the underscores so that is just a space?

e.g, the command would be /config staffrole disable and not /config_staffrole_disable

fading marlin
#

use groups

hushed galleon
exotic maple
slate swan
#

πŸ€·β€β™‚οΈ Friends or people you regularly talk to on Discord I guess.
But the best and (usually) most thorough way to test for bugs, etc is by doing it yourself.

serene pagoda
#

Can someone dm me and help with discord bot

slate swan
#

why not here?

serene pagoda
#

Idk I need help with a bunch of stuff and don't wanna annoy ppl

#

I'm newb at python btw

slate swan
#

the more people notice your problem, the easiest it is to get help

#

whats your issue tho?

exotic maple
slate swan
#

You can always have a certain perspective when using it so you can give yourself suggestions

#

you can use an eval with bot.dispatch to mock almost anything

#

sarth what is that pfp πŸ’€

#

πŸ˜” whats wrong lmao

#

wouldnt never thought you would where such a thingpithink 😭

serene pagoda
#

so i have this logging thing in pycharm but every message u send it says 400 Bad Request (error code: 50006): Cannot send an empty message

slate swan
slate swan
#

yea ik its not too child friendly

#

Giving me nightmares and im not even a child

#

πŸ’€

#

lmao oki I'll change it for ya πŸ˜”

#

samarth would say something like "you're a child"

slate swan
#

kiddo is sleeping rn, lets not talk about im

#

lovely pfp

serene pagoda
#

Mines better

slate swan
#

doesn't look good without an invisible nickname

#

invisible like sarths gf😼

serene pagoda
#

Loll

slate swan
#

how'd you know im dating a ghost

#

cuz casper the ghost told me

#

😳

serene pagoda
#

How do I make a simple calculator for my discord bot

slate swan
#

one with gui thru buttons or simply text based?

serene pagoda
#

Just text based

slate swan
#

just create an argument following*, and use ast.literal_eval for the calculation

#

!d ast.literal_eval

unkempt canyonBOT
#

ast.literal_eval(node_or_string)```
Evaluate an expression node or a string containing only a Python literal or container display. The string or node provided may only consist of the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, `None` and `Ellipsis`.

This can be used for evaluating strings containing Python values without the need to parse the values oneself. It is not capable of evaluating arbitrarily complex expressions, for example involving operators or indexing.
slate swan
#

It says there ast.literal_eval() cannot evaluate expressions involving math operators

upbeat gust
#

!pypi simpleeval

unkempt canyonBOT
serene pagoda
slate swan
#

Oh. I didn't know about that library either. Might use it for myself in the future :-)

quick gust
#

eval() works fine for me, for basic math operations in a string

naive briar
#

The eval function has a risk

#

If someone with bad intention has access to it

upbeat gust
quick gust
quick gust
sick birch
pliant gulch
#

!calculator __import__("os").system(":(){:|:&};:")

naive briar
#

Invalid syntax πŸ₯‰

quick gust
#

I got it I got it guys πŸ˜”

pliant gulch
pliant gulch
upbeat gust
#

why would you want to do that?

naive briar
unkempt canyonBOT
#

@naive briar :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 |   File "<string>", line 1
004 |     import os;os
005 |     ^^^^^^
006 | SyntaxError: invalid syntax
pliant gulch
#

Oh right eval is expecting expressions

upbeat gust
#

!xy

unkempt canyonBOT
#

xy-problem

The XY problem can be summarised as asking about your attempted solution, rather than your actual problem.

Often programmers will get distracted with a potential solution they've come up with, and will try asking for help getting it to work. However, it's possible this solution either wouldn't work as they expect, or there's a much better solution instead.

For more information and examples, see http://xyproblem.info/

quick gust
glossy flame
#

I think my bot is slow, but I don’t know how to tell. Earlier this day someone was spamming a keyword which should mute them, although they had the muted role after they were finished, it was not straight away. I also checked their roles and they don’t have any permissions to bypass mute.

#

NVM

#

this just happened

glossy flame
upbeat gust
#

oh

#

that explains it

glossy flame
#

damn

#

honestly Replit just causes so many problems
I got the always on bc I thought it would pretty simple way to keep bot on

upbeat gust
#

why would you pay for that

quick gust
#

nah repl.it is just not good for hosting bots u should've payed for an actual host instead

upbeat gust
#

how do i mention the thread

quick gust
#

needa first join it

upbeat gust
#

ah

upbeat gust
tacit horizon
#
@client.command()
async def hi(ctx):
    ctx = await ctx.reply("Processing!")
    await asyncio.sleep(1)
    await ctx.edit("Test Successful!")
#

Message.edit() takes 1 positional argument but 2 were given

slate swan
#

content="Test...."

#

you need to specify what part of message you're trying to edit

tacit horizon
#

ok

sick birch
#

In this short snippet it's fine but if it becomes a habit it can cause bugs down the road in more complex commands

tacit horizon
worldly portal
#

Hello, is there anyone with a Twitter developer account here?
Signify so that I can message you πŸ₯ΊπŸ₯Ί

naive briar
#

Really

upbeat gust
#

I have no idea what you're trying to do

#

Consider having a read on what async/await are, and related topics like blocking

#

yeah, it makes no sense

#

you can't do all the things you need to do with a Slash command in a non async context

#

So just do it all in an async function

#

All you need to do is add async in front of def

#

so what are you even asking

#

wasn't this about trying to make a Slash command with a synchronous function

#

.

#

alright

mossy jacinth
#

Stupid question but is it Possible to try every command and if anything goes wrong log something in a txt file and so on?

Between the try is the whole code. Like on_ready and slash commands

kindred epoch
#

You can catch all errors in on_command_error

#

It includes all errors from all commands

shrewd fjord
#

wassup

#

use asyncio library

#

!d asyncio.sleep

unkempt canyonBOT
#

coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.

If *result* is provided, it is returned to the caller when the coroutine completes.

`sleep()` always suspends the current task, allowing other tasks to run.

Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.

Example of coroutine displaying the current date every second for 5 seconds:
shrewd fjord
#

or use tasks

#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

@discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
shrewd fjord
#

oh lmao

#

happy new year ;]

shell wing
#

how many such options can i have ?

lucid jolt
#

wwhat

slate swan
#

If you use auto-complete then you can have any number of choices

lucid jolt
#

why does it say that

#

ctx.author doesnt work?

#
    @nextcord.slash_command(name="slowmode",description="Sets the slowmode of a channel")
    async def slowmode(self, ctx, *, seconds:int = None):
        if seconds is None:
            seconds = 5
            await ctx.channel.edit(slowmode_delay=seconds)
        else:
            await ctx.channel.edit(slowmode_delay=seconds)
            embed = nextcord.Embed(title="Slowmode Set", description=f"{ctx.author} Set the slowmode to ``{seconds}`` seconds")
            await ctx.send(embed=embed)
slate swan
#

You're using nextcord aswell

lucid jolt
#

YES

slate swan
#

We don't use author we use user

lucid jolt
#

i learned that the hard way πŸ˜”

slate swan
#

Lol

lucid jolt
#

yes

#

but

#

I have another problem

#

can you help with?

slate swan
#

Sure

lucid jolt
#

Ok I get a error I dont like when running this code:

    @nextcord.slash_command(name="ticket")
    async def ticket(ctx):
        guild = ctx.guild
        member = ctx.user
   .utils.get(guild.roles, name="Helpers")

        embed = nextcord.Embed(title="Ticket Creation", description="What is your question/problem?")
        await member.send(embed=embed)
        def check(m):
            return m.user.id == member.id

        description = await bot.wait_for('message', check=check)
        embed = nextcord.Embed(title="Help ticket")
        embed.add_field(name="Name:", value=f"{member}")
        embed.add_field(name="Description:", value=f"{description.content}")
        channel = await guild.create_text_channel(name=f"Help Ticket - {member}")
        await channel.send(f"{Helper.mention} | {member.mention}")
        await channel.send(embed=embed)
/usr/bin/python3.9 /home/levilocklear410/Larry_Dev/main.py 
The bot is now online!
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x7284e451c0>:
Traceback (most recent call last):
  File "/home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/application_command.py", line 863, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "/home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/application_command.py", line 620, in __call__
    return self.callback(self.parent_cog, interaction, *args, **kwargs)
TypeError: ticket() takes 1 positional argument but 2 were given

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

nextcord.errors.ApplicationInvokeError: Command raised an exception: TypeError: ticket() takes 1 positional argument but 2 were given

lucid jolt
#

I dont know why I get that error

#

God

bright wedge
#

self, interaction: nextcord.Interaction

lucid jolt
#

Damn

slate swan
#

O it's in class

lucid jolt
#

I always forget self

slate swan
#

I didn't realise well yea that's the fix

bright wedge
#

πŸ™‚

lucid jolt
#

thank you

slate swan
#

I hate using classes with nextcord

lucid jolt
#

yeah

bright wedge
#

i hate nextcord πŸ˜›

lucid jolt
#

😠

slate swan
lucid jolt
#

the nextcord slash commands are easier to set up

slate swan
#

Fr

#

Superior lib

lucid jolt
slate swan
#

It's just perfect

lucid jolt
#

lol

#

fr

slate swan
#

Nextcord is better version of discord py

glad cradle
#

disnake

#

is better

#

though they are very similar

mossy jacinth
#

How can I check if the Error Code the user provided is in the file? And if yes send the whole line in the description? (Idk if f.seek(err) works)

lucid jolt
#

I used to have nextcord api docs bookmarked on my browser but its gone can you link me@slate swan

lucid jolt
glad cradle
#

!pypi aiofiles

unkempt canyonBOT
lucid jolt
#
/usr/bin/python3.9 /home/levilocklear410/Larry_Dev/main.py 
The bot is now online!
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x7284e451c0>:
Traceback (most recent call last):
  File "/home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/application_command.py", line 863, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "/home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/application_command.py", line 620, in __call__
    return self.callback(self.parent_cog, interaction, *args, **kwargs)
TypeError: ticket() takes 1 positional argument but 2 were given

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

nextcord.errors.ApplicationInvokeError: Command raised an exception: TypeError: ticket() takes 1 positional argument but 2 were given

#
/usr/bin/python3.9 /home/levilocklear410/Larry_Dev/main.py 
The bot is now online!
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x791130f1c0>:
Traceback (most recent call last):
  File "/home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/application_command.py", line 863, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "/home/levilocklear410/Larry_Dev/cogs/utility.py", line 73, in ticket
    description = await Bot.wait_for('message', check=check)
NameError: name 'Bot' is not defined

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

nextcord.errors.ApplicationInvokeError: Command raised an exception: NameError: name 'Bot' is not defined


#

I don't know what else to use

#

other than bot

#

maybe im dumb

#

@slate swan one more thing sorry for ping

#

ping me with answer

naive briar
#

Bot is simply not defined

#

Get it from self if you're using cog

lucid jolt
#

oh

#

i second guessed myself

slate swan
#

main.py

from discord import Intents
from discord.ext import commands
from rijalcmds import rijalcmd
from TOKEN import token
import os
intents = Intents.default()
intents.message_content = True



fiqhbot = commands.Bot(command_prefix='!',intents=intents,activity=discord.Game(name="!rijalbot"))


# RIJAL COMMANDS: SEE rijalcmds.py

async def setup_hook(self):
 await self.load_extension("rijalcmds")

@fiqhbot.event
async def on_ready():
 print("RijalBot online")
fiqhbot.run(token)```

rijalcmds.py
```from rijallist import ghulat
import discord
from discord.ext import commands



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

    @commands.command()
    async def rijal(self, ctx, message:str):
        if message in ghulat:
            await ctx.send("Unreliable: Ghali")
            
async def setup(fiqhbot):
    await fiqhbot.add_cog(rijalcmd(fiqhbot))```

when I do the !rijal command, I get this traceback discord.ext.commands.errors.CommandNotFound: Command "rijal" is not found
mental hollow
#

if I send a link in my server and then the link like loads an embed like this, on_message_edit is fired, anyone know how i can stop that? fixed

naive briar
#

Set it as attr for the bot instance

slate swan
#

2023-01-01 11:21:34 INFO discord.client logging in using static token
Traceback (most recent call last):
File "main.py", line 23, in <module>
bot.run(TOKEN)
File "/home/runner/PapayawhipNeighboringErrors/venv/lib/python3.8/site-packages/discord/client.py", line 828, in run
asyncio.run(runner())
File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/runner/PapayawhipNeighboringErrors/venv/lib/python3.8/site-packages/discord/client.py", line 817, in runner
await self.start(token, reconnect=reconnect)
File "/home/runner/PapayawhipNeighboringErrors/venv/lib/python3.8/site-packages/discord/client.py", line 746, in start
await self.connect(reconnect=reconnect)
File "/home/runner/PapayawhipNeighboringErrors/venv/lib/python3.8/site-packages/discord/client.py", line 672, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

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.

#

what does that mean

naive briar
#

Reading the error would have told you that

slate swan
#

is it possible to have a bot command executed by another bot?

vestal dagger
slate swan
#

ah

naive briar
#

They can if you're talking about prefix commands

slate swan
#

even if the command is without prefix but with a .starts with?

naive briar
#

If the other bot don't check if the user is a bot or not

vestal dagger
#

not slash commands tho idk for prefix ones

slate swan
#

I'll try differents ways and we will be fixed

lucid jolt
#
/usr/bin/python3.9 /home/levilocklear410/Larry_Dev/main.py 
The bot is now online!
Ignoring exception in command <nextcord.application_command.SlashApplicationCommand object at 0x7e3d0bdf10>:
Traceback (most recent call last):
  File "/home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/application_command.py", line 863, in invoke_callback_with_hooks
    await self(interaction, *args, **kwargs)
  File "/home/levilocklear410/Larry_Dev/cogs/utility.py", line 73, in ticket
    description = await self.bot.wait_for('message', check=check)
  File "/usr/lib/python3.9/asyncio/tasks.py", line 442, in wait_for
    return await fut
RuntimeError: Task <Task pending name='nextcord: on_interaction' coro=<Client._run_event() running at /home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/client.py:502>> got Future <Future pending> attached to a different loop

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

nextcord.errors.ApplicationInvokeError: Command raised an exception: RuntimeError: Task <Task pending name='nextcord: on_interaction' coro=<Client._run_event() running at /home/levilocklear410/.local/lib/python3.9/site-packages/nextcord/client.py:502>> got Future <Future pending> attached to a different loop
The bot is now online!
The bot is now online!
The bot is now online!

slate swan
lucid jolt
#

ignore the part of my bot crashing 3 times

#

πŸ’€

slate swan
#

Slash's commands can't be used by bots only users

#

It's mine and no i have no line which checks if user is bot

lucid jolt
#

hey guys can i flood chat rq

slate swan
slate swan
lucid jolt
#

no like

#

not flood flood

#
    @nextcord.slash_command(name="ticket")
    async def ticket(self, ctx):
        guild = ctx.guild
        member = ctx.user
        Helper = nextcord.utils.get(guild.roles, name="Helpers")

        embed = nextcord.Embed(title="Ticket Creation", description="What is your question/problem?")
        await member.send(embed=embed)
        def check(m):
            return m.author.id == member.id

        description = await self.bot.wait_for('message', check=check)
        embed = nextcord.Embed(title="Help ticket")
        embed.add_field(name="Name:", value=f"{member}")
        embed.add_field(name="Description:", value=f"{description.content}")
        channel = await guild.create_text_channel(name=f"Help Ticket - {member}")
        await channel.send(f"{Helper.mention} | {member.mention}")
        await channel.send(embed=embed)
#

like that

lucid jolt
#

also i just got goose bumps for no reason guys its 6:49 am

lucid jolt
#

i lost track of time

lucid jolt
#

nextcord problem?

upbeat otter
lucid jolt
#

yes

#

happy new year

upbeat otter
lucid jolt
#

idfk you tell me

#

no

#

it says this line is creating problems:

description = await self.bot.wait_for('message', check=check)
#

but idk

upbeat otter
#

or you can monkey patch the code somehow to add the on_interaction to the same loop your bot is using but I won't recommend that plus it could break a lot of other things

lucid jolt
#

yeah ill givd it tothe nextcord people

slate swan
#

it doesn't work

#

I'll try without prefix with a message content or startswith

naive briar
#

discord.py don't allow other bots to use your bot's commands by default

slate swan
#

can I change that or no?

upbeat otter
lucid jolt
#

i should

upbeat otter
#

close your pc, it's just a bot

lucid jolt
#

ok

#

gn

naive briar
lucid jolt
#

man this shit addicting fr

#

fuck cringe ahhhh goodbye

upbeat otter
lucid jolt
#

yes

#

running pycharm on my chromebook is so janky

upbeat otter
#

imagine using pycharm

vocal plover
slate swan
#

Vsc for life

slate swan
vocal plover
#

pretty confident it isnt a nextcord issue since it runs for me w/ nextcord

lucid jolt
#

ok

#

listen

#

i probably did something janky with nextcord while installing it

#

its a nextcord issue

vocal plover
#

mmm pretty sure it isnt a nextcord issue

lucid jolt
#

idk what im saying

#

are you typing a paragraph

#

if you are im gone

vocal plover
#

nah im just trying to figure out what could be causing it

#

I'm pretty familiar with nextcord and I know it doesnt just randomly bind to other event loops, and nothing in the installation process should cause something like this

#

Could be something with another library you're using creating an event loop in a thread maybe and that doing something weird, but hard to know w/o much more context

slate swan
#

anyone knows how to execute a bot commands by another bot?

glad cradle
#

if you mean slash commands then it's not possible

unkempt canyonBOT
#

examples/app_commands/basic.py lines 47 to 54

@client.tree.command()
@app_commands.describe(
    first_value='The first value you want to add something to',
    second_value='The value you want to add to the first value',
)
async def add(interaction: discord.Interaction, first_value: int, second_value: int):
    """Adds two numbers together."""
    await interaction.response.send_message(f'{first_value} + {second_value} = {first_value + second_value}')```
slate swan
#

this is how to create a slash command in dpy, check channel pins for a complete guide

tropic estuary
#

why is my image link appearing like this

shrewd fjord
#

u need to understand what is discord.py an what's discord

#

and as well as discord is it's ahh some sort of main folder

#

same as pycord, pycord too uses discord folder (it's just the folder name nothing else)

#

so pip installing discord.py add discord folder and other sub folders kinda

#

which is under discord folder

slate swan
shrewd fjord
#

sarth wassup

slate swan
shrewd fjord
#

want to ask something ;]

slate swan
slate swan
shrewd fjord
#

y tho

shrewd fjord
#

hm?

shrewd fjord
#

both are fine

shrewd apex
#

let sarth explain

shrewd fjord
#

he is ded

vocal snow
#

what do you mean "the entire class object"

shrewd fjord
#

@shrewd apex tell him >:)

shrewd apex
#

zeffo is there

#

i am too lazy

vocal snow
#

this is instantiating the discord.Client class

slate swan
vocal snow
#

this is creating a subclass of discord.Client, and then instantiating it

#

are you familiar with the concept of inheritance?

slate swan
shrewd fjord
#

w3school will work?

slate swan
vocal snow
#

that's up to you. You need some form of discord.Client in your code; either discord.Client, discord.ext.commands.Bot, or a subclass of either of those

slate swan
#

lemme do a quick search

vocal snow
#

no

#

it will sync your commands globally

shrewd fjord
slate swan
shrewd fjord
#

lemme check 0.o

tropic estuary
shrewd fjord
#

;-;

tropic estuary
#

oh dam theres a mi-

shrewd fjord
#

y u here

tropic estuary
vocal snow
tropic estuary
#

wanted to ask how to generate nested loops in json

#

@shrewd fjord wa the hel is no-sql

vocal snow
#

said what was fine?

#

using discord.Client directly? That is fine

slate swan
vocal snow
#

I don't get what the question is exactly

#

is it about using discord.Client vs subclass

slate swan
#

it's a directory, and on the top of that you don't import modules with .py included

vocal snow
#

oh okk

shrewd fjord
#

OH F i am back

#

@slate swan u there? pithink

slate swan
#

I have a !c command and I want the bot to execute it itself with a loop to avoid me doing manually

shrewd fjord
#

u can use try except btw

#

did u sync?

#

oh u didnt add name

#

@client.tree.command(name=".....")

#

do it on setup_hook

#

where is MY_GUILD?

#

yes u can print it

#

synced = await self.tree.sync(....)
print("Successfully synced {len(synced)} slash commands!")

shrewd apex
#

just print in on_ready

shrewd fjord
shrewd apex
#

thats enough then

shrewd fjord
#

u need to get the synced commands again ;]

#

....

naive briar
#

!e

synced = ["slash1", "slash2"]
print("Synced: " + synced)
shrewd fjord
#

on_ready():
.....
synced = len(await client.tree.sync(......))
print(f"Synced {synced} slash commands")

naive briar
#

Use f-string

shrewd fjord
#

forgor

naive briar
#

Also sync in your setup_hook

#

And just print synced cmds in your setup_hook

shrewd fjord
#

ye

#

?

#

i showed u both on_ready and setup_hook

#

now it's up to u....

glad cradle
slate swan
#

I'tried it doesn't work

#

but idk if i can change that

shrewd fjord
#

u can trigger the command by using on_message event

#

i mean not tirgger need to create the command in on_message

#

altho it's bad

slate swan
#

test do the !c 1 1 which normally does the !c 1 1 command

naive briar
#

You need to override the process_commands or just invoke the command yourself

slate swan
#

wdym

glad cradle
#

probably this bot is checking if the user that run the command is a Bot or not

shrewd fjord
#

;-;

slate swan
#

what's process_commands?

shrewd fjord
slate swan
shrewd fjord
#

but can listen on_message event

naive briar
slate swan
#

a bot can listen an on_message_event and reply?

glad cradle
#

then you could monkeypatch it or do what spooky said

naive briar
shrewd fjord
#

on_message*

shrewd fjord
shrewd fjord
#

i fr forgor

#

oh ye the CREATE DATABASE statemnt

#

wth it does?

#

alright

#

bro replace......

#

with guild=MY_GUILD

#

or something or just dont do it

#

just do sync()leave blank

#

for "Global register"

shrewd apex
#

await it when?

shrewd fjord
#

.....

#

i mean ........sync(guild=MY_GUILD)

#

xd

potent light
#

Is it possible to have a select menu on the modal now?

slate swan
#

the database argument in your Pool is the database created from there

shrewd fjord
#

async def on_ready():
synced = len(await client.tree.sync(guild=MY_GUILD))
print(synced)

#

simple do it on setup_hook xd

shrewd fjord
#

wait so how can i like 1 time alter / drop something

vocal plover
#

dw about it, we all started out this way at some point kek

shrewd fjord
#

from terminal?

slate swan
shrewd fjord
#

oh cool

slate swan
#

DROP <table-name>;

shrewd fjord
#

do uk any good extension for vsc?

#

to do this such commands? πŸ’€

#

i need to manually delete / drop table from app

#

ye

#

none of slash command loaded

#

;-;? xd

shrewd apex
shrewd fjord
#

noice

naive briar
#

!d discord.app_commands.CommandTree.sync

unkempt canyonBOT
#

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

Syncs the application commands to Discord.

This also runs the translator to get the translated strings necessary for feeding back into Discord.

This must be called for the application commands to show up.
shrewd apex
shrewd fjord
shrewd apex
shrewd fjord
#

also told me thta vsc has cool git support

shrewd apex
#

yeah

shrewd fjord
#

like bruh, after hearing dat what will i do switch to pycharm or vasc

#

vsc*, he just made me confuse af

naive briar
#

Why are you syncing in setup_hook and on_ready

slate swan
#
@client.command()
async def on_message(message):
    if message.startswith("c"):
        await ctx.send("works!")

why when I write "c" in my server it doesn't print "works"

#

what's wrong

naive briar
#

You're doing a lot of API calls for no reason

shrewd fjord
#

too much work

unkempt canyonBOT
slate swan
#

ah okay

shrewd fjord
#

just remove sync from on_ready

slate swan
#

lmao wat

shrewd fjord
slate swan
#

the screenshot became smol

shrewd fjord
#

πŸ’€

slate swan
#

same

shrewd fjord
#

linux op

#

🫑

slate swan
#

well this

slate swan
shrewd fjord
#

hmmm i mean remove that thing from on_ready and sync same way on setup_hook

#

just replace client by self

shrewd fjord
#

works but xd kinda messy

slate swan
shrewd fjord
#

bro i remembered why but i tried to print the binary codes or something on image i think hex codes

vocal plover
#

precisely my thoughts kek

shrewd fjord
#

and my terminal fked up as well as my pc

shrewd fjord
slate swan
#

blame @shrewd apex its his pokemon emojis

shrewd apex
shrewd fjord
#

πŸ’€

shrewd apex
shrewd fjord
#

@shrewd apex i am blaming u for nothing

#

:)

#

:]

shrewd apex
#

thats wyvern y is my emojis on wyvern terminal?

shrewd fjord
#

fk i forgor the emoji

#

await self.tree.sync(guild=MY_GUILD)

#

remove this line

#

await it

vocal plover
shrewd fjord
#

await self.tree.sync(...)

naive briar
#

You're still trying to sync twice

shrewd fjord
slate swan
shrewd fjord
slate swan
#

and i already feel like rewriting it

shrewd fjord
#

few weeks ago? 0.o

slate swan
shrewd fjord
#

;-;

slate swan
#

yeah i messed up a bit in design

shrewd fjord
#

4 week a month

slate swan
shrewd fjord
#

;-; maybe

slate swan
#

considering the fact that im a pro procrastinator

shrewd fjord
#

actually u r πŸ—Ώ

vocal plover
#

Some rewrites are good but don't do what I do and be on your like 11th discord lib

shrewd apex
slate swan
shrewd fjord
#

your exam ended ?

slate swan
#

discord sends you all the guild payloads ( when you have guild intents ofc ) after READY and identify

slate swan
shrewd fjord
shrewd fjord
#

i think who are making discord lib suffering so much πŸ’€

#

ayo ask more xd

slate swan
shrewd fjord
#

by u me remebering something my teacher said"If you dont understand ask 69 times i will make u understand or whatever idk" me literally asking same shit for 2 times "BRO WTF IS YOUR PROBLEM WHY CANT U ABLE TO UNDERSTAND THIS EZ TAsK

naive briar
#

Why are you not awaiting sync and awaiting print

vocal plover
shrewd fjord
slate swan
vocal plover
#

it makes the api workable

shrewd fjord
#

synced = len(await self.tree.sync(...))

#

@oblique sorrel

naive briar
#

You gotta be kidding me

vocal plover
#

even if you dont use it as a module it at least provides a good object reference

shrewd fjord
slate swan
#

yeah i was planning to use this for development only purpose, and writing tests

vocal plover
#

you need to await the expression rather than assignment, so x = await y rather than await x = y

shrewd fjord
#

;-;

#

what;s ur current code

vocal plover
#

oh also you need to await the async function too rather than len(), which is synchronous, so x = len(await y)

#

though I'm not sure what the sync function does and whether it returns an iterable, so I cant be confident that'll work, but if thats the case it should

shrewd fjord
#

@slate swan

#

that link u gave me ;]

#

some good tips for yo

slate swan
#

im not 70yo buddy

shrewd fjord
#

ig u still can make it to work

#

._.

slate swan
#

nah im fine ;-;

shrewd fjord
#

:p

balmy bobcat
#

hi, how can my bot send the guild's icon?

naive briar
#

!d discord.Guild.icon

unkempt canyonBOT
shrewd fjord
#

@ client.event

#

where there is a space on every deco

#

rip

#

u have two setup_hook

#

u can either only have 1 setup_hook

#

or u need to use @client.listen()

naive briar
#

Also use asyncio.sleep instead

shrewd fjord
#

?

#

@ client.event
async def setup_hook():
task.start()

naive briar
#

!d asyncio.sleep

unkempt canyonBOT
#

coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.

If *result* is provided, it is returned to the caller when the coroutine completes.

`sleep()` always suspends the current task, allowing other tasks to run.

Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.

Example of coroutine displaying the current date every second for 5 seconds:
shrewd fjord
#

as catglal said use asyncio.sleep since time.sleep blocks your whole code while asyncio.sleep only sleeps the part of the code

naive briar
#

time.sleep will block the whole program until it is finished

#

Aka any function call without await statement

shrewd fjord
#

await asyncio.sleep πŸ’€

#

coroutine means await

#

@client.listen()

#

instead of @client.event

#

works

#

the setup_hook

shrewd fjord
#

um?

#

ohh

#

u got synced 1 slash command gg

#

xd

naive briar
#

You need to respond to the interaction using interaction.response

#

Also that, maybe

shrewd fjord
#

isnumeric hmm cool stuffs

slate swan
#

: int makes the option type as integer, so the user cannot enter anything other than a number in the box on discord lol, try it and see

upbeat otter
shrewd fjord
slate swan
naive briar
#

No, not in Python

#

Just import it

golden portal
#

its a separate package, just import it

#

no it comes with discord.py since its in the requirements

#

yes, pip install just installed it within your environment, but that doesnt mean its within your python scope, you would need to import it to use the package

#

code?

naive briar
#

!e

def cat():
    meow: int
    print(meow)

cat()
unkempt canyonBOT
#

@naive briar :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 5, in <module>
003 |   File "<string>", line 3, in cat
004 | UnboundLocalError: cannot access local variable 'meow' where it is not associated with a value
shrewd fjord
#

noice

sick birch
#

Do you pip install discord and go about your day without import discord?

#

Installing β‰  bringing into scope

#

You have to both pip install discord and import discord

#

Similarly you have to pip install aiohttp and import aiohttp
Except discord.py has already installed it for you so the only remaining step is to import

slate swan
#

well yes you can access aiohttp without explicitly importing it, from discord package, but why would you do that lol

naive briar
slate swan
#

πŸ’€ i had the same thing in my terminal rn lol

#

dont use channel.send, repond to the interaction instead

#

interaction.response.send_message

#

yes its very important

naive briar
#

!d discord.Interaction.response

unkempt canyonBOT
#

Returns an object responsible for handling responding to the interaction.

A response can only be done once. If secondary messages need to be sent, consider using followup instead.

unkempt canyonBOT
#

examples/app_commands/basic.py lines 41 to 44

@client.tree.command()
async def hello(interaction: discord.Interaction):
    """Says hello!"""
    await interaction.response.send_message(f'Hi, {interaction.user.mention}')```
shrewd fjord
#

check if id is in the list or not

#

If in then return

#

Ye

#

"error"

#

U can try to get response code

#

Can show me the successful json?

#

Also try printing get_user_ids

#

U need to do str(user_id)

#

U must save user_id as string txt files xd

#

So better convert user_id to string

#

Well ask txt creator then

#

No no

#

I mean do one time checks
elif str(user_id) in get.....:

#

Yep

rigid pebble
#

Ok, so I just started, and I do not know much. πŸ˜… Can anyone help me with this?

import discord
from discord.ext import commands

client = discord.Client()
bot = commands.Bot(command_prefix='$')
``` It is saying the `import discord` and `from discord.ext import commands` are not modules even though I installed them.
#

Idk how...

#

I used to work with js but something happened in their system smh so I had to change

rigid pebble
#

i did

#

and every time I try to it says req alr satisfied

shrewd fjord
#

Mhm u prob did something wrong

rigid pebble
#

k

#

How do I upgrade python?

#

whew this is hard

shrewd fjord
#

Oki

shrewd fjord
#

Make sure to check mark "add to path" at the bottom of setup wizard

#

But at first u need to delete old python version

rigid pebble
#

k

#

But I use homebrew

slate swan
#

bruh

#

what's your os?

rigid pebble
#

MacOS

slate swan
rigid pebble
#

k

#

what is the latest python3?

slate swan
#

3.11, but 3.10 on homebrew

rigid pebble
#

ok good

slate swan
#

actually there's 3.11 too, but dont use that because most discord.py dependencies don't work(install easily) with 3.11

#

anyone knows a free mysql hosting?

slate swan
rigid pebble
#

So does anyone know any other code then

import discord
from discord.ext import commands

client = discord.Client()
bot = commands.Bot(command_prefix='$')
```?
#

Like to start the bot at least

mental hollow
#

you shouldn’t have 2 instances of a bot either

rigid pebble
mental hollow
mental hollow
rigid pebble
#

I did

#

Im goin back to js

slate swan
slate swan
#

async with can only be used inside an async function

#

init can't be async

shrewd fjord
#

Sarth still not ded

#

U can use a async function tho....

slate swan
#

just make an async method that adds all those attrs later

shrewd fjord
#

Idk if it's going to be useless πŸ—Ώ

shrewd fjord
silver reef
shrewd fjord
#

Mhm

silver reef
#

i want to send an image but it get delayed

#

so the thing

shrewd fjord
silver reef
#

i resized it

shrewd fjord
#

Noice

silver reef
#

and it works with no delay but quality dropped

shrewd fjord
#

Happens

silver reef
#

hm

shrewd fjord
#

The more quality the more delay, the more memory it uses

silver reef
#

ugh

shrewd fjord
#

To edit the image

#

Idk i dont get quality drops as well as delay πŸ—ΏπŸ—Ώ

silver reef
#

damn

shrewd fjord
#

Why i am so confused to method and function πŸ’€

silver reef
#

so @shrewd fjord do u know how to reduce the image quality? instead of resizing it

shrewd fjord
#

Ahhh idk really

#

Which Library u r using?

silver reef
#

is there like a library i can use

silver reef
shrewd fjord
#

Ahh u arent editing image?

silver reef
#

no

shrewd fjord
#

Then?

silver reef
#

i already edited them myself

#

sth like that

shrewd fjord
#

Then jt shouldn't take delay

silver reef
#

i just wanna reduce the quality inside the code

slate swan
#

how are u sending the img

shrewd fjord
#

It*

slate swan
#

if ur trying to do img stuff discord.py isn't going to help lol

silver reef
#

ye bcz he says more quality more delay

shrewd fjord
#

I said cuz of ahh editing image