#discord-bots

1 messages · Page 939 of 1

slate swan
#

what languages u know?

hearty dust
#

hindi

slate swan
#

alr i'm cool with it

hearty dust
#

really

dense swallow
#

does anyone know whats this causing this error?

#

only happens when i try running the bot locally
edit: re-installing the library worked

gaunt ice
#

i made this tts command

#

it worked fine but suddenlly it gave m ethis error

latent anchor
#

i did a cog and it shows this error

#

NoEntryPointError: Extension 'cogs.basic' has no 'setup' function.

#

what does that mean and how do i fix it

spring obsidian
#

add this

#
def setup(bot:commands.Boy):
   bot.load_extestion(Basic)
#

which api should I use for covid data

latent anchor
#

what about this one

def setup(bot):
  bot.add_cog(mod(bot))
gaunt ice
#

ohhh i understand now i think i called api too much times

#

its giving me 404 error lol

latent anchor
#

so that also works?

spring obsidian
#

yup

latent anchor
#

but it still shows error

#

ive been using that before but when i run it today it shows that

formal fern
#

hello, is it possible to run command on_ready?

spring flax
slate swan
spring flax
#

yeah ^ i don't know why you'd want to do it on_ready

#

i mean unless you wait wait_until_ready() or something i guess

#

!d discord.ext.commands.Bot.invoke

unkempt canyonBOT
#

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

Invokes the command given under the invocation context and handles all the internal event dispatch mechanisms.

Changed in version 2.0: `ctx` parameter is now positional-only.
spring flax
slate swan
#

the event itself waits for the bot to ready up

#

dunno why you would want a wait_until_ready

formal fern
slate swan
formal fern
supple crescent
#
 
@bot.command(name="start")
async def start(ctx):
    guild = ctx.guild
    admin_role =  guild.get_role(945847161596297277)
    overwrites = {
        guild.default_role: discord.PermissionOverwrite(view_channel=False),
        ctx.author: discord.PermissionOverwrite(view_channel=True),
        admin_role: discord.PermissionOverwrite(view_channel=True),
        guild.me: discord.PermissionOverwrite(view_channel=True)
    }
    channel1 = await guild.create_text_channel(f"private-channel{ctx.author}", overwrites=overwrites) 
    await channel1.send("Hi! for help on how to order, do !help", mention_author=True)   
    await ctx.message.delete()
    ```
command start not found. HUH?
upbeat gust
supple crescent
#

ill send the fukll error

#

Ignoring exception in command start:
Traceback (most recent call last):
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\trent\Desktop\DiscordBot\discordbot.py", line 147, in start
channel1 = await guild.create_text_channel(f"private-channel{ctx.author}", overwrites=overwrites)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\guild.py", line 948, in create_text_channel
data = await self._create_channel(name, overwrites, ChannelType.text, category, reason=reason, **options)
File "C:\Users\trent\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\guild.py", line 844, in _create_channel
'id': target.id
AttributeError: 'NoneType' object has no attribute 'id'

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

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

upbeat gust
#

well

#

thast not a not found error is it?

supple crescent
#

before it was this 🗿
discord.ext.commands.errors.CommandNotFound: Command "start'" is not found

#

whatever

upbeat gust
#

check if its none

supple crescent
#

wait ok

supple crescent
#

idk why tho

#

its the only thing ive changed

#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

supple crescent
narrow grail
#

how to change the avatar of my bot?

vale wing
#

From the bot?

#

!d discord.ClientUser.edit

unkempt canyonBOT
#

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

Edits the current profile of the client.

Note

To upload an avatar, a [bytes-like object](https://docs.python.org/3/glossary.html#term-bytes-like-object "(in Python v3.10)") must be passed in that represents the image being uploaded. If this is done through a file then the file must be opened via `open('some_filename', 'rb')` and the [bytes-like object](https://docs.python.org/3/glossary.html#term-bytes-like-object "(in Python v3.10)") is given through the use of `fp.read()`.

The only image formats supported for uploading is JPEG and PNG.

Changed in version 2.0: The edit is no longer in-place, instead the newly edited client user is returned...
vale wing
#

Afaik it's accessible from

#

!d discord.ext.commands.Bot.user

unkempt canyonBOT
supple crescent
gaunt ice
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | AttributeError: 'NoneType' object has no attribute 'id'
slate swan
#

is what you're trying to do

supple crescent
#

Non rly, I’m trying to make it so it creates a channel that allows the admin and creator of the channel to be the only ones that see it

slate swan
#

what is target exactly?

supple crescent
#

For what part?

narrow grail
slim ibex
#

🗿

slate swan
gaunt ice
supple crescent
#

The target is the bot, allowing it to see the channel @slate swan

slate swan
slim ibex
gaunt ice
final iron
slate swan
#

yeah i made it singular

slate swan
final iron
#

🗿

slate swan
#

how do you define target

supple crescent
slate swan
narrow grail
cold sonnet
supple crescent
#

The only thing I added was changing some text into embeds, would that mess with the code here is an example
’’’py

bot.command(name = 'orderhelp')
async def ping(ctx: commands.Context):
channel = ctx.channel
emb=discord.Embed(title="Please list your order like this for the least confusion!",description=f"Poster(10 ref) or pfp(5 ref) \n Character \n Cosmetics \n Unusuals(if wanted +1 ref per) \n Weapons \n And any other requests! \n WHEN READY USE !ORDER")
await channel.send(embed=emb)
’’’

#

I can’t do it on mobile

supple crescent
cold sonnet
#

I don't see a problem

#

am I blind

#

no @ in the decorator

supple crescent
#

Me?

cold sonnet
#

yes

supple crescent
#

Ohh

gaunt ice
#

oof

supple crescent
#

THAT MAKES SENCE SINCE I BASED IT OFF A WELCOME EMBED!

slate swan
#
@bot.event
async def on_reaction_add(reaction,user):
  print("aaaaa")
supple crescent
#

Ily

slate swan
#

Im using that rn but it doest print aaaa

cold sonnet
#

try on_raw_reaction_add with payload param

slate swan
#

just payload?

cold sonnet
#

yes

slate swan
#

or payload,user

#

okay thanks

cold sonnet
#

no

#

just payload

slate swan
#

hey, idk if u remember me from yesterday

#
with open("/root/Textfiles/ongoing.txt", "r") as f:
    if f.read().count(str(ctx.author)) > 1:
        await ctx.send("**__Error__**\nMax timer limit reached.")                
        return
#

this one didnt work

#

i did an else statement, so if its not over 1 it still allows it, and it did allow it

slim ibex
#

Are you using the text file as a database?

gaunt ice
#

json as database 💀

slate swan
slim ibex
#

ok, but I would try to switch to a proper database in the future

slate swan
#

in the future, maybe, im not good enough for that

vale wing
#

You should do it asap cuz all of your issues are because of this

slate swan
#

eh ill try to figure it out, but ik im not capable of switching yet

slim ibex
#

well with that attitude, you aren’t

#

if you don’t go out of your comfort zone, you’ll never get better

vale wing
slate swan
#

nah, this is not the time for motivation, i just know i cant.

#

im not trying to get pity or something lol

vale wing
#

SQL is easy for basic functional

swift imp
#

How to check if "someone" is a bot?

slate swan
slate swan
slim ibex
#

or if not your_user_or_member_param: to handle when the user isn't a bot

slate swan
#

oh he meant it that way

swift imp
#

no no no, I need to check if the members are a bot

swift imp
#

A

#

know

#

I tried this and I got a strange error```py
@bot.command()
async def check(ctx, member: discord.Member = None):
if member is None:
await ctx.send('ping @member')
else:
if member.bot == True:
await ctx.send('Yes')
else:
await ctx.send('No')

