#discord-bots

1 messages · Page 557 of 1

lunar helm
#

it will break when done with the loop

slate swan
#
        member_counts = self.get_member_counts(ctx.guild)
        member_info = "\n".join(f"{role}: {count}" for role, count in member_counts.items())
        embed.add_field(name=f"Members: {total_members}", value=member_info)

returns the everyone role too, how can I remove it?

slate swan
rocky trench
#

I got no idea

slate swan
#

oh no

slate swan
#

they are typing

hasty iron
hasty iron
#

guessing member_counts is a mapping of Role and something else

slate swan
#

member_counts = self.get_member_counts(ctx.guild)

hasty iron
#

?

slate swan
#

thats not the issue tho

slate swan
#

its in the member_info

hasty iron
#

what?

#

?? what are you talking about

slate swan
#

my role

slate swan
slate swan
#

alr

#

@slate swan what does the if role.name != @@everyone do here? I need to delete @@everyone?

#

dude

#

i can't

#

why am i even helping you

hasty iron
#

learn python

reef shell
#

when you use ctrl+c & ctrl+v and then u go unga bunga

slate swan
#

^^

#

i know what the if statement does

#

but why is it thre

#

when i need to delete it

hasty iron
#

learn python list comprehensions

slate swan
#

ok after im done with this one

final pumice
#
@client.event
async def on_message(message):
    if message.content == "What are some things you can do GHP Bot?":
            channel = client.get_channel(id)
            await channel.send("I can interact with users who call me! Ask me some things!")
#

This is not running when I say the message

#

What is wrong with it

hasty iron
#

what is id

final pumice
#

The id of the channel

#

Its in there

hasty iron
#

id is a built in function if you haven’t defined it

final pumice
#

Here, ill put it with the id

slate swan
#
        member_info = "\n".join(f"{role}: {count}" for role, count in member_counts.items())
        embed.add_field(name=f"Members: {total_members}", value=member_info)```
so what I want to do here is that I want to remove the `@@everyone` role in member_info, how would I do this?
reef shell
final pumice
#
@client.event
async def on_message(message):
    if message.content == "What are some things you can do GHP Bot?":
            channel = client.get_channel(901637744743313488)
            await channel.send("I can interact with users who call me! Ask me some things!")```
dapper cobalt
#

Were you afraid of sharing a channel's ID?

final pumice
#

There

final pumice
dapper cobalt
slate swan
#

ahh i see

#

and i do that by doing index[1:] right?

#

or is it [:1]

hasty iron
#

you cant with a dict

slate swan
#

its a list

hasty iron
#

???

#

very smart

slate swan
#

membe_counts

final pumice
#

So?

slate swan
#

is something else

hasty iron
#

!d dict.items

unkempt canyonBOT
#

items()```
Return a new view of the dictionary’s items (`(key, value)` pairs). See the [documentation of view objects](https://docs.python.org/3/library/stdtypes.html#dict-views).
slate swan
#

member_counts is a dict, not member_info

hasty iron
#

member_info isn’t a list either

reef shell
#

It's a strblobsweatsip

slate swan
#

^^

hasty iron
#

try my first suggestion, del the guild.default_role key

slate swan
#

what

hasty iron
#

what?

slate swan
#

wdym

hasty iron
#

do you know what del is

slate swan
#

yes

hasty iron
#

then it should be easy to do

dapper cobalt
#

It's a keyword, just like if. (Or at least similar)

hasty iron
#

i don’t see what’s confusing

slate swan
hasty iron
#

what…

reef shell
#

...

dapper cobalt
#

I thought patrons are smart.

slate swan
hasty iron
#

are you fucking kidding me

slate swan
#

unless it's just this guy

#

he's a little more "special" 😂

dapper cobalt
#

@slate swan Remove the guild.default_role from the member's roles dict because this is the everyone role.

slate swan
#

but how can it change the other variable

hasty iron
#

learn python

dapper cobalt
#

What other variable?

slate swan
dapper cobalt
#

It changes it, by changing it. bigbrain

slate swan
#

ohhhhh

reef shell
slate swan
hasty iron
#

no shot

final pumice
#
@client.event
async def on_message(message):
    if message.content == "What are some things you can do GHP Bot?":
            channel = client.get_channel(901637744743313488)
            await channel.send("I can interact with users who call me! Ask me some things!")```
#

What is wrong????

slate swan
#

they will make fun of you

final pumice
#

idc

#

i just want it to work

dapper cobalt
final pumice
#

Nope

slate swan
slate swan
hasty iron
final pumice
dapper cobalt
slate swan
#

^

slate swan
slate swan
slate swan
#

by far prolly the most braindead person i've talked to 😂

hasty iron
#

yep you used del because we told you to

slate swan
#

^^

#

why you insulting me 😦

#

that's against the law

#

and the ToS

#

🤣

hasty iron
#

sorry patreon 2

slate swan
#

another issue

#

i have

hasty iron
#

what is it

dapper cobalt
final pumice
dapper cobalt
slate swan
#
features = f"\nFeatures: {', '.join(ctx.guild.features)}"

this, when features is empty, i want it not to get printed in:

embed.description = (
            f"Created: {created}"
            f"\nVoice region: {region.title()}"
            f"{features}"
            f"\nRoles: {num_roles}"
            f"\nMember status: {member_status}"
        )
#

how do i do that

