#discord-bots

1 messages · Page 608 of 1

surreal dust
#

like what do i add over here?

#

@slate swan can you help?

sullen shoal
#

member.guild.get_channel

surreal dust
sullen shoal
#

what and

surreal dust
#

what after that

sullen shoal
#

get the channel you want by the id then use the async send method to send messages

#

!d discord.Member.guild

#

!d discord.Guild.get_channel

unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads.
surreal dust
#

i am noob i need someone to guide me

quick gust
#

No that's spoonfeeding

sullen shoal
#

!d discord.TextChannel.send

unkempt canyonBOT
#

await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message to the destination with the content given.

The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.

To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.

To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
quick gust
#

You're never gonna learn if u ask for raw code

slate swan
#

Wut

surreal dust
#

thanks i got it

#

thanks @sullen shoal

sullen shoal
slate swan
#

Why is your bot instance named client

#

Bad practice

sullen shoal
#

very bad

slate swan
sullen shoal
#

even more bad than freecodecamp

slate swan
#
    @commands.command()
    async def test(self, ctx, amount:int=None):
        for each in range(0, amount):
            await ctx.send("testing")

how do i make it so after every message sent the bot will wait about 0.75 - 1 second to send the next message?

quick gust
#

asyncio.sleep()

surreal dust
slate swan
#
import asyncio

print(a)
await asyncio.sleep(1)
print(b)

I think its like that

#

@quick gust sorry for the ping but the delay is a int right

sullen shoal
#

yes int

slate swan
#

time.sleep() takes a float

sullen shoal
#

1.0 float and int 1 is same both can be used

sullen shoal
#

lol

slate swan
#

And not floats

sullen shoal
#

time.sleep?

slate swan
#

Wait nvm

sullen shoal
#

it take both int and float

slate swan
#

Yeah nvm

sullen shoal
#

it accepts float but int 1 can be converted to 1.0 so yeah

slate swan
#

I think yeah

fast spear
sullen shoal
#

yes i think

slate swan
#

Cause its a coro

sullen shoal
#

yes it needs to be awaited

slate swan
#

Yeah cause its a coro

slate swan
fast spear
sullen shoal
slate swan
#

I think it can work idk

sullen shoal
#

yeah it will

slate swan
fast spear
#

kay,let me try
Tnx Very Much @sullen shoal @slate swan

sullen shoal
slate swan
sullen shoal
#

you could do import discord as disnake as well brainmon

slate swan
#
import Myxi as poopyhead

that would work great

#

Ok this is getting ot so back to topic

sullen shoal
#

lol

slate swan
#

Basically downgrading

sullen shoal
#

?

slate swan
#

Same

patent surge
#

How to set link - "Click here" in embed

sullen shoal
quick gust
#

no they are asking for hyperlink I think

patent surge
#

no in embed blue colour

slate swan
#

No a link with text

knotty zodiac
#

Anyone know how to split embed?

slate swan
#

Like text thats a link

quick gust
#

hyperlink

patent surge
#

Yeah how to make that

slate swan
quick gust
#

@patent surge

patent surge
#

ohk

quick gust
slate swan
#

?

#

Yeah

quick gust
#

yeah

sullen shoal
#

checks

slate swan
#

Check check

#

or a if statment

#

@sullen shoal do you know whats better?

sullen shoal
#

nope

slate swan
#

I think its checks idrk

sullen shoal
#

yes checks

slate swan
#

Why is that so?

sullen shoal
#

because easier to use

#

like lambda m: m.author in []

#

thats it

slate swan
#

Forgot what lambda mean

sullen shoal
#

anonymous functions

slate swan
sullen shoal
#

message

slate swan
sullen shoal
#

i think its ctx tho not sure

patent surge
#

doesn't works gibe example

slate swan
#

doesn't checks only take a ctx object

sullen shoal
#

i think its message

slate swan
#

I think they both work the same

#

Would work too...

sullen shoal
#

!e
print('hi' in ('hello', 'hi'))

slate swan
#

Checks i think is for like more stuff cause your just checking a id

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

True
slate swan
#

Well , is the command like for only the bot owner?

sullen shoal
#

the callable is meant to be a predicate

slate swan
#

Use the decorator

#

Ah , just use @commands.is_owner() decorator

sullen shoal
#

if it returns True, it will invoke the command

slate swan
#

you can have multiple bot owners

#

@is_owner I think works too

quick gust
#

@is_owner()

slate swan
#

if you add an owner_ids= [ id1 , id2] in Bot

sullen shoal
#

commands.is_owner()

slate swan
#

You get what i mean tho

quick gust
#

si

slate swan
#

commands.Bot

quick gust
slate swan
quick gust
#

kekw

slate swan
quick gust
#

yes

slate swan
#

help

#

pls

#

You can have as many as you want

slate swan
# slate swan

something's wrong with your prefix , show the commands.Bot var pls

#

it's @commands.is_owner() and is used above commands just like the @bot.command() VARIABLE

#

( sorry for the cap it was an autocorrect)

sullen shoal
#

bare except bad

slate swan
#

That's not what I'm talking about , your command_prefix in commands.Bot @slate swan

patent surge
#

Click here for item info isn't working

slate nymph
#

@commands.is_owner()

slate swan
#

Yes. Do that to every command
Or make a global check

slate swan
#

!d discord.ext.commands.Bot.add_check

#

.

unkempt canyonBOT
#

add_check(func, *, call_once=False)```
Adds a global check to the bot.

This is the non-decorator interface to [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.check "discord.ext.commands.Bot.check") and [`check_once()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.check_once "discord.ext.commands.Bot.check_once").
surreal dust
#

so now i added purge to my discord bot

#