Member "id of bot" not found
#

If I try to test the bot, then there will be this error. In other cases, the code works

slim ibex
#

don’t use equality

#

if member is member.bot should work

swift imp
#

okay

placid skiff
slim ibex
#

is and == aren’t the same thing

placid skiff
#

Yup but if member is None it will not become a member object only because you added is

#

the type converter is not converting the parameter to a member object

slim ibex
#

well yeah

placid skiff
#

that's all

swift imp
#

Same error (or I misunderstood something)

#
.   if member is None:
        await ctx.send('ping @member')
    else:
        if member.bot:
            await ctx.send('Yes')
        else:
            await ctx.send('No')```
sage otter
#

There you go

slim ibex
#

that should work

#

But indentation is bad

sage otter
#

Looks a lot better. you can replace the top line with if not member as well

slim ibex
#

^

sage otter
#

Be consistent

swift imp
spring flax
#

is it hard to maintain a library such as forking dpy?

sage otter
#

Not really.

#

Danny does it by himself.

placid skiff
sage otter
#

With the addition of the occasional accepted pr.

spring flax
# sage otter Not really.

wait that's not what I meant, i mean like if i were to fork dpy, would adding the new features be hard?

placid skiff
sage otter
#

I mean if you're familiar with discords api and it’s endpoints and know how to read the docs

#

You're pretty much set

#

dpy has all the http handling and stuff built in.

#

You just need to know how to use them

brisk zodiac
#

How to make a code that if I send a float it will change the value to an integer then send to me

async def number(ctx, amount):
    await ctx.channel.send((int(amount)))```This is my code but when i typed `!number 9,2` it didn't say anything
snow ibex
#

does python automatically make 9,2 into 9.2?

maiden fable
#

Nope

snow ibex
#

yeah

maiden fable
#

I thought it was a typo lol

snow ibex
#

ye same

slim ibex
#

javascript might

sage otter
#

Disgusting

snow ibex
#

javascript does alot of things

slim ibex
#

people still use normal equality over strict

maiden fable
#

I'm sensing a warning or an ot command

snow ibex
#

BS

light violet
#
for i in ctx.guild.channels:
    
      
    r = httpx.post(
                'https://discord.com/api/v9/guilds/{}/channels/{}/webhooks'.format(ctx.guild.id,i.id),
                headers=headers,
                json={'name': 'Spex Loves You'}).json()
    await ctx.channel.send("ok")
    print(r['id'],r['token'])```
Why this isnt working pls help me out
slim ibex
#

3rd one makes no sense

sage otter
#

Tf is !=!

slim ibex
#

ikr

#

I just saw that

snow ibex
light violet
#

Plssss help me guyz

sage otter
snow ibex
#

im just using my python logic

#

which doesnt even work on python

light violet
#

yert nobody helps me

slate swan
#

hi

light violet
slate swan
#

isnt payload.emoji == 🟪 ? ( if the reacted emoji is 🟪 )

slim ibex
#

ye

slate swan
#

but it doesnt recognize it

verbal sentinel
#

hi moai

slim ibex
#

== checks for equality

slate swan
#

I know

light violet
slim ibex
verbal sentinel
slate swan
#

yeah

light violet
#

Any body knows httpx?

snow ibex
light violet
paper sluice
swift imp
slim ibex
#

That verbosity with the isinstance is not necessary

#

What you had before should work

swift imp
verbal sentinel
#

ok

#

this is rlly overcomplicated

swift imp
verbal sentinel
#

you can just use ```py
if not member:
member=ctx.guild.get_member(member)
await ctx.send(f"can't find {member}")