final pumice
#
@client.event
async def on_message(message):
    if message.content == "What are some things you can do GHP Bot?":
            await message.channel.send("I can interact with users who call me! Ask me some things!")```
final pumice
#

@dapper cobalt

slate swan
#

and if it is?

hasty iron
#

dont add it to the description?

slate swan
#

example code?

dapper cobalt
devout iris
#
@bot.command()
async def ping(ctx):
    embed = discord.Embed(
        title = (str("**Pingim**"), int(bot.latency*1000), str("**MS**"))),
        description = ""
        
    )
    await ctx.send(embed = embed)

i don't want to see ' and (

hasty iron
slate swan
#

why

slate swan
hasty iron
#

its a single if statement

slate swan
#

no it isn't

#

it is

hasty iron
#

checking if the list is empty is

dapper cobalt
slate swan
#

btw isn't KeyError: 'life' syntax error?

final pumice
hasty iron
slate swan
final pumice
reef shell
slate swan
#

KeyError is what's printed in the console when a key you're trying to access inside a dict isn't there (and if you're using dict[key])

dapper cobalt
slate swan
#

😂

slate swan
#

because 0 is nothing

slate swan
dapper cobalt
slate swan
dapper cobalt
#

You are bad at maths too??

hasty iron
slate swan
#

this guy is 9 i bet

#

btw i fucking solved my issue

#
features = f"\nFeatures: {', '.join(ctx.guild.features)}"
        if features == "\nFeatures: ":
            features = ""
hasty iron
#

WOAH NO WAY

final pumice
#

i kill the terminal and run it

slate swan
#

i don't need to learn python no more

#

im smart and i proved it

reef shell
slate swan
slate swan
#

so

reef shell
#

i'm disqualified?☹️

final pumice
#

It literally doesn't respond

slate swan
#

1 equal 1 (something). 0 equals 0 (nothing). 100 (something, nothing, nothing) technically equals to (something), which means 100 = 1

dapper cobalt
final pumice
#

alr

dapper cobalt
#

!e

print(001)
unkempt canyonBOT
#

@dapper cobalt :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(001)
003 |           ^^
004 | SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
slate swan
#

its always nothing

dapper cobalt
#

See.

slate swan
#

no its always nothing

hasty iron
#

no point arguing

reef shell
#

^

hasty iron
#

leave the troll be

slate swan
#

troll?

#

im pretty serious

#

like think about it

dapper cobalt
#

No.

brave vessel
#

What’s even going on here??

reef shell
#

I'd like to say paid troll

slate swan
#

what really is 0?

slate swan
#

come on now, isn't it more fun helping out someone like me, or someone who just says "ok, understand, ill fix it myself, bye"

brave vessel
#

Isn’t this channel supposed to not bash beginners and not gatekeep “intelligence” in Python

#

It’s in the pinned messages I think

hasty iron
#

read the whole conversation please

brave vessel
#

Not sure whatever’s going on though

#

Just read the part about “use an f-string not whatever that ugly code is”

brave vessel
#

You’re good

dapper cobalt
#

Shouldn't have that said tbh.

brave vessel
#

I think you just got worked up over the argument

#

What’s going on in here tho, like a TLDR

slate swan
brave vessel
#

Oh, that’s what’s going on

unkempt canyonBOT
slate swan
#

anyway back to topic

reef shell
#

Sir, we do respect your intelligence

slate swan
#

how do I install the master d.py

brave vessel
#

Any of you all making discord bots right now, if so what kind of bot?

brave vessel
hasty iron
#

im struggling with implementing voice

slate swan
#

idk, just the master one

brave vessel
hasty iron
#

yesh

slate swan
brave vessel
hasty iron
#

i got opus and stuff done, but i have to use ffmpeg and some other bullshit

slate swan
reef shell
brave vessel
#

Ohh you mean master branch

#

what SHERLOCK said

slate swan
#

I don't have git?

hasty iron
#

install it

slate swan
#

can I do this without installing git? i dont like git

hasty iron
#

nope

brave vessel
slate swan
#

what happens if i remove git after i installed it

brave vessel
cloud dawn
#

I mean you could download to code on the website and the manually put it in the modules folder

brave vessel
hasty iron
dapper cobalt
slate swan
brave vessel
#

git is a renowned tool.

hasty iron
reef shell
dapper cobalt
vocal plover
#

Do you not like git or do you not like using git? If it's the latter then just don't use it when installed, if it's the former, why?

slate swan
vocal plover
#

No

hasty iron
#

no

dapper cobalt
slate swan
#

why?

vocal plover
#

Because he hasn't joined

brave vessel
reef shell
slate swan
hasty iron
#

ok dud

dapper cobalt
#

Oh my god

vocal plover
#

No this is, as the name suggests, the python discord server

cloud dawn
reef shell
#

(2)

dapper cobalt
#

I'm this 🤏 close to losing it.

reef shell
#

^

cloud dawn
#

Loving the Halloween theme btw

#

:3

slate swan
vocal plover
#

I mean

#

Kinda

cloud dawn
#

Some random dude also decided to make python

dapper cobalt
#

Discord has an official RESTAPI, and this "random" person has made a Python wrapper for it that made him 'famous'.

vocal plover
#

In the same way as anyone good at something who ends up being notable is random

slate swan
#

rapptz, imagine how many bots he can hack

dapper cobalt
#

Some random dude made Discord.

dapper cobalt
hasty iron
slate swan
#

why? he's the owner of discord?

reef shell
#

Omegalul

vocal plover
dapper cobalt
#

I'm done

brave vessel
#

He can’t actually hack any - he’s just someone who made the wrapper

slate swan
#

what exactly is a wrapper btw

slate swan
brave vessel
#

Oh yeah, doesn’t discord now tell if you if you send a valid discord token?

hasty iron
#

its a wrapper

brave vessel
#

Pretty cool feature

dapper cobalt
slate swan
cloud dawn
reef shell
#

Troll

vocal plover
slate swan
cloud dawn
#

...

dapper cobalt
#

Fuck sake. Stop it.

vocal plover
#

Ignore the troll

#

No use continuing this

brave vessel
#

.topic

lament depotBOT
#
**What feature would you like to see added to the library? What feature in the library do you think is redundant?**

Suggest more topics here!

slate swan
#

ok ok sry

brave vessel
#

Well, on forks, full support for slash commands

dapper cobalt
#

!pypi disnake

brave vessel
#

I think pycord is in the midst of doing that

unkempt canyonBOT
reef shell
#

patreon troll

hasty iron
#

coming up on lefi!!

cloud dawn
vocal plover
#

Disnake is pretty good

cloud dawn
#

Currently making an open source disnake bot :D

brave vessel
slate swan
#

do i remove discord.py to install the master branch version?

brave vessel
#

-U should automatically do that for you

hasty iron
#

but he removed it

brave vessel
cloud dawn
#

I don't think Andy is doing anything relating to Discord anytime soon.

hasty iron
#

making a wrapper currently

#

andy, fronto and me

slate swan
#

btw, what do I change in my code when changing from discord.py to master?

brave vessel
cloud dawn
hasty iron
#

fronto just joined ffrom what i can tell

reef shell
#

Like avatar.url instead of avatar_url

slate swan
brave vessel
slate swan
#

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

hasty iron
#

i have my own fork

brave vessel
slate swan
#

yes

brave vessel
brave vessel
slate swan
#

pycharm

brave vessel
#

Thank you!

slate swan
#

i just installed master one

#
f"\nVoice region: {region.title()}"
#

i get an error in title()

hasty iron
#

what is the error

slate swan
#

title() method doesn't exist

#

for region

hasty iron
#

that’s not an error, send the traceback

slate swan
#

ok wait

#

f"\nVoice region: {region.title()}"
AttributeError: '_EnumValue_VoiceRegion' object has no attribute 'title'

#

it had before i installed the git version of discord.py

stable delta
slate swan
#

ok ty

stable delta
#

btw this is a complete guess so lmk if it's still producing an error

slate swan
#

it worked 😄

stable delta
#

ayyyy

left wind
#
@client.command()
async def queue(ctx):
    print(ctx.message.channel)
``` How would I get the name of the category that the command was sent in (discord.py)
brisk fiber
#