now i want to add a thing like carl bot

slate nymph
#

!d discord.ext.commands.check_any

unkempt canyonBOT
#

@discord.ext.commands.check_any(*checks)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if any of the checks passed will pass, i.e. using logical OR.

If all checks fail then [`CheckAnyFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckAnyFailure "discord.ext.commands.CheckAnyFailure") is raised to signal the failure. It inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Note

The `predicate` attribute for this function **is** a coroutine.

New in version 1.3.
patent surge
surreal dust
#

when we type "I am something" carl bot replies "I am Carl" i want this kind of a commamd

#

how do i do this?

unkempt canyonBOT
#

discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.

This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.

Warning

Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
slate swan
surreal dust
#

ok

#

i forgot

#

sorry

slate swan
surreal dust
#

:(

slate swan
quick gust
slate swan
#

...

slate swan
#

Visual Studio or Replit

slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
sullen shoal
slate swan
slate swan
slate swan
quick gust
#

yeah

sullen shoal
#

yeah just rough example

slate swan
#

Cause your getting nothing

#

So you need to add the message objectbrainmon

slate swan
slate swan
sullen shoal
#

ok im gonna give him the exact spoonfeed wait a sec

slate swan
#

I should code it on Vsc and host it with replit

slate swan
#

Replit is horrible

sullen shoal
#
if "I am" in message.content:
    await ctx.send("And i am carl")```
slate swan
sullen shoal
#

there it is

slate swan
slate swan
slate swan
slate swan
surreal dust
#

is it fine?

slate swan
#

i need to host it 24/7

#

Only 2 lines of code not spoonfeed

#

i think uptimerobot

sullen shoal
slate swan
surreal dust
sullen shoal
#

remove ()

slate swan
#

or just use listen()

slate swan
slate swan
sullen shoal
slate swan
#

aaaa

#

and content must not be called ( yes the brackets myxi told about)

surreal dust
sullen shoal
#

which i forgot how to, maybe it was bot.process_commands()

slate swan
sullen shoal
#

or smth

slate swan
slate swan
sullen shoal
#

also remove it from message.content

surreal dust
slate swan
slate swan
surreal dust
#

okay

slate swan
surreal dust
#

if i remove the brackets its showing an error

slate swan
surreal dust
slate swan
#

They have acess to your code , thus your token :)

sullen shoal
slate swan
slate swan
slate swan
slate swan
surreal dust
slate swan
#

Check pins , you'd find some good ones

slate swan
slate swan
#

i use keep alive py

#

and flask to host it

slate swan
slate swan
surreal dust
#

ahhhhh i am not able to do it

slate swan
#

can u explain in dms

slate swan
#

And keep it online

#

Bro why does everyone ask if vsc can host 24/7 and then say replit better 😭

slate swan
surreal dust
#

can you pls help me fix this code

sullen shoal
surreal dust
#

@client.event()
async def on_message():
if "I am" in message.content:
await channel.send("I am UwU-BOT")

slate swan
slate swan
#

And its client.event

slate swan
surreal dust
slate swan
#

And change your bot instance from client to bot its bad practice

surreal dust
#

done

sullen shoal
#

select client and ctrl + f2 and type bot thats it

#

oh you have done it nice

slate swan
surreal dust
#

but it still doesnt work

sullen shoal
#

show updated code

slate swan
#

Both

slate swan
surreal dust
#

@bot.event
async def on_message(message):
if "I am" in message.content:
await channel.send("I am UwU-BOT")

#

this is the code now and it doesnt work

slate swan
#

Indents

#

I think arent correct

rose shale
#

hii how can we add animated stickers like this in embed

surreal dust
#

i suppose they are

slate swan
surreal dust
surreal dust
sullen shoal
#

i saw the error there

slate swan
sullen shoal
#

discord.channel has no attribute send

surreal dust
slate swan
#

!d discord.Client.get_emoji or just use the emoji object

unkempt canyonBOT
quick gust
#

add the emote to your server, then do \:emojiname: and copy what it sends and add it to your embe

slate swan
#

The id of the emoji

#

Not the str version

rose shale
slate swan
#

Because if its a custom emoji it needs the id

slate swan
quick gust
rose shale
quick gust
#

try it

surreal dust
#

it works but when i write I am this he starts spamming so hard

slate swan
rose shale
slate swan
rose shale
quick gust
slate swan
surreal dust
#

how do i stop himm

slate swan
#
snipe_message_author = []
snipe_message_content = []

    @commands.Cog.listener()
    async def on_message_delete(self, message):
        snipe_message_author[message.channel.id] = message.author
        snipe_message_content[message.channel.id] = message.content
        await asyncio.sleep(60)
        del snipe_message_author[message.channel.id]
        del snipe_message_content[message.channel.id]

    @commands.command(aliases=['s'])
    async def snipe(self, ctx):
        channel = ctx.channel
        try:
            e = discord.Embed(
                timestamp=datetime.utcnow(),
                title=f"{snipe_message_author[channel.id]}",
                description=snipe_message_content[channel.id],
                color=0x9641EA
            )
            e.set_thumbnail(url=snipe_message_author[channel.id])
            await ctx.send(embed=e)
        except:
            e = discord.Embed(
                color=0x9641EA,
                description="No messages have been deleted"
            )
            await ctx.send(embed=e)

Problem: It keeps sending the except message whenever something has been deleted.
Not the deleted message, code gives no errors or warnings. I don't get any errors either.

sullen shoal
slate swan
#

Replit>VSc

sullen shoal
#

lol

slate swan
#

nu

surreal dust
#

my bot is spamming help

slate swan
#

JK

quick gust
slate swan
#

Gotcha

slate swan
slate swan
surreal dust
#