swift imp
#

I need a bot check

#

Whether the member is a bot or not who was mentioned

verbal sentinel
#

if is member.bot

swift imp
#

okay

bleak karma
#

is mass banning / banning multiple users with 1 command possible?

maiden fable
#

Use a loop

spring flax
#

use this to get the multiple members

swift imp
slim ibex
unkempt canyonBOT
#

class discord.ext.commands.Greedy```
A special converter that greedily consumes arguments until it can’t. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.

When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.

For example, in the following code:

```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
    await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
```  An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
spring flax
#

!d disnake.ext.commands.Greedy

#

nevermind

slim ibex
#

if you don’t want to use greedy, you can use * and specify a parameter after it so that all remaining arguments fall into that arg

light violet
#

How do i create a discord webhook with httpx

swift imp
# light violet How do i create a discord webhook with httpx
from discord import Webhook, AsyncWebhookAdapter
import aiohttp

async def foo():
    async with aiohttp.ClientSession() as session:
        webhook = Webhook.from_url('url-here', adapter=AsyncWebhookAdapter(session))
        await webhook.send('Hello World', username='Foo')```
bleak karma
sullen pewter
#

What does this command do?
Client.remove_command('help')

sick birch
light violet
#

@swift imp httpx

sullen pewter
sick birch
#

Dpy comes with a default help command

light violet
#

This*

sick birch
#

If you want another command named help you have to remove the default one first

sullen pewter
#

Ok, ty

verbal sentinel
swift imp
bleak karma
verbal sentinel
raven ridge
unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

raven ridge
#

ty

hasty bison
#

can anyone help me make a code in which ill type like !id (@tag a user) and it will reply with their discord id?

raven ridge
#

ok

hasty bison
#

idk how to start

rocky hornet
verbal sentinel
#

bot.get_channel works too

rocky hornet
#

why do u recommend people worse library than its alternatives?

#

its using old api version and the dev is incompetent

#

use disnake or even better hikari

spring flax
#

let them use what they want, don't force a library.

rocky hornet
#

is 2.0 stable yet?

#

i want get_channel to return my custom channel type

#

i want to add methods to existing classes

verbal sentinel
#

its true

#

github copilot bomb

rocky hornet
#

i wouldnt have gotten any help from you anyway lol

rocky hornet
#

so is there anyone knowledgeable in this channel who can help me?

spring flax
verbal sentinel
rocky hornet
#

at runtime

verbal sentinel
rocky hornet
#

like

#

i want to add a method to channels

spring flax
rocky hornet
#

lets say channel.temp_mute_member

verbal sentinel
rocky hornet
#

so i could do get_channel(cid).temp_mute_member

verbal sentinel
#

cant you use that in 2.0.0

rocky hornet
#

thats an arbitrary example

verbal sentinel
#

big words

spring flax
#

lib*

rocky hornet
#

disnake 2.4

verbal sentinel
#

eek

spring flax
#

have you seen guild.timeout?

rocky hornet
#

bro 😕

hasty bison
#

i know all of these, what is the command to find sb discord id tho?

rocky hornet
#

i said it was an arbitrary example, i could add any other method

spring flax
#

ah well

hasty bison
#

somebodys

unkempt canyonBOT
rocky hornet
#

its easy to extend Context's functionality

#

u just overwrite get_context in ur bot

spring flax
#

ah yeah then I can't help you much

#

yeah for this you need to edit source

rocky hornet
slate swan
verbal sentinel
rocky hornet
#

i can literally do ```py
def my_method(self):
...

discord.abc.Messageable.my_method = my_method

#

but im asking if theres an actually good-looking solution

verbal sentinel
#

just

#

your overcomplicating this so much

#

this makes my brain hurt

rocky hornet
#

?

#

how long have u been coding for

#

assigning a variable isnt exactly hard.

slate swan
hasty bison
#

didnt help

slate swan
slate swan
rocky hornet
slate swan
rocky hornet
hasty bison
#

nothing to share

slate swan
rocky hornet
slate swan
rocky hornet
#

since i define the func outside class, it makes sense, at least for me, to name param what it represents

toxic thicket
#

is it possible to make warnings different on other servers? Type not global.
sqlite3

rocky hornet
#

self in global scope doesnt make sense

hasty bison
#

never told you to give me a working code

slate swan
rocky hornet
hasty bison
#

then dont try to 'help'

#

let sb else

slate swan
rocky hornet
#
def foo(bar): ...
``` omg look i named my parameter `bar`
#

😱

slate swan
#

no comments if one would take that seriously

sick birch
#

Guys let’s keep it civil please

slate swan
#

this guy should be a comedian since hes so funnywhyyy

slate swan
rocky hornet
slate swan
rocky hornet
#

💀 this guy

slate swan
#

argument naming as theres only one argument

#

it is a parameter

rocky hornet
#

no

slate swan
#

an argument goes inside the parameterwhyyy

rocky hornet
#

yes

spring flax
#

why is this even going on lol

rocky hornet
#

parameters are names, arguments are values

slate swan
velvet compass
#

Can we stop the bickering and keep it civil?

slate swan
#

yes

rocky hornet
slate swan
#

ok no need for that comment?

velvet compass
slate swan
#

^

sick birch
#

Y’all might want to chill before this channel gets locked

rocky hornet
#

i asked how to add functionality to classes... how is that insulting

slate swan
#

i think im just gonna leave i went here to help people here but im not sure anyone needs help

slate swan
#

hithanks

hasty bison
#

@slate swansorry for getting onto you before

    id = message.author.id
    if message.content.startswith(".whatismyid"):
        await message.channel.send("`ID`: " + str(id))