!d discord.TextChannel.category

unkempt canyonBOT
#

property category: Optional[CategoryChannel]```
The category this channel belongs to.

If there is no category then this is `None`.
brisk fiber
left wind
#

Thanks!

brisk fiber
#

np!

slate swan
#

@hasty ironsry for ping

#

how can I get a arg as a user mention or member mention?

kindred epoch
#

I told u send their github

slate swan
#

I did

#

can you help?
it heroku hosting

#

Anyways, I already got support now

#

async def user_info(self, ctx: Context, mentioned):i want mentioned to be either a member or a user being mentioned

#

Still thanks

kindred epoch
#

Ok

slate swan
#

Yea

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the member’s hash.

str(x) Returns the member’s name with the discriminator.
kindred epoch
#

Use that

slate swan
#

ty

kindred epoch
#

So mentioned: discord.Member

slate swan
#

so it could be, mentioned_user: Union[discord.Member, discord.User] = None

slate swan
kindred epoch
kindred epoch
slate swan
slate swan
left wind
#
<VoiceState self_mute=False self_deaf=False self_stream=False suppress=False requested_to_speak_at=None channel=<VoiceChannel id=901627304265007114 name='General' rtc_region=None position=0 bitrate=64000 user_limit=2 category_id=None>>
``` How do I get `category_id` from this?
left wind
#

Voice channel

kindred epoch
kindred epoch
left wind
#
@client.command()
async def queue(ctx):
    print(ctx.message.author.voice)