i only want him to say I am UWU once

slate swan
#

@surreal dust you need to make a check

slate swan
sullen shoal
slate swan
sullen shoal
#

if yes, ignore it (return)

surreal dust
slate swan
worthy mantle
slate swan
#

Yes

sullen shoal
#

for now, yes

slate swan
#

for now

#
snipe_message_author = []
snipe_message_content = []

    @commands.Cog.listener()
    async def on_message_delete(self, message):
        snipe_message_author[message.channel.id] = message.author
        snipe_message_content[message.channel.id] = message.content
        await asyncio.sleep(60)
        del snipe_message_author[message.channel.id]
        del snipe_message_content[message.channel.id]

    @commands.command(aliases=['s'])
    async def snipe(self, ctx):
        channel = ctx.channel
        try:
            e = discord.Embed(
                timestamp=datetime.utcnow(),
                title=f"{snipe_message_author[channel.id]}",
                description=snipe_message_content[channel.id],
                color=0x9641EA
            )
            e.set_thumbnail(url=snipe_message_author[channel.id])
            await ctx.send(embed=e)
        except:
            e = discord.Embed(
                color=0x9641EA,
                description="No messages have been deleted"
            )
            await ctx.send(embed=e)

Problem: It keeps sending the except message whenever something has been deleted.
Not the deleted message, code gives no errors or warnings. I don't get any errors either.

slate swan
#
print('UwU')
slate swan
quick gust
slate swan
sullen shoal
#

sherlock has been doing very random stuff lately

slate swan
#

LOL

slate swan
#

Hes bored leave him alone

#

Not even 2 minutes, nice

slate swan
surreal dust
#

lol it fixed my bot got kicked from 3 servers

slate swan
surreal dust
#

due to intensive spam

slate swan
quick gust
#

lol

#

then leave discord

slate swan
#

Vsc > you

#

Jk btw

#

But dont disrespect vsc

#

notepad>> everything

surreal dust
#

how do i set case sensitivity to false

rose shale
# slate swan Ofcourse

is this correct, its not coming as sticker, i dont ave this sticken in server so it coz of that

slate swan
quick gust
#

case_insensitive=True

surreal dust
#

@bot.event
async def on_message(message):
if "I am" in message.content and message.author.bot == False:
await message.channel.send("I am UwU-BOT")

slate swan
slate swan
surreal dust
slate swan
#

sorry

quick gust
rose shale
slate swan
slate swan
slate swan
sullen shoal
surreal dust
slate swan
quick gust
#

to get the actual error

slate swan
slate swan
surreal dust
#

okok

slate swan
#

Sherlock>Me

slate swan
#

My Life>Me

rose shale
slate swan
#

Dead Me

slate swan
surreal dust
#

i dont understand how

#

sorry me dum

slate swan
rose shale
slate swan
sullen shoal
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

True
surreal dust
slate swan
#

Its 4am for me gn guys

sullen shoal
#

gn

#

bad sleeping schedule btw

slate swan
surreal dust
#

str("I am" == "i AM".lower)

slate swan
surreal dust
#

this way right?

sullen shoal
#

no need to call str and lower needs to be called

rose shale
#

also in music part, in 'nowplaying' is there a method to get how much part it played ( 0:12/duration)

slate swan
# slate swan

Oh so based on your code , it must be because the value of str(message.guild.id) is set to null in the json , can your please check it

#

ok so Sarthak. the base of my code was this:

snipe_message_author = {}
snipe_message_content = {}
 
@client.event
async def on_message_delete(message):
     snipe_message_author[message.channel.id] = message.author
     snipe_message_content[message.channel.id] = message.content
     await sleep(60)
     del snipe_message_author[message.channel.id]
     del snipe_message_content[message.channel.id]
 
@client.command()
async def snipe(ctx):
    channel = ctx.channel 
    try:
        snipeEmbed = discord.Embed(title=f"Last deleted message in #{channel.name}", description = snipe_message_content[channel.id])
        snipeEmbed.set_footer(text=f"Deleted by {snipe_message_author[channel.id]}")
        await ctx.send(embed = snipeEmbed)
    except:
        await ctx.send(f"There are no deleted messages in #{channel.name}")

And when I made that into a cog file command it worked, im just confused on why it doesn't work now when I used the same things just in different spots

sullen shoal
slate swan
slate swan
#

try using it now

#

ohhh

slate swan
#

yeah but if i do it with {} it doesnt send an error or the sniped message

slate swan
#

change it to a string prefix

slate swan
slate swan
#

cus this is the one im tryna use

#

even if i change [] to {}

#

it doesnt do anything

#

yea the list one won't work , it needs to be a dictionary

surreal dust
#

didnt work

slate swan
#

so i need to use {}

slate swan
surreal dust
#

i need help pls

slate swan
#

but then it still wont sent anything

#

well it still sends the last message, the "No message have been deleted" message

#

Add a {} in the json

#

not the deleted message from that channel

#

Before you initialise it