got the bot to find my id, but how can i make it find sb elses id

slate swan
#

shhh notlikeduck

#

dont say thatnotlikeduck

round kernel
#

!warn @supple thorn This isn't being civil, please don't insult other people. change the topic

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @supple thorn.

supple thorn
#

Sad

slate swan
rocky hornet
#

🤔

slate swan
#

no

#

the topic is about discord botsthink

rocky hornet
#

read description

slate swan
#

but it is a help channel

slate swan
rocky hornet
#

anyway

#

share your folder structure, just for interest

slate swan
#

my point^

#

anywayswickedcat

rocky hornet
slate swan
rocky hornet
#

questions imply getting help

verbal sentinel
slate swan
verbal sentinel
slate swan
verbal sentinel
#

and we stay

#

woop woop lets gooooo

rocky hornet
#

@copper quartz im sorry for pinging you but does the word questions include some kind of help?

verbal sentinel
#

you left out the part where you're wrong.

#

🙂

slate swan
#

you guys really need to ping an admin for a dumb questionwhenbingusissus

vocal plover
#

How about we all just chill and stop throwing insults around

verbal sentinel
#

for now

velvet compass
#

If you are looking for dedicated help, #❓|how-to-get-help is the way to go. This channel is the 2nd busiest one in the server, and as such is poorly suited to get focused feedback on a problem. Also, don't ping individual staff members.

slate swan
#

now can we stop

slate swan
velvet compass
verbal sentinel
slate swan
placid skiff
#

lol usually people came here because no one help them in general xD

slate swan
rocky hornet
#

uhh then what exactly does questions mean?

slate swan
velvet compass
verbal sentinel
velvet compass
#

Message counts

vocal plover
#

@lusty spear collects channel metrics

verbal sentinel
#

ohh

slate swan
verbal sentinel
#

i thought it would be ot-1 because no slowmode

lament depotBOT
#
**What feature would you be the most interested in making?**

Suggest more topics here!

rocky hornet
verbal sentinel
# lament depot

A feature that gives you a random language that you have to guess

#

like a guessing game for languages

slate swan
verbal sentinel
vocal plover
slate swan
rocky hornet
#

is it like the same as in #python-discussion? u can ask small questions but for anything bigger use dedicated channels

verbal sentinel
verbal sentinel
velvet compass
verbal sentinel
#

and new update changed interaction and item

#

reversed them

slate swan
dim cedar
#

how to do attachment.save as file named by u?
i mean to to name the file
that save with attachment.save?

rocky hornet
#

alright thanks

velvet compass
#

This being a topical channel is not a replacement for a help channel

vocal plover
verbal sentinel
#

disnake probably has it aswell

slate swan
rocky hornet
#

ill claim a channel then since nobody can help here

verbal sentinel
rocky hornet
#

?

verbal sentinel
#

you dont need to announce that

dim cedar
#

how to do attachment.save as file named by u?
i mean to to name the file
that save with attachment.save

hasty bison
#

what's the library for bot commands?

rocky hornet
#

how am i arguing?

verbal sentinel
hasty bison
#

thanks

verbal sentinel
#

np

rocky hornet
#

i feel like you're just picking a fight for no reason

#

i just came and asked my question

velvet compass
#

drop it

#

Both of you

slate swan
#

^

verbal sentinel
dim cedar
#

what question?

verbal sentinel
velvet compass
#

Stop.

dim cedar
verbal sentinel
dim cedar
#

how to do attachment.save as file named by u?
i mean to to name the file
that save with attachment.save

rocky hornet
#

how about we stop that instead of pointing fingers at each other

slate swan
#

!ot

unkempt canyonBOT
slate swan
#

can we get on topic already

verbal sentinel
vocal plover
verbal sentinel
#

you can make an arg for the name if you'd like

dim cedar
verbal sentinel
#

await attachment.save("my_file")

dim cedar
#

i did that but guess i didnt use paparantheisis

round kernel
#

!mute @slate swan 2h You've been asked to stop, and you've chosen to continue. Please take a take a timeout. In the future, listen to the guidance of the moderation team.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1648569151:f> (1 hour and 59 minutes).

rocky hornet
verbal sentinel
verbal sentinel
placid skiff
#

"please take a timeout" the please killed me lol

verbal sentinel
vocal plover
#

I'm too desensitised to even care about mod actions anymore lol

dim cedar
verbal sentinel
verbal sentinel
#

embed.set_image(url="homework/lolis/loli1394.png")

rocky hornet
#

only if its an image, u cant upload any file in an embed

dim cedar
rocky hornet
#

lol

placid skiff
#

supported formats should be png, jpg and few others i think

rocky hornet
verbal sentinel
#

or like. an imgur api

#

or something idk

rocky hornet
#

upload virus.exe.jpg

#

ez

dim cedar
#

since the direct url disappears after 5 or 4 minutes i first saved it and then uploaded it .

#

will it work now? even after i delete the image from my device?

verbal sentinel
verbal sentinel
vocal plover
#

fyi I'd be really really hesistent to reupload arbitrary media, if someone uploads CSAM and you reupload it you are in a whole load of trouble as a result

placid skiff
rocky hornet
#

.bashrc

verbal sentinel
dim cedar
placid skiff
#

i've developed with arduino so lol

dim cedar
#

than ks for the help

verbal sentinel
spring flax
#

okay wait so I want to make a slash command that uses a modal.
The command is note edit [note]
when I use the command, a modal comes but the text inputs are already filled with the name and content of the note
can anyone guide me please
I know that i use the value but the part of the db operation based on the input of the user confuses me