``` This?
kindred epoch
#

Voicechannel.category_id

#

Ye then add .category_id in the end

left wind
#

okay ty :)

#
Ignoring exception in command queue:
Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\chia\Downloads\bot\test.py", line 21, in queue
    print(ctx.message.author.voice.category_id)
AttributeError: 'VoiceState' object has no attribute 'category_id'

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

Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Python39\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: 'VoiceState' object has no attribute 'category_id'
``` Rip I get this now ![Sadge](https://cdn.discordapp.com/emojis/781115722225942528.webp?size=128 "Sadge")
kindred epoch
#

Uh

#

Idk then

left wind
#

rip ok

sick birch
#

And the id from that

kindred epoch
#

Ye

#

Lmao, I just found out about that

#

Was testing

left wind
slate swan
#

Anyone have a tutorial for using dbs for discord.py

kindred epoch
#

No

slate swan
#
badges = []

        for badge, is_set in user.public_flags:
            if is_set and (emoji := getattr(constants.Emojis, f"badge_{badge}", None)):
                badges.append(emoji)

what does the getattr() do here? I don't have the constants class but I was thinking of downloading every discord badge a user can have and put them as a emoji in my server and use it like that, but since I don't know what getattr() is doing idk if this would be possible?

#

!d getattr

unkempt canyonBOT
#

getattr(object, name[, default])```
Return the value of the named attribute of *object*. *name* must be a string. If the string is the name of one of the object’s attributes, the result is the value of that attribute. For example, `getattr(x, 'foobar')` is equivalent to `x.foobar`. If the named attribute does not exist, *default* is returned if provided, otherwise [`AttributeError`](https://docs.python.org/3/library/exceptions.html#AttributeError "AttributeError") is raised.

Note

Since [private name mangling](https://docs.python.org/3/reference/expressions.html#private-name-mangling) happens at compilation time, one must manually mangle a private attribute’s (attributes with two leading underscores) name in order to retrieve it with [`getattr()`](https://docs.python.org/3/library/functions.html#getattr "getattr").
slate swan
#

As it says

#

me no ingliz

#

pls try to explain that to me

#

Even the name of the func is pretty obvious, get attribute

hasty iron
#

it grabs an attribute of an object by its name

slate swan
#

It basically tries to get the attribute of an object and if it's not found it returns None

hasty iron
#

you can also pass in a default if the attr is not found, if no default is passed in and the attr is not found it raisrs AttributeError

slate swan
#

so lets say

getattr("![incident_actioned](https://cdn.discordapp.com/emojis/714221559279255583.webp?size=128 "incident_actioned")", f"badge_{badge}", None)``` would work?
brisk fiber
#

it’s useful if the name of the attribute you’re getting might change based on some other variable

hasty iron
slate swan
#

I don't use it that much so I thought it works similarly dict.get

slate swan
hasty iron
#

actually yes

slate swan
hasty iron
#

it would return None

#

because strings dont have a badge_whatever attribute

slate swan
#

Ah I see

#

but alternatively what could I do instead of getting the attribute of constants.Emojis i want to use server emojis

left wind
#

How do i get the amount of people in a vc with the vc id

slate swan
#

how can I add my color: 0x2f3136 to the Cogs code?

native sail
#

so do we just have to use discord.js or discord.cs or discord.java now that discord.py is gone?

slate swan
#
    @command(name="user", aliases=["user_info", "member", "member_info", "u"])
    async def user_info(self, ctx: Context, user_or_message: Union[discord.Member, discord.User, Message]):
        """Returns info about a user."""
        if isinstance(user_or_message, Message):
            user = user_or_message.author
        else:
            user = user_or_message

        if user is None:
            user = ctx.author

        embed = await self.create_user_embed(ctx, user)
        await ctx.send(embed=embed)

    async def create_user_embed(self, ctx: Context, user: Union[discord.Member, discord.User]) -> Embed:
discord.ext.commands.errors.MissingRequiredArgument: user_or_message is a required argument that is missing.
#

how come?

brave vessel
#

You did not include the argument when actually calling the command like
[prefix]command [argument]

slate swan
#

but what if I don't include a argument, it's supposed to give me my information, hence "if user is None:"

slate swan
#

why?

#

-_- you want your code to work, don't you?

brave vessel
slate swan
#

why would I deletet that?

brave vessel
slate swan
slate swan
brave vessel
#

Ahh, got you.

#

You could use Optional[type] too

#

Any of you seen PEP 671 yet?

#

!pep 671

unkempt canyonBOT
#
**PEP 671 - Syntax for late-bound function argument defaults**
Status

Draft

Python-Version

3.11

Created

24-Oct-2021

Type

Standards Track

brave vessel
#

I can imagine how this could be useful for discord bots

slate swan
#

ahh I see

#

btw I need help with something else

brave vessel
brave vessel
slate swan
#
badges = []
        for badge, is_set in user.public_flags:
            if is_set and (emoji := getattr(constants.Emojis, f"badge_{badge}", None)):
                badges.append(emoji)
#

I don't want to make that class since it won't work for me unless i write another 1000 lines of codes

#

it''s supposed to check if the user has any badge

#

atm i have the hypesquad badge

#

i was thinking of make all the badges in discord into server emojis in my server

#

and do it that way, but idk how I could use that in the code

slate swan
brave vessel
#

Hmm, why not just set the emojis yourself?

#

IIRC there aren’t too many badges

slate swan
#

right but, I also need to check if the user has a badge

brave vessel
slate swan
#

nvm I think I found a solution

#
        for badge, is_set in user.public_flags:
            if is_set:
                print(is_set, badge)

returns

True hypesquad_brilliance
#

using this, i could do if statements and check what the badge is, and depending on that ill append that emoji to badges 🙂

spark musk
#

@novel cipher?

novel cipher
#

Hi

slate swan
#

Say someone is using my bots commands and it is unable to process it due to 'skipping a beat'/lag

How can I make a global handler for an error like discord.errors.NotFound: 404 Not Found

So when it occurs I can send them a message saying please re-try?

tall canopy
#
-Hi.How can i make the bot use do not disturb status and also having a status like
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.competing,name=f'-help'))
await client.change_presence(status=discord.Status.dnd
-But after this i can only get the bot status dnd but activity does not presence
slate swan
#

How do you send a message to another channel by the id

#

if i fetch a user do i have to use get right after?

slate swan
#

set that to a variable and then do await variable.send(blah)

slate swan
#

Ifht thanks

tall canopy
slate swan
#

mhm

#

@bot.command()
async def add(ctx, bott: discord.User = None,  *, reason=None):
    l = await bot.fetch_user(bott.id)
    b = bot.get_user(bott)
    if b is None:
        embed = discord.Embed(description="please provide a bot id!",color=discord.Color.from_rgb(62,173,255))
        mes = await ctx.reply(embed=embed)
        await asyncio.sleep(5)
        await ctx.message.delete()
        await mes.delete()
    else:
        if l.id in db.find_one({"bot_id": bott.id}):
            embed = discord.Embed(description="your bot is still being reviewed. Please be patient!",color=discord.Color.from_rgb(62, 173, 255))
            mes = await ctx.reply(embed=embed)    
            await asyncio.sleep(7)
            await ctx.message.delete()
            await mes.delete()
        else:
            db.insert_one({"bot_id": bott.id,
            "author": ctx.author.id,
            "reason": reason})
            embed = discord.Embed(description="Your bot has been entered to the queue. Be patient and wait for your bot to get accepted or declined.",color=discord.Color.from_rgb(62, 173, 255))
            await ctx.reply(embed=embed)    
tall canopy
slate swan
#
await ctx.delete.message(ctx.message)
``` why does this not delete authors command message?
tall canopy
#

ctx.message.delete()

slate swan
#

I don't want it to delete the bots message

tall canopy
#

no this is delete the author message

slate swan
#

nope didnt work

#

nvm it did

#

ty

slate swan
#

!d discord.Message.delete

final pumice
#

if i wanted my bot to send a message in a random time between 30 minutes and 5 hours

#

what method do i use?

slate swan
#
    if isinstance(relationship.type, discord.RelationshipType.incoming_request):
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union

any1 know how to fix this?

slate swan
slate swan
#

and make a tasks or asyncio.sleep(dont recommend)

final pumice
#

@slate swan how do i find an emoji's id

slate swan
#

do \emoji

#

so type a \ then go to the emoji selector and just click on ur emoji

#

it should look like !Heart

#

@final pumice

final pumice
#

\🍌

slate swan
#

it doesnt work for default emojis as they can be used everywhere

final pumice
#

how do i find the id of default emoji then?

slate swan
#

you dont

#

just do :fire:

final pumice
#

then how do i use get_emoji()

slate swan
#

that will return 🔥

final pumice
#

if i need an id

slate swan
#

you dont.

#

you do \emojiname

final pumice
#

\banana

slate swan
#

banana is a default emoji

#

an id isnt needed

final pumice
#

so do i say get_emoji(\banana)?

slate swan
#

no

#

you dont use get_emoji

final pumice
#

then what do i do

#

sorry, im new to all this

slate swan
#

banana is a default emoji you just have to do :banana:

final pumice
#

so if i wanted to store it in a variable, would i say banana = :banana:

slate swan
#

banana = ":banana:"

final pumice
#
async def random_banana():
    channel = client.get_channel(774468047846768640)
    hasBanana=True
    while True:
        if hasBanana:
            sec = random.randint(1,60)
            print(sec)
            time.sleep(1)
            await channel.send("where banana? :(")
            hasBanana=False
        else:
            @client.event
            async def on_message(message):
                banana = ":banana:"
                if message.content == banana:
                    await channel.send(":O BANANA! OOOO A A AAA *smiles*")
                    hasBanana=True
asyncio.run(random_banana())```
#

whats wrong with this

#

File "c:\Users\white\VS Practice\monki_bot.py", line 29, in random_banana await channel.send("where banana? :(") AttributeError: 'NoneType' object has no attribute 'send'

slate swan
#

you can put an event like that

final pumice
#

this is my error

slate swan
#

Hi, my bot has recently hit 28,000 guilds and when sharding some of the shards are beginning to disconnect? Not sure why, I googled and apparently it can be caused due to no RAM but my ram isnt even getting fully used up

#

an event has to align with the async function

final pumice
slate swan
#
@client.event
async def on_message(message):
   if LOL:
      stuff
   else:
     return
#

Yhh 😅 just dont know if this error is anything to do w discordpy

#

happens on startup

#

all shards are ready and bot is ready

#

shards slowly disconnect

#

thats an example on how to use a variable in a on_message

#

and reconnect

#

all different shards

#

i fr dont know much about ShardedClients

final pumice
#

what im trying to do is that at a random time, the bot will send a message. when the user puts the banana emoji, the bot responds and the entire thing restarts

#

i don't think an on_message() will fit into that

slate swan
#

do you know any python?

final pumice
#

yes

#

and asyncio

slate swan
#

ehh, debatable your trying to make a function inside of one..

rain olive
#

u probably want a command and wait_for

slate swan
#

or use a on_ready

rain olive
slate swan
#

when the bot runs it will stary cycling thru random times

final pumice
#

oh shoot

slate swan
#

and will randomly send

final pumice
#

you're right

#

i should put that in an on_ready

rain olive
#

uhhuh

slate swan
#

@rain olive can you help me with this


@bot.command()
async def add(ctx, bott: discord.User = None,  *, reason=None):
    l = await bot.fetch_user(bott.id)
    b = bot.get_user(bott)
    if b is None:
        embed = discord.Embed(description="please provide a bot id!",color=discord.Color.from_rgb(62,173,255))
        mes = await ctx.reply(embed=embed)
        await asyncio.sleep(5)
        await ctx.message.delete()
        await mes.delete()
    else:
        if l.id in db.find_one({"bot_id": bott.id}):
            embed = discord.Embed(description="your bot is still being reviewed. Please be patient!",color=discord.Color.from_rgb(62, 173, 255))
            mes = await ctx.reply(embed=embed)    
            await asyncio.sleep(7)
            await ctx.message.delete()
            await mes.delete()
        else:
            db.insert_one({"bot_id": bott.id,
            "author": ctx.author.id,
            "reason": reason})
            embed = discord.Embed(description="Your bot has been entered to the queue. Be patient and wait for your bot to get accepted or declined.",color=discord.Color.from_rgb(62, 173, 255))
            await ctx.reply(embed=embed)    

rain olive
#

what isnt working

#

and what does this do

slate swan
#

it always says please provide a bot id

rain olive
#

what exactly is this command

slate swan
#

its supposed to get a bot id outside of the server and insert it into the db

rain olive
#

you probably dont have intents

slate swan
#

i do

rain olive
#

show me how u set it

slate swan
#

wym

rain olive
#

show me what u define ur intents as

#

because the problem is that ur variable b is none

slate swan
#

bot = commands.Bot(command_prefix="b!", intents=discord.Intents.all())

#

i should be using the variable l rather b?

rain olive
#

your typehint should be discord.User.bot

#

iirc

slate swan
#

hm okay

slate swan
rain olive
#

hmm

#

not too sure then but ur bott arg is defo None

midnight venture
#

hi

slate swan
sick birch
rain olive
#

eh

sick birch
#

there's a few other stuff wrong there too

rain olive
#

isnt bott alrd an id

#

also name ur vars better lol

sick birch
#

you're trying to invoke bot.fetch_user(bott) when bott is already a commands.Bot instance

#

there's really no point behind it

rain olive
#

bott isnt a commands.Bot instance...

#

its an argument

sick birch
#

and also if you're gonna check if b is none, don't make it optional in the first place

sick birch
sick birch
rain olive
#

yep, what robin said

#

and again consider naming ur vars better so u wont confuse urself

sick birch
#

you also don't need to do bot.fetch_user(bott.id), you can just use bott

#

it's needless complication

mortal dove
#

How do I get a user's permissions without the has_permissions() decorator?

slate swan
#

ohh i get what your saying

#

Doesn't send message

#

No errors

mortal dove
#

ctx.channel.send

slate swan
#

no

mortal dove
#

Ope mb

slate swan
#
@client.command()
async def add(ctx, link, reason=None):
  if reason == None:
    reason = 'No reason provided'
  else:
    return
  embed = nextcord.Embed(title='Link Request', color = nextcord.Color.blurple())
  embed.add_field(name='**Link**', value=f"{link}")
  embed.add_field(name='**Reason**', value=f"{reason}")
  channel = client.get_channel(902013562438975498)
  await ctx.send("Our team has been notified about this link Join our support server")
  await channel.send(embed=embed)
#

nextcord??

#

this is for discordpy

#

There is very to little difference

#

still a difference tho

#

and your error is indentation

#

no it's the return

#

if a reason isn't providing it's stopping the function

slate swan
rain olive
#

what dont u understand

slate swan
#

i understand the i don't need bott.id

rain olive
#

discord.User returns a user object so it's already fetched

#

fetching it again is redundant

#

ure doing extra steps

slate swan
#

okay

#

now use b the b variable??

rain olive
#

?

slate swan
#

i replaced the l's with b's and it still says please provide a bot id

#

hold on

rain olive
#

code

slate swan
#
@bot.command()
async def add(ctx, bott: discord.User,  *, reason=None):
    b = bot.get_user(bott)
    if b is None:
        embed = discord.Embed(description="please provide a bot id!",color=discord.Color.from_rgb(62,173,255))
        mes = await ctx.reply(embed=embed)
        await asyncio.sleep(5)
        await ctx.message.delete()
        await mes.delete()
    else:
        if b.id in db.find_one({"bot_id": b.id}):
            embed = discord.Embed(description="your bot is still being reviewed. Please be patient!",color=discord.Color.from_rgb(62, 173, 255))
            mes = await ctx.reply(embed=embed)    
            await asyncio.sleep(7)
            await ctx.message.delete()
            await mes.delete()
        else:
            db.insert_one({"bot_id": b.id,
            "author": ctx.author.id,
            "reason": reason})
            embed = discord.Embed(description="Your bot has been entered to the queue. Be patient and wait for your bot to get accepted or declined.",color=discord.Color.from_rgb(62, 173, 255))
            await ctx.reply(embed=embed)    
rain olive
#

b = blah blah

#

that line isnt needed

slate swan
#

okay

#

OKAY NOW @rain olive ITS SAYING ITS A NONE TYPE

#

we are getting somewhere

rain olive
#

that error has always been there

slate swan
#

yh

#

i have to use .get

mortal dove
#

Also that was why it wasn't working, I think. @slate swan
bot.get_user() returns a user object, from their ID.

slate swan
#

and it's already a user

mortal dove
#

Ye

slate swan
#

i get it..

kindred epoch
slate swan
#

yh = yea

#
async def add(ctx, bott: discord.User,  *, reason=None):
    if bott is None:
        embed = discord.Embed(description="please provide a bot id!",color=discord.Color.from_rgb(62,173,255))
        mes = await ctx.reply(embed=embed)
        await asyncio.sleep(5)
        await ctx.message.delete()
        await mes.delete()
    else:
        if bott.id in db.find_one({"bot_id": bott.id}):
            embed = discord.Embed(description="your bot is still being reviewed. Please be patient!",color=discord.Color.from_rgb(62, 173, 255))
            mes = await ctx.reply(embed=embed)    
            await asyncio.sleep(7)
            await ctx.message.delete()
            await mes.delete()
        else:
            db.insert_one({"bot_id": bott.id,
            "author": ctx.author.id,
            "reason": reason})
            embed = discord.Embed(description="Your bot has been entered to the queue. Be patient and wait for your bot to get accepted or declined.",color=discord.Color.from_rgb(62, 173, 255))
            await ctx.reply(embed=embed)
#

updated ^^

mortal dove
#

so it returns none, because bott is something like <discord.User object at *some memory location*>

kindred epoch
#

That's not gonna work either

slate swan
#

ik

#

was jsut sending what i have now

kindred epoch
#

Ok

mortal dove
#

Also bott will never be None, because it's a required argument. So it just raises an error

slate swan
#

i'm guessing yk how to fix @kindred epoch

slate swan
#

then he told me to remove it

mortal dove
#

if you want a custom thing to show if they didn't mention a bot

#

then yeah I would add it back

kindred epoch
slate swan
#

btw this is what i'm doing
b!add 791982798424506378

#

when i'm testing the cmd

mortal dove
#

oh

slate swan
kindred epoch
#

What do u need help with

slate swan
#

or am i just noob

#

i feel like it's so simple and i'm just dumb

kindred epoch
#

It is

slate swan
#

i think i should set it to Member than fetch it

#

buttttt idk cuz i'm noob

mortal dove
#

then do

async def add(ctx, bott: int=None,  *, reason=None):
    if bott==None:
        embed = discord.Embed(
            description="please provide a bot id!",
            color=discord.Color.from_rgb(62,173,255)
        )
        mes = await ctx.reply(embed=embed, delete_after=5)
        await mes.delete()
    else:
        if bott in db.find_one({"bot_id": bott}):
            embed = discord.Embed(
                    description="your bot is still being reviewed. Please be patient!",
                    color=discord.Color.from_rgb(62, 173, 255)
            )
            mes = await ctx.reply(embed=embed, delete_after=7)    
            await mes.delete()
        else:
            db.insert_one({"bot_id": bott,
            "author": ctx.author.id,
            "reason": reason})
            embed = discord.Embed(
                    description="Your bot has been entered to the queue. Be patient and wait for your bot to get accepted or declined.",
                    color=discord.Color.from_rgb(62, 173, 255)
             )
            await ctx.reply(embed=embed)

try this

slate swan
#

bot == None isn't valid

kindred epoch
#

Huh

slate swan
#

it's if bott is None:

mortal dove
#

I prefer ==, same thing

slate swan
#

thought so

kindred epoch
#

Is and == is the same thing

#

In some cases

mortal dove
#

also what I did is just cause if you're already giving the bot id, you don't need to get their ID. If your db functions only take the ID anyways, then it should be ok

#

What does it return now?

slate swan
#

same as before

mortal dove
#

hmm

#

your db functions only need the ID of the given bot, right?

slate swan
#

only need the bots id, authors id and the reason that is auto set to None

kindred epoch
#

Reason is probably the problem, you can't add nothing to the db

mortal dove
#

try adding this to the first line after you define the function, before if bott==None
reason=reason if reason else 'No reason given'

#

Maybe the None in reason is causing it? Other than that, I'm not totally sure

slate swan
#

remove reason i feel like it wasn't needed for what i was doing but it still ain't work

#

is that a command?

kindred epoch
#

Ye

#

Show the command now

slate swan
#
@bot.command()
async def add(ctx, bott: int=None):
    if bott==None:
        embed = discord.Embed(description="please provide a bot id!",color=discord.Color.from_rgb(62,173,255))
        mes = await ctx.reply(embed=embed, delete_after=5)
        await mes.delete()
    else:
        if bott in db.find_one({"bot_id": bott}):
            embed = discord.Embed(description="your bot is still being reviewed. Please be patient!",color=discord.Color.from_rgb(62, 173, 255))
            mes = await ctx.reply(embed=embed, delete_after=7)    
            await mes.delete()
        else:
            db.insert_one({"bot_id": bott,
            "author": ctx.author.id})
            embed = discord.Embed(description="Your bot has been entered to the queue. Be patient and wait for your bot to get accepted or declined.",color=discord.Color.from_rgb(62, 173, 255))
            await ctx.reply(embed=embed)
#

just dont set a default value for member and stuff , use the error handler for the 'MissingRequiredArgument'

#
@client.command()
async def add(ctx, link, reason=None):
  if reason == None:
    reason = 'No reason provided'
  embed = nextcord.Embed(title='Link Request', color = nextcord.Color.blurple())
  embed.add_field(name='**Link**', value=f"{link}")
  embed.add_field(name='**Reason**', value=f"{reason}")
  channel = client.get_channel(902013562438975498)
  await ctx.send("Our team has been notified about this link Join our support server")
  await channel.send(embed=embed)

I have this command everything works fine but how would I add a reaction to the embed

#

fix the format pls

#

It wasn't formatted wrong

mortal dove
#
message=await ctx.send('message')
message.add_reaction('my reaction')
slate swan
#

m = await channel.send()

#

m.add_reaction()

#

Ok thanks

mortal dove
#

you can use unicode emojis in a string, or a format that I don't remember for custom emojis

kindred epoch
slate swan
#

Nonetype

mortal dove
#

sumn like <a:emojiid:>

slate swan
#

And also how would I get if someone reacted to a message

#

The argument of nonetype is iterable

#

not*

slate swan
# slate swan fix the format pls
@bot.command()
async def mycommand(ctx , argument):
   await ctx.send(argument)```
so if you want to show an error if no argument is provided 
you can actually use `on_command_error` event ( use `!d discord.on_command_error`) for better explanation
kindred epoch
mortal dove
#

msg=await bot.wait_for('reaction_add')

kindred epoch
mortal dove
#

with checks and whatnot

slate swan
mortal dove
slate swan
#

instead of setting value as None

slate swan
kindred epoch
#

Lol

slate swan
mortal dove
#

msg.author.id

#

it just returns a message obj

slate swan
#

i'm so noob

kindred epoch
mortal dove
#

@slate swan try to add this
print(db.find_one({"bot_id": bott}))
send the result here

#

cause it could be in that

kindred epoch
#

It is

slate swan
#

Also I'm sorry if I'm asking to many questions is there a way to tell what emoji was reacted with

#

okay so

mortal dove
#

one sec

kindred epoch
# slate swan wym

Define find_one as something and then check if it returned something, do you know how to do that?

#

You don't even need to define it

mortal dove
#

i mean you can do msg.reactions to return all the reactions on the message, or could can add check=(lambda r: r=='whateverreactionyouwanttocheckfor') @slate swan

kindred epoch
#

Just check if it returned something or not

mortal dove
slate swan
#

ik basic py but

#

basically saying i don't understand

kindred epoch
#

!e
hi = ["hi"]
if hi:
print("it has something")
else:
print("None")

unkempt canyonBOT
#

@kindred epoch :white_check_mark: Your eval job has completed with return code 0.

it has something
mortal dove
kindred epoch
#

Do you get what I mean after that?

boreal ravine
slate swan
boreal ravine
#

oh

#

nice

slate swan
#

discord.ext.commands.errors.ExtensionFailed: Extension 'commands.help' raised an error: CommandRegistrationError: The command help is already an existing command or alias. I get this even tho "help" is not even a thing in a single line in any of my files

final iron
#

It's a default command

#

You'll have to remove it

slate swan
#

how?

mortal dove
#

add this to your bot=statement
help_command = None

#

bot = commands.Bot(command_prefix=ctx_prefixes,case_insensitive=True,intents=intents, help_command = None,activity=activity) like this

slate swan
#

ah I see, ty

mortal dove
#

np

slate swan
#

wait

#

Can I use the default help command, but edit it?

final iron
#

Yes

slate swan
#

how can I do that? any tutorial?

final iron
#

Yes let me find it

slate swan
#

ok ty

final iron
slate swan
#

.

rain olive
#

user.ban

slate swan
#

!d discord.Member.ban

unkempt canyonBOT
#

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

Bans this member. Equivalent to [`Guild.ban()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.ban "discord.Guild.ban").
slate swan
#