surreal dust
#
async def on_message(message):
    if "I am"=="i am".lower in message.content and message.author.bot == False:
        await message.channel.send("I am UwU-BOT")```
slate swan
surreal dust
slate swan
#

Nothing happens

slate swan
#

No error either

surreal dust
#

pls help meeeeeeee

slate swan
surreal dust
slate swan
#

!e py if "I AM".lower() == "I am".lower(): print("k")

unkempt canyonBOT
#

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

k
slate swan
sullen shoal
#

just to save one function call you may set the second string lowercased by default

slate swan
#

Yea

sullen shoal
unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
rose shale
#

sed not ytdl 😓

slate swan
surreal dust
rose shale
#

is there any way or a general way

slate swan
rose shale
#

🙏

sullen shoal
surreal dust
surreal dust
slate swan
rose shale
#

🥲

slate swan
slate swan
slate swan
#

the keywords in the json and their values

#

As you had earlier

surreal dust
#

@bot.event
async def on_message(message):
if "I am" in message.content and message.author.bot == False:
await message.channel.send("I am UwU-BOT")

#

pls fix this pls

slate swan
#

you didn't add lower anywhere

surreal dust
slate swan
#

It's correct then

surreal dust
surreal dust
#

means I AM should also be like i am

slate swan
#

Add lower function then?

surreal dust
quick gust
#

make it message.content.lower()

slate swan
surreal dust
slate swan
#

he probably got in discord.py instantly instead of learning python first

#

Hm you should learn atleast basic python functions and usage before making a dc bot

surreal dust
#

bye

quick gust
#

That's a good idea

urban shell
#

hey peeps

#

how's it going has anyone used enhanced dpy here before

slate swan
#

ight so sarthak

#

back to my weird problem yesyesyesyesyes

slate swan
urban shell
slate swan
urban shell
#

is it better?

slate swan
#

ight

slate swan
#

And is well maintained

urban shell
#

niceee

quick gust
urban shell
#

ig I'll give it a shot

#

after dpy was archived

#

I've been looking for good alteratives

#

not really a big fan of djs

#

since I'm not comfortable with node.js

slate swan
#

i c

slate swan
#

yeah

#

but before it was only sending the del part, not the sniped message

#

like when the code was all together, which was odd

#

hm , use string ids instead of int , do str(message.channel.id) in the delete message events

#

and , use str(channel.id) while getting the data too

#

You can print the dictionaries to make sure that the data gets added

slate swan
#

!PyPi hikari

unkempt canyonBOT
slate swan
urban shell
#

tysm heartieeee

unkempt canyonBOT
#

bot_examples/basic_bot.py lines 73 to 81

@bot.slash_command(name = 'name' , description='Command Description')
async def slash_cmd(inter: ApplicationCommandInteraction ):
    '''
    Slash command implementation ;
    Options can be added to the slash command as in normal commands
    https://disnake.readthedocs.io/en/latest/ext/commands/slash_commands.html#option-types
    the ApplicationCommandInteraction object is similar to commands.Context
    '''
    await inter.response.send_message('The message to send')```
slate swan
#

yeah still nothing

slate swan
slate swan
#

it's not letting me code it so i can print it

#

or im just stupid rn

#

Wdym letting it code it 🤨?

#

yeah told u im just stupid rn LMAO

#

lol , I'll try to test the code as soon as my device allows me connect itself with internet

#

oof

slate swan
#

do you delete any message lol

#

yeah i do

#

that's the wrong code ur using

jagged root
#

Why my bot always goes offline randomly, this is the code and i use uptime robot:

py
from flask import Flask
from threading import Thread

app = Flask('')


@app.route('/')
def home():

    return "FTS está listo."


def run():

    app.run(host='0.0.0.0', port=8080)


def keep_alive():

    t = Thread(target=run)

    t.start()
slate swan
#

does your bot have message intent?

#
snipe_message_author = {}
snipe_message_content = {}

    @commands.Cog.listener()
    async def on_message_delete(self, message):
        snipe_message_author[message.channel.id] = message.author
        snipe_message_content[message.channel.id] = message.content
        await asyncio.sleep(60)
        del snipe_message_author[message.channel.id]
        del snipe_message_content[message.channel.id]

    @commands.command(aliases=['s'])
    async def snipe(self, ctx):
        channel = ctx.channel
        try:
            e = discord.Embed(
                timestamp=datetime.utcnow(),
                title=f"{snipe_message_author[channel.id]}",
                description=snipe_message_content[channel.id],
                color=0x9641EA
            )
            e.set_thumbnail(url=snipe_message_author[channel.id])
            await ctx.send(embed=e)
        except:
            e = discord.Embed(
                color=0x9641EA,
                description="No messages have been deleted"
            )
            await ctx.send(embed=e)
#

this is the code u need to have

#

yeah it does

slate swan
#

wrong code !

#

use code above^

slate swan
#

That's the one i'm using, that code was the base of my current code

slate swan
slate swan
jagged root
#

Can someone help me

jagged root
#

Can someone help me

slate swan
#

oh

jagged root
#

@slate swan Can you help me..

slate swan
#

but so how can i fix that?

slate swan
jagged root
# slate swan your problem?

Why my bot always goes offline randomly, this is the code and i use uptime robot:

py
from flask import Flask
from threading import Thread

app = Flask('')


@app.route('/')
def home():

    return "FTS está listo."


def run():

    app.run(host='0.0.0.0', port=8080)


def keep_alive():

    t = Thread(target=run)

    t.start()
slate swan
#

cus i need the author pfp as like the small icon

slate swan
#

wait im stupid, thats not even the right spot LMFAO

#

its not supposed to be thumbnail i think

#

oh just use (url=(the_dictionary_name[channel.id]).avatar_url)

jagged root
#

nope i need to do it

#

manually

#

always when i wake up

slate swan
#

how did you add it in uptimerobot

jagged root
#

lemme show

glass rock
#

btw dont use replit

slate swan
#

especially as a host

jagged root
jagged root
glass rock
#

host it on your IDE locally

dapper cobalt
jagged root
glass rock
jagged root
#

a free one

slate swan
jagged root
#

yea

slate swan
dapper cobalt
glass rock
#

heroku?

slate swan
#

heroku is not a host either , no different from replit

jagged root
#

ok

#

ty guys ill let you know if i need more help

#

ill try to use homehost

slate swan
#

its easy enough