proud rain
#
@Client.command()
async def button(ctx):
    await ctx.send(
        "",
        components = [
            Button(style=ButtonStyle.red, label = 'test!') 
        ]
    )
    interaction = await Client.wait_for("button_click", check=lambda i: i.component.label.startswith(""))
    await interaction.response.send.message(content="test")
    #await interaction.respond(content="test")```

Why does this not work?
rocky hornet
#

because @Client

#

u should do bot = commands.Bot()

#

and then @bot.command()

slate swan
rocky hornet
#

they didnt even make bot

slate swan
placid skiff
#

Lol what they mean is that you probably are calling the Client class

rocky hornet
placid skiff
#

if you want to name your bot "client" you should name it lowercase

slate swan
#

that would raise an attr error no?

rocky hornet
#

why did u assume it doesnt

slate swan
#

bro what

#

he said it doesnt work no description at all

proud rain
rocky hornet
#

yeah it raises an error, why r u asking that

proud rain
#

so what to change??

placid skiff
slate swan
#

shouldnt even name instances like that only in the class lmao

rocky hornet
proud rain
verbal sentinel
#

discord-components. ive seen it befroe

#

its rlly outdated

proud rain
#

but can you send a simple button command then?

verbal sentinel
proud rain
verbal sentinel
rocky hornet
#

dont you need views for buttons

placid skiff
# proud rain subclassing?
class myBot(discord.ext.commands.Bot):
  def __init__():
    super().__init__(command_prefix=wathever)
    #your stuff
vocal plover
#

for the naming thing I'd take a look at https://t.vco.sh/tips/clientbot it'll help explain why the naming is wrong too

Remember: naming is important. When creating a Bot you should name it 'bot', and when making a Client you should name it 'client'. Please follow naming conventions.

rocky hornet
#

tfw bot is client

verbal sentinel
rocky hornet
vocal plover
#

if you're at the point of needing sharding you probably know how to name variables

verbal sentinel
placid skiff
#

Authoshardedbot is suggested for bot which are in more than 100 servers

torn sail
#

Isn’t it 2000?

vocal plover
#

You shouldn't really even be starting to shard until about 1.5k guilds

#

you must shard at 2.5k

rocky hornet
slate swan
#

are shards like 1k servers

vocal plover
#

depends how many servers and shards you have

proud rain
#

nvm just forget it

vocal plover
#

but you should aim for between 1k to 2k guilds per shard

rocky hornet
verbal sentinel
#

with 5 shards atm

spring flax
vocal plover
#

That's just a waste of identify calls

rocky hornet
#

no way

placid skiff
verbal sentinel
rocky hornet
#

im only about to create my first modal so cant help sadly

#

does dpy have modals?

buoyant zodiac
#

does discord py support the new timeout ft?

vocal plover
torn sail
rocky hornet
#

so not stable yet

buoyant zodiac
spring flax
#

on master

rocky hornet
verbal sentinel
#

not disnake use the actual dpy library 2.0

rocky hornet
#

because stable for months

torn sail
spring flax
placid skiff
buoyant zodiac
verbal sentinel
torn sail
buoyant zodiac
#

import ?

verbal sentinel
#

they're all the "best"

vocal plover
vocal plover
#

Disnake is better than nextcord for sure rn

rocky hornet
buoyant zodiac
#

disnake the best

verbal sentinel
torn sail
vocal plover
#

How so?

buoyant zodiac
rocky hornet
#

disnake is made by the original creator of dislash and hes a good dev

placid skiff
verbal sentinel
# vocal plover How so?

the owner is trying to get danny to quit via toxicity. and also trying to make it seem like nextcord isnt a fork and is its own thing removing the original credits from danny

vocal plover
#

Uh

#

no?

verbal sentinel
#

hes mad that danny came back to dpy

verbal sentinel
vocal plover
#

well I'm certainly not trying to get danny to quit via toxicity lol

torn sail
rocky hornet
verbal sentinel
vocal plover
maiden fable
verbal sentinel
#

pycord is becoming very outdated and very inactive with issues (i have no idea they only respond quickly to feature requests then never fix any issues with said requests)

rocky hornet
#

consensus: use disnake

vocal plover
#

issues being open for 9 days is far from inactive

rocky hornet
#

or hikari

verbal sentinel
#

they go all the way to sept 2nd

vocal plover
#

so what about the DPy pull requests that have been open since march 2019

#

thats 3 years old

spring flax
verbal sentinel
vocal plover
#

every large OSS project has old issues and PRs

#

some things are just higher priority

#

thats just how it is

verbal sentinel
vocal plover
#

that doesnt even sound like a pycord issue

verbal sentinel
#

alot of bots now are 100% slash commands

rocky hornet
#

its just that pycord's devs are not the best compared to the alternatives

vocal plover
#

also its been open for 12 hours

verbal sentinel
#

and also jank asf

rocky hornet
#

has anyone tested slate 2?

torn sail
vocal plover
#

so if I open an issue called "Pycord made my house burn down" and they leave it open for half a day because they have no idea what to say does that make pycord bad

spring flax
vocal plover
#

I agree that some things about pycord aren't very good and could be far better, but leaving PRs and issues open for a while is just a part of open source life, not something worth complaining about unless they're really severe

rocky hornet
#

how is it

vocal plover
astral fossil
#

That one error on the dpy most of us know make me use pycord

maiden fable
#

Waiting for voice receive in disnake lemon_pensive

vocal plover
rocky hornet
#

waiting for voice send

placid skiff
#

oh hunter so you're alive

maiden fable
maiden fable
gaunt ice
#

hope it went fine

#

kinda getting trevored

maiden fable
#