or , you can have discord.Guild.ban( user/member , reason = reason)

slate swan
#

How do you check for a specific reaction

kindred epoch
#

!d discord.ext.commands.Bot.wait_for

unkempt canyonBOT
#

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

Waits for a WebSocket event to be dispatched.

This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.

The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.

In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.

This function returns the **first event that meets the requirements**...
kindred epoch
slate swan
#

how to do commands.has_permissions but with a role

rain olive
#

commands.has_role()

#

or has_any_role()

slate swan
#

bruh

#

How can i do a cooldown for a command? For example, the bot do that action but later don't do that action

#

@slate swan

#

@slate swan

#

@slate swan

#

?

#

how to build a discord bot?

#

and even i tried it on repl

#

when pc shutdowns!

#

it will be stopped even

#

please help me @slate swan

slate swan
#

dm me here it will be chaostic

#

okfine

visual island
boreal ravine
#

@slate swan stop mass pinging people pls

boreal ravine
unkempt canyonBOT
boreal ravine
unkempt canyonBOT
#

@discord.ext.commands.has_any_role(*items)```
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 the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.

Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.

This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").

Changed in version 1.1: Raise [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
slate swan
#

How do you use hyper links

onyx salmon
#

In embed descriptions and field values, [text](link)

slate swan
#

how do i fix this? @bot.command() async def av(ctx, *, user: discord.Member=None): if not user: user = ctx.message.author userAvatar = user.avatar_url embed=discord.Embed(title=f"{user.name}'s avatar", colour = colour) embed.set_image(url=userAvatar) await ctx.send(embed=embed)

onyx salmon
#

Again, what's the issue? Are you getting any errors?

slate swan
#

when i run it, it works, but when i do !av, it doesn't wokr.

#

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: NameError: name 'color' is not defined

onyx salmon
#

That doesn't look like anything related to your snippet

slate swan
#

Ok wait.

#

should be 'colour' is not defined

onyx salmon
#

Preferences

slate swan
#

what do i do to fix that

#

define it

onyx salmon
#

Define color before whenever it's used

slate swan
#

how?, sorry btw i'm very new to coding

onyx salmon
#

We have no idea what you want color to be, and your snippet doesn't use it anywhere

slate swan
#

how do i make the color random?

#

!d discord.Colour.random

unkempt canyonBOT
#

classmethod random(*, seed=None)```
A factory method that returns a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour") with a random hue.