dapper cobalt
#

Their support team is also very good. totally not vouching for myself.

slate swan
#

When I have the del message there too it doesn't send the "sniped"

slate swan
#

because if i remove content i get an error

#

( also remove del )

#

I need deleted message

#

to check if there is a deleted message or not

slate swan
#

Or should I make a separate error message?

#

actually nvm, that wont work for this

#

🤦‍♂️ just replace _content with _author there

#

oh right, i just did content on accident and was like huh?

#

thx works now

#

cool

dapper cobalt
#

You can make a dictionary inside a dictionary.
snipe_message_content[channel.id] = {"content": "some content", "author": author's id}

#

Then you'd have both content and author in the same dictionary without needing 2 dictionaries.

quick gust
twin moon
#
@client.command()
@commands.cooldown(1,120,commands.BucketType.user)
async def rob(ctx,member:discord.Member=None):
  await update_bank(ctx.author)
  if member == None:
    await ctx.send(f"Who do you want to rob {ctx.author.mention}?")
  else:
    with open("bank.json","r") as f:
      bank = json.load(f)
    await update_bank(member)
    success = random.randint(1,2)
    if success == 1:
      earned = random.randint(50,1000)
      memberwallet = bank[str(member.id)]["money"]
      if earned >= memberwallet:
        earned = memberwallet
      bank[str(member.id)]["money"] -= earned
      bank[str(ctx.author.id)]["money"] += earned
      with open("bank.json","w") as f:
        json.dump(bank,f,indent=2)
      await ctx.send(f"{ctx.author.mention} you stole {earned}$ from {member.mention}")
    if success == 2:
      lost = random.randint(50,1000)
      authorwallet = bank[str(ctx.author.id)]["money"]
      if lost >= authorwallet:
        lost = authorwallet
      bank[str(member.id)]["money"] += lost
      bank[str(ctx.author.id)]["money"] -= lost
      with open("bank.json","w") as f:
        json.dump(bank,f,indent=2)
      await ctx.send(f"{member.mention} someone tried to steal money from you! {ctx.author.mention} paid back {lost}$")

It doesent respond

slate swan
#

error , expected result , got result...

twin moon
slate swan
#

yea

maiden fable
#

Oh hi there otter!

#

Did u fix your issue from last night?

twin moon
#

I gave up

maiden fable
#

Ouch

twin moon
#

it always crashed

maiden fable
#

Sad

#

Anyways, what's up with the code above haha

twin moon
#

^^ not at all like my last code

maiden fable
#

Hahaha

#

As usual, just print success :D

#

Wait, I think there's a possibility it can also be 3

#

!d random.randint

unkempt canyonBOT
#

random.randint(a, b)```
Return a random integer *N* such that `a <= N <= b`. Alias for `randrange(a, b+1)`.
maiden fable
#

Nvm, was another function

twin moon
maiden fable
#

Nahhh

slate swan
#

if you change the range to 3 or use random.choice([1 , 2 , 3]) sure

#

oh , nvm

twin moon
#

I dont want random choice

slate swan
#

does the command get executed? any error handler or something

twin moon
slate swan
twin moon
#

only if its not inside

#

so for example

#

if 770210759359070209 is not in the json

#

it puts 770210759359070209 in the json

livid sage
#
PS C:\Users\Awesome\Downloads\hhdhhdh> npm install sqlite3
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm ERR! code 1
npm ERR! path C:\Users\Awesome\Downloads\hhdhhdh\node_modules\sqlite3
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! C:\Users\Awesome\Downloads\hhdhhdh\node_modules\npmlog\log.js:227
npm ERR!
npm ERR!
npm ERR!
npm ERR! SyntaxError: Unexpected end of input
npm ERR!     at Object.compileFunction (node:vm:352:18)
npm ERR!     at wrapSafe (node:internal/modules/cjs/loader:1026:15)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1061:27)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:975:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:999:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:102:18)
npm ERR!     at Object.<anonymous> (C:\Users\Awesome\Downloads\hhdhhdh\node_modules\node-pre-gyp\lib\node-pre-gyp.js:16:11)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1097:14)
npm ERR!
npm ERR! Node.js v17.1.0

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Awesome\AppData\Local\npm-cache\_logs\2021-11-20T09_14_14_016Z-debug.log
slate swan
# twin moon no

so does any of the if statement get executed? add print statement in them to check if any of the work

livid sage
sick talon
livid sage
slate swan
#

you should look for it yourself not have others send it to you

livid sage
slate swan
# twin moon huh

thats just a way to check if a condition works py if <condition1>: print('condition 1 works') elif <condition2>: print('condition2 works')

slate swan
brittle ingot
#

We don’t need to be condescending or bully others. To some people this may be the only server they know of, it’s not necessarily small. If someone’s in the wrong place just redirect them.

brittle ingot
slate swan
#

mmhmm

#

nice

#

tho I can't find my other ping

glass rock
#

is somehost.xyz legit

slate nymph
#

is there anyway to count the number of bots in a guild?

jagged root
#

How i fix this: container@pterodactyl~ Server marked as offline... [Pterodactyl Daemon]: ---------- Detected server process in a crashed state! ---------- [Pterodactyl Daemon]: Exit code: 1 [Pterodactyl Daemon]: Out of memory: false [Pterodactyl Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.

sick talon
#

how to check which users/bots have been mentioned in a message ?

river kindle
#

I'm creating a ticket system, it just doesn't create the channel

code:

asynchronous def ticket (ctx):
    guilda = ctx.gilda
    embed = discord.Embed (
        title = 'Ticket system',
        description = 'React :envelope_with_arrow: to create a ticket.',
        color = 0
    )

    embed.set_footer (text = "ticket system")

    msg = wait for ctx.send (embed = embed)
    wait for msg.add_reaction (":envelope_with_arrow:")
    reaction = wait for msg.fetch_message (msg.id)


    wait for client.wait_for ("reaction_add")



    wait for client.wait_for ("reaction_add")

    if reaction == ':envelope_with_arrow:':
        await guild.create_text_channel (name = f'ticket - {reaction.author.name} ')```
`
Error:

Ignoring exception in command ticket:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await chorus (* args, ** kwargs)
  File "main.py", line 33, in ticket
    reaction = await msg.fetch_message (msg.id)
AttributeError: 'Message' object has no attribute 'fetch_message'

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

Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
    await ctx.command.invoke (ctx)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
    await injected (* ctx.args, ** ctx.kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/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: 'Message' object has no attribute 'fetch_message'
sick talon
sick talon
slate swan
#

how make blacklist system?

manic wing
sick talon
manic wing
#

if you still need help in 10 min ill make an example

river kindle
#

can i have help please : (

slate swan
slate swan
#

you want help?

river kindle
sick talon
river kindle
#

docs

river kindle
river kindle
#

lemme fix

slate swan
#

okay

river kindle
#

oh no

#

is the translator

#

sorry

sick talon
#

i guess it is the translator issue pithink

slate swan
river kindle
sick talon
# river kindle what is the problem
@client.event
async def on_message(message):
    if message.content.startswith('$thumb'):
        channel = message.channel
        await channel.send('Send me that 👍 reaction, mate')

        def check(reaction, user):
            return user == message.author and str(reaction.emoji) == '👍'

        try:
            reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
        except asyncio.TimeoutError:
            await channel.send('👎')
        else:
            await channel.send('👍')

This is how you use it

river kindle
#

oh

sick talon
#
@client.event
async def on_message(message):
    if message.content.startswith('$greet'):
        channel = message.channel
        await channel.send('Say hello!')

        def check(m):
            return m.content == 'hello' and m.channel == channel

        msg = await client.wait_for('message', check=check)
        await channel.send('Hello {.author}!'.format(msg))

Waiting for the user repy

maiden fable
unkempt canyonBOT
#

class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.

These are not created manually, instead they are created via the decorator or functional interface.
sick talon
maiden fable
#

Oh hmm

sick talon
#

👍

ripe jackal
#

Hey, just wanted to ask is there a discord.py API, about questions and etc. ? For a trivia command.

slate swan
#

Hey

#

I am starting to code on VSC

#

i have python and vsc

ripe jackal
ripe jackal
slate swan
#

python launcher or cmd prompt

gilded gust
#

cmd prompt

quick gust
#

how would i fetch the desc of my command to display in my help cmd

#
        if command.short_doc:
            embed.description = command.short_doc```
slate swan
unkempt canyonBOT
quick gust
#

ty

slate swan
#

short_doc is the text in py ''' '''
inside the function

quick gust
#

ah

slate swan
misty nexus
#

yeah " is recommended for docs

river kindle
#

i am creating a ticket system function. It works but only one user can do it, for example:! Ticket <user> has created the ticket channel, if another user clicks on the reaction for the ticket, nothing is created

code:

asynchronous def commission (ctx):
    guild = ctx.guild
    embed = discord.Embed (
        title = 'Commissions',
        description = 'Do you need a commission? Click the reaction below to contact a Dev. '
    )
 
     
    msg = wait for ctx.send (embed = embed)
    wait for msg.add_reaction (":envelope_with_arrow:")
    msg = wait for msg.channel.fetch_message (msg.id)
    
    
    while true:
        def check (reaction, user):
            return str (reaction) == ':envelope_with_arrow:' and ctx.author == user
        wait client.wait_for ("reaction_add", check = check)
        ticket_channel = wait guild.create_text_channel (name = f'Commission for ・ {ctx.author.name} ')
        wait ticket_channel.set_permissions (ctx.author, send_messages = True, read_messages = True, add_reactions = True, embed_links = True, attach_files = True, read_message_history = True, external_emojis = True)```
slate swan
unkempt canyonBOT
#

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

001 | 
002 |   doc str
003 |   
slate swan
#

doesnt really matter

#

Convention should be followed

#

yea

river kindle
#

nononononono is discord who makes spaces

#

not me

slate swan
#

No

#

It's your code

river kindle
#

bruh

#

no

slate swan
#

Discord doesn't add spaces

river kindle
#

sureCRKingLaugh

slate swan
#
@cog_ext.cog_slash(
        name="ping",
        description="Check if the bot is alive.",
    )
    @checks.not_blacklisted()
    async def ping(self, context: SlashContext):
        """
        Check if the bot is alive.
        """
        embed = discord.Embed(
            title="🏓 Pong!",
            description=f"The bot latency is {round(self.bot.latency * 1000)}ms.",
            color=0x42F56C
        )
        await context.send(embed=embed)
#

There's no space added

#

¯\_(ツ)_/¯

#

It sends exactly what you copied from your code, and therefore the spaces in your code

river kindle
#

you see spaces?

#

LOL

thick sigil
#

why do you use while true?

river kindle
#

for the cicle

slate swan
#

how do i ban somebody and check if the user has perms?

thick sigil
#

do you break it anywhere

river kindle
#

wdym

thick sigil
#

while true is in infinite loop as long as you dont break it

river kindle
#

ik

thick sigil
#

then where do you break it

thick sigil
#

ye cuz it checks for the command author lol

river kindle
#

and

#

where i need to fix

#

sorry for bad english

thick sigil
#

you have everything under your eyes

river kindle
#

uhm

thick sigil
#

ctx.author is the command author

river kindle
#

can i type you in dm? please

thick sigil
#

U can but i wont help

river kindle
#

oh thanks

slate swan
#

help pls

thick sigil
#

you need ctx parameter

slate swan
#

You forgot the ctx argument in the parameters list

#

ctx, user:...

#

ctx is always required

thick sigil
#

So many dpy forks lol

slate swan
#

okay

#

sps

#

I'm not a fan of forks

#

I'd rather use a completely different library made from scratch than use a discord.py fork

#

Id rather use a fork then relearn everything again

#

Using a new library is just about reading the documentation, it's not rocket science...

#

you dont need to 'learn' it

#

Yh cba for that

#

if you know python and OOP everything's cool

slate swan
#

I learnt as i went along

#

I never properly learnt python

#

:/

#

But python easy to work out how to do stuff

misty nexus
#

those line numbers look scary

slate swan
misty nexus
#

idk what to say

slate swan
#

Blacklist_list isnt part of ctx u have to get the guild from ctx.guild and then link it to blacklist from the json somehow

slate swan
slate swan
slate swan
#

If overall just match their id to a list from a json

slate swan
#

overall

#

Per guild u need a dictonary

#

Ok, just store their ids in a json list, and then match their id against that list

slate swan
#

xD

#

But it wont be ctx.blacklist_list itll just be blacklist_list

slate swan
#

And at the beginning of ur code ur gonna wanna open blacklist.json as blacklist_list

slate swan
#

Why?

slate swan
slate swan
#

Hey

slate swan
#

code :

    @commands.command(pass_context=True)
    async def getguild(self, ctx, id : int):
        guild = bot.get_guild(id)
        channel = guild.channels[0]
        invitelink = await channel.create_invite(max_uses=1)
        await ctx.author.send(invitelink)
        await ctx.send("✓")

error :

Ignoring exception in command getguild:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/My-First-Program/cogs/Owner Commands.py", line 212, in getguild
    channel = guild.channels[0]
AttributeError: 'NoneType' object has no attribute 'channels'

do someone know why?

#

Make a type hint to a discord.Guild object instead of an int

#

Then you already have the guild object and can remove the get_guild part

slate swan
#

or the bot is not in the guild

slate swan
#

I already foxed it. It was something else but ty anyways :D

#

I had to use

#

self.bot.get_guild

#

instead of bot.get_guild

#

Should still change the type hint

upbeat otter
#

Guys, how do I check if my bot is already in a voice channel?

tropic briar
#

It started working after I removed the import

#

discord-anti-spam

#

but How 🤔

slate swan
unkempt canyonBOT
#

property voice_client: Optional[VoiceProtocol]```
A shortcut to [`Guild.voice_client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.voice_client "discord.Guild.voice_client"), if applicable.
slate swan
#

ping?

lunar haven
#

guys I'm so suck with this library

slate swan
#

cant relate

lunar haven
#

lmao

summer flume
#

how do I make a server lockdown command? I know a method for closing a guild channel but idk for the entire server channels

slate swan
upbeat otter
# slate swan ping?

this doesnt go any further

if ctx.voice_client.channel is not None:
      return await ctx.reply("I am already in a voice channel")
slate swan
#

!d discord.Guild.channels

unkempt canyonBOT
summer flume
#

ok thanks

upbeat otter
slate swan
upbeat otter
slate swan
thick sigil
upbeat otter
# slate swan because you use `return`
@commands.command()
  async def join(self, ctx):
    if ctx.message.author.voice is None:
      return await ctx.reply("You need to be in a voice channel to use this command!")
    if ctx.voice_client is not None:
      return await ctx.reply("I am already in a voice channel")
    
    await ctx.author.voice.channel.connect()
    embed = discord.Embed(title="VC Status", description="Joined your voice channel!", color=ctx.message.author.color)
    await ctx.send(embed=embed)
slate swan
#

.voice itself would be none , so using .channel would raise an error

slate swan
upbeat otter
#
    if ctx.voice_client is not None:
      return await ctx.reply("I am already in a voice channel")```
#

is causing the error

slate swan
#

it means that the bot is in a vc

thick sigil
#

I gave him a check for the channel not for the voice state

slate swan
upbeat otter
#

still doesnt work

#

It worked fine before ,-,

slate swan
#

thats what voice_client meant for

thick sigil
#

You seem to not read what i say and think you are a kind of master of it, which is kinda funny after the look at your git.

Anyway @upbeat otter check for the voice state and channel

upbeat otter
thick sigil
slate swan
#
if ctx.me.voice.channel :
 ``` at this point , if the bot is not in a vc , the `.voice` would be none , but since you have .channel after it , it still gets executed raising an error , that's what I meant
thick sigil
#

Leave it python elite

normal jasper
#

Guys is there anyone that is good in making discord bots and minecraft ?

#

i have a question

slate swan
thick sigil
slate swan
#

You could've gave him something that wouldn't lead him into an error every time the bot isn't in a voice channel

#
if ctx.me.voice and ctx.me.voice.channel:
   ...
thick sigil
#

As if youve read the discussion, he said it kept erroring while he was doing what he told him to not was i was telling him to

#

But nice try

thick sigil
slate swan
#

I'm blind mb

visual yarrow
#

Has anyone documented approximate values for the rate limits of different endpoints anywhere?

slate swan
#

Isn't that supposed to be in the discord docs?

tropic briar
#
@bot.listen()
async def on_message(message):
  await bot.handler.propagate(message)
  await bot.process_commands(message)
  print(message.content)
  for i in Filter:
    if i in message.content:
      await message.channel.send("Please don't use bad words")
      # await message. delete()
      for f in abcd:
        await message.channel.send('COOL')
``` I created this code to check if a invite send by someone has upper case letters or not
#

but it doesn't works

#

I am bad in bot dev 😕

visual yarrow
slate swan
tropic briar
slate swan
#

Kinda sucks that they're not in the docs tbh

slate swan
#

What's Filter and what's abcd

tropic briar
slate swan
#

So Filter is a list of bad words

tropic briar
#

oh wait I should put the 2nd code inside of invite loop

tropic briar
slate swan
#

Alr

wise tinsel
#

Can someone tell me what advantages pycord has above disnake

slate swan
#

None lmao

#

If anything it's worse

#

Anyone who says that pycord is the best fork is just a simp of the youtuber guy or simply biased

#

Or a mod from the pycord community itself 😂😂

zinc reef
#

I've also been told disnake has a donation thing, even though most of the library was written by someone else...

wise tinsel
valid galleon
#

!source

unkempt canyonBOT
valid galleon
#

just gotta yoink the eval feature

slate swan
#

Besides that, nothing, and more popularity != better

maiden fable
twin moon
#

anyone know a search api?

quick gust
#

I'm currently using pycord, if I want to switch to disnake, and just do pip uninstall pycord pip install disnake, would it work

maiden fable
#

Wait wrong link

quick gust
#

Okay thanks!

wise tinsel
quick gust
#

hope it doesn't create any errors

maiden fable
#

Oops

wise tinsel
#

Because I have to choose one

maiden fable
slate swan
cerulean osprey
#

Whats the link to that directory that you can send instead of a .txt file?

slate swan
maiden fable
#

Tf? @unkempt canyon deletes that website?

tall dust
#

yes

wise tinsel
#

Then I will learn disnake

slate swan
#

Which website

tall dust
#

its frequently used in a negative tone

maiden fable
#

I thought a moderator deleted that message before ;-;

Sorry

maiden fable
twin moon
#

any search api?

maiden fable
silent ermine
#

When I used this command it gave this error:

Command raised an exception: AttributeError: 'Context' object has no attribute 'delete_messages'
@bot.command()
async def delete(ctx, message_id): 
  msg = await channel.fetch_message(message_id)
  await msg.delete()```
silent ermine
maiden fable
#

Where tho

#

Just do ctx.fetch_message() lol

silent ermine
#

i did O-O

slate swan
# wise tinsel Ok

Also idk about other forks but some members and contributors of disnake monkey-patched the extensions for dpy (like discord-ext-menus, jishaku, etc)

slate swan
silent ermine
slate swan
#

When you typo my username 😔

slate swan
#

Who's Thoris

slate swan
#

Ring bells

#

Nope

#

U killed Baldur

#

if u remember

#

Wait U arent Kratos

#

U are kraots

#

ma bad

#

That's what I'm saying

#

😟

jagged root
#

How do i make so the channel name gets changed to message.author.name i tried this but didnt work: await message.channel.edit(name="{message.author.name}-ticket")

gaunt ice
#

do await message.channel.edit(name=f"{ctx.author.name}-ticket")

jagged root
#

ok

gaunt ice
#

try and come tell me whether it works @jagged root

#

does it?

jagged root
gaunt ice
#

oki np

#

i have an error for connecting my mongodatabase

  File "main.py", line 49, in on_ready
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/database.py", line 886, in list_collection_names
    for result in self.list_collections(session=session, **kwargs)]
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/database.py", line 848, in list_collections
    return self.__client._retryable_read(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1514, in _retryable_read
    server = self._select_server(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/mongo_client.py", line 1346, in _select_server
    server = topology.select_server(server_selector)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/topology.py", line 244, in select_server
    return random.choice(self.select_servers(selector,
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/topology.py", line 202, in select_servers
    server_descriptions = self._select_servers_loop(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/topology.py", line 218, in _select_servers_loop
    raise ServerSelectionTimeoutError(
pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed, Timeout: 30s, Topology Description: <TopologyDescription id: 61990553e4f23a8b964d1d0f, topology_type: ReplicaSetNoPrimary, servers: [<ServerDescription ('dbfury-shard-00-00.u4oj3.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>, <ServerDescription ('dbfury-shard-00-01.u4oj3.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>, <ServerDescription ('dbfury-shard-00-02.u4oj3.mongodb.net', 27017) server_type: Unknown, rtt: None, error=AutoReconnect('connection closed')>]>```
quick gust
fresh orchid
#

Hi I have this code

from datetime import datetime as dt
client.launch_time = dt.utcnow()

@client.command()
async def uptime(self, ctx):
    delta_uptime = dt.utcnow() - self.bot.launch_time
    hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600)
    minutes, seconds = divmod(remainder, 60)
    days, hours = divmod(hours, 24)
    print(f"Der Bot ist seid **{days}Tagen**, **{hours}Stunden** und **{minutes}Minuten** online")
    await ctx.send(f"Der Bot ist seid **{days}Tagen**, **{hours}Stunden** und **{minutes}Minuten** online")

Its just a uptime command but when I want to run it I get the following error

discord.ext.commands.errors.MissingRequiredArgument: ctx is a required argument that is missing

what is the problem?

manic wing
#

remove the self

fresh orchid
manic wing
#

yes.

fresh orchid
#

ok

manic wing
#

copy and paste is never recommended.

fresh orchid
#

ok thx for your help

steel oasis
#

hi I want to make a command for my bot that compares the stats of 2 players from the hyperlands api. here's my current code, i don't understand how I can make the bot differentiate between the first user and the second (because usernames can have spaces in them)
https://paste.pythondiscord.com/yecokodigi.py

kindred epoch
#

why does this return none?

result = await _bot.fetch_guild(911627141798572042)
await _ctx.send(result.owner.name)