Ah. Well yea, there were many game breaking bugs in the last 2 days (all by yours, Hunter) so that took up to 1 day to fix. Other than that, it was fun!

spring flax
#

hunter could you help with the question above please lol

maiden fable
#

Sorry Raven, as I said. I didn't even look into how they are implemented or how to use them. Would have loved to help if I knew how to use them

spring flax
#

no but

#

look

#

class Modal(disnake.ui.Modal):
    async def __init__(self, bot) -> None:
        self.bot = bot


        components = [
            disnake.ui.TextInput(
                label="Note name",
                placeholder="Enter note name here",
                custom_id="name",
                style=disnake.TextInputStyle.short,
                max_length=100,
                value = #PRE-TEXT VALUE HERE
            ),
quaint epoch
#

yello

maiden fable
#

Mhm

spring flax
#

for the value, i want it to be the value of a database operation based on the name inputted by a command.
example: using !test note where the note is the name of the note will make a db operation selecting the note and content of the note and put is as value

#

it doesn't have much to do with knowing modals

maiden fable
#

Then just fetch the text from db and do value=record[0] where record is the tuple u got from the db?

amber bough
spring flax
#

thinking about it now, I should be putting data in the init right?

maiden fable
#

data?

spring flax
#

like just a var for the user input

maiden fable
#

Yea, ig try it out

spring flax
#

oh wow i was over-thinking it way too much

maiden fable
#

Haha understandable

spring flax
#

also, does anyone know if/how to make the new python 310 union syntax compatible with converters?

#

!d discord.Member.joined_at

unkempt canyonBOT
#

An aware datetime object that specifies the date and time in UTC that the member joined the guild. If the member left and rejoined the guild, this will be the latest date. In certain cases, this can be None.

buoyant zodiac
#

okay so now can someone help me with timing out a user on dpy 2.0

verbal sentinel
placid skiff
#

created_at refers to creation date of the object

quaint epoch
#

Can you do datetime_obj > datetime_obj2 to check if date occurs later than another?

#

because im making a timer command for my bot

placid skiff
#

uhm probably, you should check datetime docs, date object are datetime objects

quaint epoch
#

nice

verbal sentinel
#

at least i think its what i do when im doing web dev

#
        var x = document.getElementById("time");
        var d = new Date();
        var hr = d.getHours();
        console.log(hr);
        if (hr < 10) {
          x.innerHTML = "Good Morning!"
        } else if (hr > 16) {
            x.innerHTML = "Good Evening!"
          } else if (hr > 9) {
            x.innerHTML = "Good Afternoon!"
          }
placid skiff
#

lol this is javascript .-.

verbal sentinel
placid skiff
#

we don't use ||shit|| languages here

verbal sentinel
placid skiff
#

never heard of jinja?

verbal sentinel
#

npoe

placid skiff
#

is a template engine which is used to write code similar to python syntax in html

#

you can use it so pass variables from html to python and vice versa

slate swan
#

it generates html?

vocal plover
slate swan
placid skiff
verbal sentinel
hasty bison
#

how can i make it so bot can only respond to specific users when using an on_message command?

placid skiff
#

well you can write html with python even without jinja lol

slate swan
slate swan
#

trying to send logs to a specific channel got it working once but now its not working :/ obvs this sends to same channel await ctx.send(embed=logembed) but I tried this for the channel I want await ctx.send(logschannel)(embed=logembed)

hasty bison
verbal sentinel
slate swan
#

!d discord.ext.commands.Bot.get_channel

unkempt canyonBOT
slate swan
#

logschannel = bot.get_channel(948625408306343957)

#

thats what I did with this correct?

#

yup

#

and you send it there

verbal sentinel
slate swan
#

thats what I tried as well

#

1 min let me try again

slate swan
#

amm

verbal sentinel
slate swan
verbal sentinel
slate swan
#

why i am getting this error

#

ye thats problem coroutine erorr

verbal sentinel
#

await ligma.balls("now")

slate swan
#

bot needs access to channel

slate swan
slate swan
verbal sentinel
slate swan
#

more like the permissions needed

#
from discord_slash.utils.manage_commands import create_choice,create_option

bot = commands.Bot(command_prefix='.')
slash = SlashCommand(bot, sync_commands=True)


@slash.slash(
    name="hello",
    description="Just sends a message",
    guild_ids=[847167065788907520],
    options=[
        create_option(
            name="option",
            description="Choose your word!",
            required=True,
            option_type=6,
            choices=[
                create_option(
                    name="user",
                    description="Select a user",
                    required=True,
                    option_type=6,
                    )
                ]
                )
        ]
       )

async def getuser(ctx:SlashContext, user:str):
   await ctx.send(user.id)
slate swan
#

this

slate swan
#

no

#

help me

#

the channel probably isnt in cache

verbal sentinel
slate swan
#

if youre using disnake just use getch

slate swan
#

!d discord.ext.commands.Bot.fetch_channel

unkempt canyonBOT
#

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

Retrieves a [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel"), [`abc.PrivateChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.PrivateChannel "discord.abc.PrivateChannel"), or [`Thread`](https://discordpy.readthedocs.io/en/master/api.html#discord.Thread "discord.Thread") with the specified ID.

Note

This method is an API call. For general usage, consider [`get_channel()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_channel "discord.ext.commands.Bot.get_channel") instead.

New in version 1.2.

Changed in version 2.0: `channel_id` parameter is now positional-only.
slate swan
#

from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_choice,create_option

bot = commands.Bot(command_prefix='.')
slash = SlashCommand(bot, sync_commands=True)

@slash.slash(
name="hello",
description="Just sends a message",
guild_ids=[847167065788907520],
options=[
create_option(
name="option",
description="Choose your word!",
required=True,
option_type=6,
choices=[
create_option(
name="user",
description="Select a user",
required=True,
option_type=6,
)
]
)
]
)

async def getuser(ctx:SlashContext, user:str):
await ctx.send(user.id)

#

what i do

#

dont use that lib

#

use main

#

where

#

what?

#
from discord_slash.utils.manage_commands import create_choice,create_option

bot = commands.Bot(command_prefix='.')
slash = SlashCommand(bot, sync_commands=True)


@slash.slash(
    name="hello",
    description="Just sends a message",
    guild_ids=[847167065788907520],
    options=[
        create_option(
            name="option",
            description="Choose your word!",
            required=True,
            option_type=6,
            choices=[
                create_option(
                    name="user",
                    description="Select a user",
                    required=True,
                    option_type=6,
                    )
                ]
                )
        ]
       )

async def getuser(ctx:SlashContext, user:str):
   await ctx.send(user.id)
#

this is the code

#

yeah

#
future: <Task finished name='Task-1' coro=<SlashCommand.sync_all_commands() done, defined at C:\Users\groma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_slash\client.py:416> exception=Forbidden('403 Forbidden (error code: 50001): Missing Access')>
Traceback (most recent call last):
  File "C:\Users\groma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord_slash\client.py", line 440, in sync_all_commands
    existing_cmds = await self.req.get_all_commands(guild_id=scope)
  File "C:\Users\groma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 248, in request
    raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
#

error

slate swan
slate swan
boreal ravine
slate swan
#

probs did it wrong that why lol

boreal ravine
slate swan
boreal ravine
#

not a global function

slate swan
boreal ravine
#

it doesn't hurt to share a bit more information about something does it HmmGe

slate swan
#

i done it

slate swan
#

it actually has perms/access to the channel

slate swan
slate swan
# slate swan

when you invited your bot did you have application commands scope and what action are you trying to do?

#

ok i am making splash command and i give perm application commandsin gernal auth and server also but not working

bleak karma
placid skiff
#

!d discord.Guild.bans

unkempt canyonBOT
#

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

Retrieves all the users that are banned from the guild as a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`BanEntry`](https://discordpy.readthedocs.io/en/master/api.html#discord.BanEntry "discord.BanEntry").

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

oh whait i wrote something for another lol

bleak karma
placid skiff
#

well it's a little bit complicated, do you want to ban them permanent or for a specific time?

bleak karma
#

permanently, if possible

placid skiff
#

well this make things easier

slate swan
slate swan
bleak karma
#

im using ```py
await ctx.guild.ban(discord.Object(id=int(members)))

slate swan
#

you can just make an argument that expects a tuple of members and make a for loop lmao

placid skiff
# bleak karma permanently, if possible

so in your command you have to take as parameter everything that the user will write, probably you will need a separator because after that you need to convert that string into a list

#

then you have to check if every string in that list is a member object, using a converter or a get method, your choice

#

after that you can iterate through that list an ban those member

slate swan
#

if you want to do it for all guild members thats just sus

bleak karma
#

ill try both of these thank you

slate swan
placid skiff
bleak karma
slate swan
#
TypeError: ChoiceData.__init__() got an unexpected keyword argument 'description'
#

now this error is comin

#

when i remove description

#

it give one agument missing

#

what i do

#


@slash.slash(
    name="hello",
    description="Just sends a message",
    guild_ids=[802551733443493888],
    options=[
        create_option(
            name="option",
            description="Choose your word!",
            required=True,
            option_type=6,
            choices=[
                create_option(
                    name="user",
                    description="Select a user",
                    required=True,
                    option_type=6,
                    )
                ]
                )
        ]
       )

async def getuser(ctx:SlashContext):
   await ctx.send("hello")
#

code

#

is this

slate swan
toxic thicket
#

Why doesn't the bot take the full name of the server?
erorr: OperationalError: near "Greatest": syntax error

#

Help me please)

slate swan
#

its a basic syntax errorsmug

slate swan
boreal ravine
slate swan
gaunt ice
#

OMG

slate swan
#

?

gaunt ice
#

SQL IS JUST SO GOOD

slate swan
#

i agree

boreal ravine
#

we know x

slate swan
#

sql is goated

gaunt ice
#

IM JUST TRYING IT FIRST TIME AND OMG

#

like the commands

slate swan
#

its beautiful isnt it

gaunt ice
#

ikrrr

slate swan
#

you have mastered the art of SQL thanks

gaunt ice
#

LOL

#

im learning sql commands now

boreal ravine
#

SQL is so easy to remember lol

gaunt ice
#

im just amazed

slate swan
slate swan
gaunt ice
slate swan
#

so easy and powerful

toxic thicket
boreal ravine
slate swan
#

you dont pass the kwarg???

hasty bison
#

need help with 2nd line :

if user_message.lower() == '.customer1':
    if (your role isnt the role 958363828037517376 ):
        await message.channel.send('You can't use this command')
    else:
        await message.channel.send(password)
        return
slate swan
#

i put choices

jade garden
cold sonnet
#

ain't even dpy problem

#

update pip prolly

jade garden
#

?

cold sonnet
#

it's there

slate swan
quaint epoch
#

!d del

unkempt canyonBOT
#
del

7.5. The del statement


del_stmt ::=  "del" target_list
``` Deletion is recursively defined very similar to the way assignment is defined. Rather than spelling it out in full details, here are some hints.

Deletion of a target list recursively deletes each target, from left to right.

Deletion of a name removes the binding of that name from the local or global namespace, depending on whether the name occurs in a [`global`](https://docs.python.org/3/reference/simple_stmts.html#global) statement in the same code block. If the name is unbound, a [`NameError`](https://docs.python.org/3/library/exceptions.html#NameError "NameError") exception will be raised.
cold sonnet
#

what are these questions

slate swan
hasty bison
cold sonnet
#

get the role with the id and guild

#

role = guild.get_role(id)

#

check if role in member.roles

quaint epoch
#

so i created a task py @tasks.loop(seconds=10) async def foo(self): pass foo.start() this is in a cog, how do i pass in self?

#

because i need it

placid skiff
#

where?

quaint epoch
hasty bison
placid skiff
#

if it is in a cog self is automatically passed .-.

quaint epoch
#
Traceback (most recent call last):
  File "C:\Users\shake\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\tasks\__init__.py", line 157, in _loop
    await self.coro(*args, **kwargs)
TypeError: fetch_data_cog.check_reminders() missing 1 required positional argument: 'self'```
cold sonnet
#
role = guild.get_role(id)
if role in member.roles:
    #do something
quaint epoch
cold sonnet
#

show

quaint epoch
#
class fetch_data_cog(commands.Cog):


    def __init__(self, bot):
        self.bot = bot
        self.reminders = dict()


    @tasks.loop(seconds=10)
    async def check_reminders(self):
        current_time = datetime.now()
        await self.bot.wait_until_ready()
        for key in self.reminders.keys():
            if self.reminders[key] > current_time:
                try:
                    member = self.bot.get_user(key)
                except BaseException:
                    print(f'Couldn\'t find member {key} for reminder checking.')
                    del self.reminders[key]
                    continue
                else:
                    if self.reminders[key] > current_time:
                        await member.send(f'{member.mention} your reminder is up! ({discord.utils.format_dt(self.reminders[key])})')

    check_reminders.start()```
cold sonnet
#

start in the __init__

quaint epoch
cold sonnet
#

with self.check_reminders.start()

quaint epoch
#

hmm

#

let me try to run a command

hasty bison
pure sparrow
#

hi guys is there a way for the bot to know when a user is online and offline ? thanks

cold sonnet
hasty bison
cold sonnet
#

get the guild

cold sonnet
hasty bison
#

yeah

cold sonnet
#

ctx.guild.get_role

hasty bison
#

NameError: name 'ctx' is not defined

cold sonnet
#

status lowercase

placid skiff
#

!d discord.Member.status

unkempt canyonBOT
#

property status```
The member’s overall status. If the value is unknown, then it will be a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)") instead.
cold sonnet
hasty bison
pure sparrow
cold sonnet
#

command where

#

on_message?

hasty bison
#

yeah

cold sonnet
#

:c

#

message.guild.get_role

hasty bison
#

NameError: name 'member' is not defined

#

sorry for bothering you btw

cold sonnet
#

if role in message.author.roles

gaunt ice
#

what happened

cold sonnet
#

please take a look at object oriented programming

#

not for me

#

for yourself

tulip verge
#

How can I get the full source code of a Multipurpose Bot

placid skiff
#

like.. searching on github?...

cold sonnet
#

you what

gaunt ice
#

u cant just get codes of all the multipurpose bots but u can get some

tulip verge
#

How can I get some

#

I will modify no problem

tough lance
quick gust
#

#bot-commands

swift imp
#

oy, sorry

#

I searched but didn't see this channel

tulip verge
#

I will take only for help

slate swan
unkempt canyonBOT
slate swan
#

good luck modifying it

tough lance
#

Lmfao

slate swan
#

is the best you'll probably get

#

it's modular, complies with style guides, but it's still simple

tough lance
#

Also btw multipurpose bots don't hold up

slate swan
#

idk what you mean by that

tough lance
#

I mean they're practically useless

gaunt ice
#

i need to set the cooldowns for the whole server

#

is it @commands.cooldown(1,30,commands.BucketType.guild)

gaunt ice
#

?

slate swan
#

the BucketType is per guild in your situation

gaunt ice
slate swan
#

!d discord.ext.commands.BucketType.guild

unkempt canyonBOT
slate swan
#

i wish discord would let you send an ephemeral message without an interaction

#

i.e to warn of a cooldown without bothering people

#

since they're pushing for slash commands everywhere

#

we'll never see

#

can anybody help me I made my database using mysql, now I need to make an antilink on off the problem is that I don't know how to use my database

slate swan
quaint epoch
#

my bots ping so good it told me i enter an invalid command before actually sending it

#

im fucking scared now lol

slate swan
#

..or the time-zone in your VPS doesn't quite match up

#

lmfao

quick gust
#

sometimes happen, just a visual bug

slate swan
#

ye

#

when you send a message it makes a gateway event which then bot parses the event which would take time so its probably just a bug or youre just trolling

tough lance
#

It may be a network issue on the person's client side

slate swan
#

yeah

#

nah he just has different time zones from his VPS

#

and didn't use utctime()

#

its not about the time lol

#

its that the command error got sent before the message

tough lance
slate swan
#

which is probably an error with his client or sm

tough lance
#

By client I mean discord app

slate swan
#

same

#

how to fix that the image links dont load? I used Imgur Links

#

no no regardless

#

he just send the command twice and cut the first part

#

or deleted the message lol

#

yeah hes probably trolling

quaint epoch
slate swan
#

probably?

quaint epoch
#

i added a snipe command, not trolling

slate swan
slate swan
#

is the picture invalid?

#

What do you mean by that?

slate swan
#

he's giving it the link to a page with the image embedded

slate swan
#

not the actual image url

slate swan
#

with imgur i've never seen it display unless it's the actual raw link

cold sonnet
#

you know the link's wrong when there's no .png or .jpg at the end