Note

The random algorithm works by choosing a colour with a random hue but with maxed out saturation and value.

New in version 1.6.
onyx salmon
#

random-
Oh that exists, right

slate swan
#

colour = discord.Colour.random()

#

where do i put that?

onyx salmon
#

As your variable value

slate swan
#

anywhere above your embed

#

i'm very sorry, i just started coding 3 days ago.

#

okay

#

still in the function

#

with the right scoping

onyx salmon
#

Why don't you start with Python itself before getting to complex libraries?

slate swan
#

i watched some tutorials

#

!resources yes

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

it seemed easy SkullCry

#

it's not, that's why there aren't many programmers

#

ok so i'm pretty dumb but, where do i put the "colour = discord.Colour.random()"?

#

above embed=....

#

directly

#

under userAvatar=....

#

Where you wrote colour=colour

#

raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'colour' referenced before assignment

#

now it says that 😭

#

you put it after the embed

#

Because you never defined a colour variable but tried to use it

#

put it above

#

@slate swan no

#

Just stop

#

??

#

It's at the right place

#

Just look by yourself

#

The issue is that they're trying to use a non declared colour variable

#

yes

#

Nothing else

slate swan
#

he should indeed put the definiton above the using time

#

Just directly write it

#

After colour

#

....

#

ok

#

we already have what we're trying to define colour as

covert igloo
slate swan
#

Then just write it

#

Instead of making

color = color1
Embed(color=color)
#

Useless declaration and code

onyx salmon
#

Both are fine

slate swan
#

You should limit variable declarations when not needed

#

Of course they're both fine...

#

what is the color blue

#

like what is the specific name

#

poor 0.2ms

#

Just get a hex value

#

hello

#

And write as 0xValue

slate swan
onyx salmon
#

!d discord.Colour.blue

unkempt canyonBOT
#

classmethod blue()```
A factory method that returns a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour") with a value of `0x3498db`.
slate swan
#

okay thanks

#

now it says invalid syntax :/

#

i'm very new to coding and odon't really understand anything

acoustic wraith
#

discord.colour.blue

slate swan
#

no

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

ok

#

Color is a class

#

You should start by learning Python before doing a project like that

slate swan
#

now i gotta go, ty all so much for helping.

onyx salmon
#

I can't see what you even entered

slate swan
#

ok

#

Missing a )

onyx salmon
#

You forgot to close the arguments with a closing parenthesis

#

Since you don't need the random color, feel free to ditch your colour variable

slate swan
#

omg it works, thank you so much!

onyx salmon
#

Take some time to get used to basic Python first for a starter

slate swan
#

okay, thank you so much!

onyx salmon
#

👍

slate swan
#

i changed the colour to randomized btw.

covert igloo
onyx salmon
#

Nice

slate swan
#

give me a discord py bot example please

#

@lament oaronegive me a discord py bot example please

#

i am idiot

#

help me

#

@slate swan

boreal ravine
boreal ravine
#

Just do it then?

#

what

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
blazing beacon
boreal ravine
blazing beacon
#

not that

boreal ravine
#

wdym

blazing beacon
boreal ravine
blazing beacon
#
from discord import Attachment
from discord.ext import commands
from translate import Translator
from orc import run_ocr
class DevCommands(commands.Cog, name='Developer Commands'):
  '''These are the developer commands'''
  def __init__(self, bot):
    self.bot = bot


  @commands.command()
  async def t_to(self, ctx, lang, *, arg):
    await ctx.send(Translator(to_lang=f"{lang}").translate(f"{arg}"))
  
  @commands.command()
  async def t_from(self, ctx, lang, *, arg):
    await ctx.send(Translator(to_lang="en", from_lang=f"{lang}").translate(f"{arg}"))
  
  @commands.command(name="ocr")
  async def ocr_(self, ctx, image):
    await ctx.send(run_ocr(img_url=image))
      
def setup(bot):
  bot.add_cog(DevCommands(bot))
  print('Loaded!')
#^ cogs/homework.py
import ocrspace
import aiohttp
import os

api = ocrspace.API(api_key=os.environ['ocr_key'])

def run_ocr(img_url):
  print('running ocr')
  return api.ocr_url(url=img_url)
# ^ orc.py
boreal ravine
#

hm

slate swan
#

wont send, any ideas?

#

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

slate swan
#

it wont send

edgy fractal
#

Does discord now allow custom statuses for bots?

boreal ravine
#

activity yes custom statuses no

ocean dragon
#

what happened to bot.pool?

boreal ravine
#

whats that

slate swan
#

Sorry I fell asleep yesterday, I tried this but it doesn't work either even a print after the checker.start doesnt fire

ocean dragon
#

nvm I think it's some other issue

strong kettle
#

Why i cant make for loop to ctx.guild.members

slate swan
boreal ravine
#

you can loop anything

#

as long as it's an iterable

slate swan
#

what's wrong with your nickname 😭

boreal ravine
slate swan
#

why so many cats 💀

boreal ravine
#

Lmfao

outer violet
slate swan
#

that's why

valid perch
strong kettle
slate swan
slate swan
outer violet
#

what do I do ¯_(ツ)_/¯

slate swan
#

also .fetch methods are awaitables

slate swan
#

but not with the channel's name

valid perch
#

Why not ctx.author

boreal ravine
slate swan
#

also having your close command the way it is currently, you'll have people delete random channels

slate swan
agile dune
boreal ravine
#

not really

slate swan
outer violet
#

Will setting it only people that have the perms to delete it prevent random people from deleting it?

slate swan
#

yes

#

but it'll also prevent people from deleting their own threads

storm brook
#

how to check if the channel id provided is valid or not

boreal ravine
#

does anyone have a list of all the command deco's

#

oops nvm i found a gist about it

slate swan
#
await ctx.send ("https://cdn.discordapp.com/attachments/884636730945314847/901406494111727666/IMG_7080.jpg") ```
#

wrong one.

torpid dew
#

how do u get animated emoji code without using \name or copying the link from someone else sending it

livid hinge
#

@slate swan like

@bot.command(aliases=['Mrworldwide', 'MrWorldwide','mrworldwide'])
async def mrworldwide(ctx, arg1, arg2):
    await ctx.send ("https://cdn.discordapp.com/attachments/884636730945314847/901406494111727666/IMG_7080.jpg")```
maiden fable
unkempt canyonBOT
torpid dew
torpid dew
maiden fable
torpid dew
#

nvm

#

ill do smthing else

#

im new to code that's why

maiden fable
#

It's fine

slate swan
#

Im gonna create a discord bot with 3 languages lmao

tropic briar
slate swan
#

Just for fun

tropic briar
#

Oh

#

What are the languages that you are using

slate swan
#

Ye

tropic briar
#

great!!

slate swan
#

Is there a library for python that is getting updates

#

Discord bot

visual island
#

there are many libraries that are active currently, but I prefer disnake

slate swan
#

Why there is no answer or errors when prescribing?

#

how to instal rain meter

slate swan
slate swan
lusty swallow
slate swan
#

how to download python

#

go to the python page and click download

#

🤨