#discord-bots

1 messages ยท Page 869 of 1

maiden fable
#

I totally won't troll

sick birch
#

ill take anything

#

im bored out of my mind

maiden fable
#

Why this code no work ;-;

sick birch
#

why though

slow fog
maiden fable
maiden fable
sick birch
#

it's cursed

#

now just use OCR on it ๐Ÿ˜‰

maiden fable
#

Lmao

alpine furnace
sick birch
#

ah yes historical significance

alpine furnace
sick birch
#

people being serious in the answers like

maiden fable
dull terrace
#

can't tell if this is the dumbest way to do this or the best

sick birch
#

f strings in sql queries

#

careful as you're opening yourself up to SQL injection attacks

dull terrace
#

uhuh, you literally can't use placeholders for columns and table names

#

also there's a thing i read that placeholders haven't been implemented for those because it's not a concern but

alpine furnace
maiden fable
#

Hmmm

dull terrace
alpine furnace
#

Oh no, wait

#

This is often a code smell

#

Hardcode it

#

Make an array with the unprepared queries somewhere

dull terrace
#

none of it is even user input

alpine furnace
#

Or use a query builder

#

Yeah, all the more reason to

dull terrace
alpine furnace
#

Yeah

vast gale
#

use str.format(), its a lot safer

#

/s this is not advice

maiden fable
#

Lmao

manic wing
manic wing
#

it works, youre just doing it wrong

#

also use aiosqlite

manic wing
#

just use aiosqlite which i know it works fir

#

and discord bots should use asynchronous wrappers

vocal snow
manic wing
nimble plume
vocal snow
#

no, it's not different for different DBMSs @manic wing

alpine furnace
#

Might be, but theyโ€™re in fact using the same dbms ๐Ÿค” seems like aiosqlite has a query builder

nimble plume
alpine furnace
#

Cope

vocal snow
alpine furnace
#

That doesnโ€™t change what I said

vocal snow
#

aiosqlite has a query builder
not sure what you mean by this

alpine furnace
nimble plume
#

<@&831776746206265384> ^^^^^^

blissful lagoon
#

sup?

nimble plume
#

See

vocal snow
# alpine furnace If this is the case, it may as well, who knows

tested rn: ```py
import asyncio, aiosqlite

async def main():
db = await aiosqlite.connect('db.sqlite')
await db.execute('CREATE TABLE TEST (id INTEGER PRIMARY KEY, name TEXT);')
await db.execute('INSERT INTO TEST VALUES (0, "test");')
await db.execute('UPDATE ? SET name="changed" WHERE id=0;', ("TEST",))

asyncio.run(main())
results in
Traceback (most recent call last):
File ".\t.py", line 9, in <module>
asyncio.run(main())
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File ".\t.py", line 7, in main
await db.execute('UPDATE ? SET name="changed" WHERE id=0;', ("TEST",))
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\site-packages\aiosqlite\core.py", line 175, in execute
cursor = await self._execute(self._conn.execute, sql, parameters)
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\site-packages\aiosqlite\core.py", line 122, in _execute
return await future
File "C:\Users\Aman\AppData\Local\Programs\Python\Python38\lib\site-packages\aiosqlite\core.py", line 98, in run
result = function()
sqlite3.OperationalError: near "?": syntax error

nimble plume
#

They are talking about db in discord bots

visual island
#

just use !ot tag

nimble plume
#

I said them

visual island
#

don't ping mods just for that

alpine furnace
nimble plume
alpine furnace
#

Just trying to come up with an explanation for what he said, but I donโ€™t know if thatโ€™s entirely true again

vocal snow
#

๐Ÿ‘

frosty creek
alpine furnace
#

Lol

blissful lagoon
#

databases are sometimes relevant to discord bots

maiden fable
#

istg sometimes this channel is dead and sometimes active as hell

nimble plume
blissful lagoon
#

if you're tlkaing about databases without the context of discord bots, please use #databases

vocal snow
#

how is this Dyno ka bhai even allowed in this server, istg discord is for 13+

nimble plume
#

This guy

blissful lagoon
nimble plume
slate swan
nimble plume
#

Pinggggggsssss

nimble plume
vocal snow
#

seems like you forgot to ignore me when I was talking about databases? Or is your ignorance selective? Does it trigger every 5 minutes?

slate swan
#
  File "C:\Users\Apple\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\cog.py", line 660, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "c:\Users\Apple\Documents\GitHub\Gaming-Bot\cogs\brps.py", line 22, in <module>
    class brps(commands.Cog):
  File "c:\Users\Apple\Documents\GitHub\Gaming-Bot\cogs\brps.py", line 27, in brps
    async def brps(self, ctx, member: discord.Member()):
TypeError: __init__() missing 3 required keyword-only arguments: 'data', 'guild', and 'state'```
slate swan
maiden fable
slate swan
dull terrace
#

are people still angry about databases in here

#

๐Ÿ˜ค sorry i mentioned

nimble plume
maiden fable
nimble plume
#

return exams if date == 3

#

dont dare say not defined

visual island
#

SyntaxError

maiden fable
#

Oh discord added the Add to Server button on mobile client at last ๐Ÿ‘€

slate swan
unkempt canyonBOT
#

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

001 |   File "<string>", line 3
002 |     return exams if dare == 3
003 |            ^^^^^^^^^^^^^^^^^^
004 | SyntaxError: expected 'else' after 'if' expression
nimble plume
slate swan
#

?

maiden fable
#

Okay lets stop it

slate swan
#

lmao

nimble plume
#

Doubt @maiden fable

maiden fable
#

?

slate swan
maiden fable
#

If it's about my name, then ping me in an OT

nimble plume
#

Code

#

Import erro mainly

visual island
#

Cog is a module

slate swan
#

typeerror

#

rip my phone, my mes

nimble plume
#

cog.help

stiff nexus
#

ik that bruh

slate swan
#

lol

visual island
#

i guess you mean commands.Cog?

nimble plume
#

Time pass

slate swan
#

imagine importing cogs manually

nimble plume
#

cant imagine

maiden fable
#

Uhhh, nvm

nimble plume
#

๐Ÿ˜‚

maiden fable
#

Was gonna say something but nvm

nimble plume
#

Say

maiden fable
#

Nah, was just thinking out loud

nimble plume
slate swan
#
@commands.command()
    async def brps(self, ctx, member):
        try:
            member: discord.Member
            print("ok")
        except:
            print("sad")```

its always triggering the try part
nimble plume
#

name copy

warm plover
warm plover
nimble plume
maiden fable
nimble plume
#

Ye

slate swan
#

๐Ÿ˜•

nimble plume
#

Unless u are using events

maiden fable
#

It's a command since it has a command deco

slate swan
nimble plume
slate swan
#

uhm how to fix it

slate swan
maiden fable
nimble plume
slate swan
#

i wanna trigger 1 block if a member is mentioned and another block if member isnt mentioned

slate swan
nimble plume
#

Ok

maiden fable
# slate swan yeps

And using on_message to manually implement the command system ๐Ÿ‘€

slate swan
nimble plume
#

Not from pc cant help

slate swan
maiden fable
#

What

maiden fable
#

U gotta use ctx.message and check for mentions

#

!d discord.Message.mentions

unkempt canyonBOT
#

A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.

Warning

The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.

slate swan
#

uh tht works for replies too

slate swan
maiden fable
unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

slate swan
#

uhm ok

slate swan
maiden fable
maiden fable
slate swan
#

then we can do if member = None:

slate swan
maiden fable
#
if not member2:
    return await ctx.reply("You didn't mention a member") 
maiden fable
maiden fable
#

What

slate swan
maiden fable
slate swan
maiden fable
#

Iirc the second one is faster, tho I don't really remember

maiden fable
#

Someone ask a question ๐Ÿฅบ

#

(Proper questions, no trolling)

boreal ravine
#

should I use disco?

maiden fable
#

?

boreal ravine
#

I've been using it for a while now (3 years to be exact) and it doesn't support any of the new features discord released ๐Ÿ˜ข

maiden fable
#

What's disco tho

slate swan
maiden fable
boreal ravine
maiden fable
#

Cool

modest plover
#

How do I get the huge "add to server" button?

visual island
maiden fable
#

Imagine copying DPY tags

modest plover
#

Ah ok

#

Ty, I'll try that now

visual island
maiden fable
modest plover
#

I got the button now, tyy

maiden fable
#

Cool

vale sierra
#
@bot.command()
@commands.is_owner()
async def next(ctx, *, member : discord.Member):
    await member.send(f"`Hello world ! `")
    
    await ctx.send("`Look in DM`")
``` hello, someone know why this commands doesn't work ? indents are good
maiden fable
visual island
maiden fable
#

Sad

visual island
vale sierra
vale sierra
visual island
#

try printing something before await member.send(...)

placid skiff
placid skiff
#

checked that the prefix that you use is correct?

vale sierra
#

wtf, i have this now (translate = missing args)

red sundial
#

yes you need a member object

placid skiff
red sundial
#

yup

#

what you can do is set the default as None

placid skiff
#

you can pass a member object by giving his ID, or by mentioning him

#

You can even send his discord name but ID and mention are better of course

vale sierra
#

ok

red sundial
#
@bot.command()
@commands.is_owner()
async def next(ctx, *, member : discord.Member = None):

    if member not None:
        await member.send(f"`Hello {member.mention} ! `")
    
        await ctx.send("`Look in DM`")
    else:
        await ctx.send("mention a member")
#

@vale sierra

vale sierra
#

alr i test this

placid skiff
#

btw why do you added the * before the member object? you are telling your command to get every everything that the user write in the command

vale sierra
placid skiff
#

if member is not None

vale sierra
#

alr thats work thanks bro

white perch
#

how to make an anti spam

slate swan
placid skiff
maiden fable
#

Heh?

slate swan
placid skiff
#

well of course if you read if variable and the code is yours you automatically know if that variable is an object or a bool variable, but if you don't open your code for a lot time or you work in a team or you share your code with someone reading if variable could be a little bit confusing, because you have to found where that variable is declared to know if it is an object or a bool value

#

i always use is None or is not None for object value

#

call it mental arrangment lol

vocal snow
#
if x:
``` just uses bool(x)
#

if it doesn't have bool it's falsey

placid skiff
vocal snow
#

That's because of their respective __bool__s

maiden fable
#

So I WAS correct. if variable or if not variable IS somewhat faster

vocal snow
#

Yes, but it also does a different thing than x is not None

red sundial
vale sierra
placid skiff
unkempt yacht
#

so i have this code for a timer command but i get an error that there is an error of invalid syntax:

@commands.command()
    async def timer(self, ctx, timeInput):
      try:
        try:
            time = int(timeInput)
        except:
            convertTimeList = {'s':1, 'm':60, 'h':3600, 'd':86400, 'S':1, 'M':60, 'H':3600, 'D':86400}
            time = int(timeInput[:-1]) * convertTimeList[timeInput[-1]]
        if time > 86400:
            await ctx.send("I can\'t do timers over a day long")
            return
        if time <= 0:
            await ctx.send("Timers don\'t go into negatives :/")
            return
        if time >= 3600:
            message = await ctx.send(f"Timer: {time//3600} hours {time%3600//60} minutes {time%60} seconds")
        elif time >= 60:
            message = await ctx.send(f"Timer: {time//60} minutes {time%60} seconds")
        elif time < 60:
            message = await ctx.send(f"Timer: {time} seconds")
        while True:
            try:
                await asyncio.sleep(5)
                time -= 5
                if time >= 3600:
                    await message.edit(content=f"Timer: {time//3600} hours {time %3600//60} minutes {time%60} seconds")
                elif time >= 60:
                    await message.edit(content=f"Timer: {time//60} minutes {time%60} seconds")
                elif time < 60:
                    await message.edit(content=f"Timer: {time} seconds")
                if time <= 0:
                    await message.edit(content="Ended!")
                    await ctx.send(f"{ctx.author.mention} Your countdown Has ended!")
                    break
            except:
              break
              except:
                await ctx.send(f"Alright, first you gotta let me know how I\'m gonna time **{timeInput}**....")```
livid jacinth
#

Hey, does anyone know how i let my discord bot send a message when someone comes online? Im a beginner in python. I try it multiple times but it doesnt work and i dont get an error or something. I used the bot event async def on_member_update but all my trys to get the status doesnt work.

unkempt yacht
livid jacinth
#

Okay thanks. I will check it

maiden fable
#

Also what module u using?

placid skiff
#

To what i know there is no method or event which checks when the status change

maiden fable
unkempt canyonBOT
#

discord.on_presence_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their presence.

This is called when one or more of the following things change:

โ€ข status

โ€ข activity

This requires [`Intents.presences`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.presences "discord.Intents.presences") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled...
placid skiff
maiden fable
#

prior to 2.0 it was included in on_member_update

placid skiff
unkempt yacht
#

the last except:

placid skiff
maiden fable
#

disnake is based on 2.0

tight mica
#

also the indentation is rly wrong

#

btw do you know python, or is this some copypaste?

#

because why would you do "I can\'t do timers over a day long"

small igloo
#

is that posibble so my bot can create 1 webhook for a text channel and use it multiple times? if yes, how

#

and can u bypass the "10 limit webhook" by creating webhook with a different name :V

maiden fable
small igloo
maiden fable
#

!d discord.Client.fetch_webhook

unkempt canyonBOT
#

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

Retrieves a [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") with the specified ID.
small igloo
#

oh, ok ty

small igloo
maiden fable
#

it returns a Webhook object

#

!d discord.Webhook.send can be used

unkempt canyonBOT
#

await send(content=..., *, username=..., avatar_url=..., tts=False, ephemeral=False, file=..., files=..., embed=..., embeds=..., allowed_mentions=..., view=..., thread=..., wait=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sends a message using the webhook.

The content must be a type that can convert to a string through `str(content)`.

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.

If the `embed` parameter is provided, it must be of type [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") and it must be a rich embed type. You cannot mix the `embed` parameter with the `embeds` parameter, which must be 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 to send.
small igloo
maiden fable
small igloo
# maiden fable !d discord.Client.fetch_webhook
s = await ctx.channel.create_webhook(name="Webhook")
            async with aiohttp.ClientSession() as session:
                webhook = Webhook.from_url(s.url, session=session)
                ``` where to get the id, also in where so i just create the webhook 1 times without create it multiple times
spring flax
#

Oh there's a kwarg embeds never new that

maiden fable
#

added in 2.0

unkempt canyonBOT
small igloo
maiden fable
#

s.id will return the webhook id

small igloo
maiden fable
#

no

small igloo
spring flax
#

Can i make a check that allows only one user bot owner to use extra pr3fixes than others?

maiden fable
#

U need the ID

small igloo
maiden fable
#

Wym session

spring flax
maiden fable
small igloo
# maiden fable no

Maximum number of webhooks reached (10)

s = await ctx.channel.create_webhook(name="Webhook")
            async with aiohttp.ClientSession() as session:
                # webhook = Webhook.from_url(s.url, session=session)
                webhook = await bot.fetch_webhook(s.id)
                await ctx.message.delete()
                await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")``` i hate u
small igloo
maiden fable
#

Bro, who said to use create_webhook repeatedly

spring flax
#

How'd i check the author of a message to extend prefix?

small igloo
maiden fable
#

and who tf said to create a session? For what u doing it

maiden fable
unkempt canyonBOT
spring flax
maiden fable
#

Yea

small igloo
maiden fable
autumn trench
#

i'm trying to make something that changes the colour of a role based on an image, but it's stopped changing the colour/quits printing anything after on_ready is called. any idea how to solve this?```python
@bot.event
async def on_ready():
print('Boost roles active')

@tasks.loop(seconds=2)
async def colour_names():
try:
with open('DATA/BOOSTS/INDEX.txt', 'r') as j:
_colDICT = ast.literal_eval(j.read())
for ROLE in list(_colDICT.keys()):
with Image.open(_colDICT[ROLE]) as f:
colours = np.asarray(f)
print(f"0x{''.join([baseconv.base16.encode(i).lower().rjust(2,'0') for i in list(colours[:,(math.floor(time.time())%(colours.shape[1]*2))//2,0:3][0])])}")
await discord.utils.get(bot.get_guild(917640265475440681).roles, name=ROLE).edit(colour=discord.Colour(eval(f"0x{''.join([baseconv.base16.encode(i).lower().rjust(2,'0') for i in list(colours[:,(math.floor(time.time())%(colours.shape[1]*2))//2,0:3][0])])}")))
except Exception:
pass

colour_names.start()

small igloo
maiden fable
#

!d discord.Message.created_at

unkempt canyonBOT
boreal ravine
#

what fork is good?

placid skiff
#

i don't remember how to do that lol

boreal ravine
#

probably no

small igloo
boreal ravine
#

why disnake

placid skiff
#

Nope, the message which is used became an interaction, so the message became the one which the bot send which can be access by await interaction.original_message but you can get the content of the original message by doing this:
interaction.application_command.qualified_name

small igloo
boreal ravine
#

that's not fair

#

why does pycord suck?

placid skiff
maiden fable
small igloo
placid skiff
#

do you need a message object?

maiden fable
#

Wrong person lol

boreal ravine
maiden fable
placid skiff
#

js sucks xD

small igloo
boreal ravine
small igloo
#

holy fk internet suck

boreal ravine
#

suck what?

unkempt yacht
#

what would the object be for the invocation command?

boreal ravine
unkempt canyonBOT
#
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.

This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.

This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
maiden fable
#

@placid skiff can u help him? I have to go rn

unkempt yacht
#

tyvm

boreal ravine
#

wait, I think it's that anyways

placid skiff
#

Yup i'm trying to understand what he wants to do lol

unkempt yacht
small igloo
placid skiff
#

you

small igloo
#

oh ok wait

small igloo
# placid skiff you

so basically

s = await ctx.channel.create_webhook(name="Webhook")
            async with aiohttp.ClientSession() as session:
                # webhook = Webhook.from_url(s.url, session=session)
                webhook = await bot.fetch_webhook(s.id)
                await ctx.message.delete()
                await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")``` i wana make the bot dosnt create  webhook multiple times
placid skiff
boreal ravine
small igloo
small igloo
placid skiff
#

well as hunter as said you can store the id somewhere, in a file or a database, then before you send the webhook retrieve the id where you saved it and if they have the same id the webhook already exist

crisp shoal
#

hey i want my bot to convert a raw dict i provide in a message into an embed

boreal ravine
#

or they can use TextChannel.webhooks and parse through the list

crisp shoal
#

can someone help me with that

small igloo
placid skiff
#

yes

boreal ravine
unkempt canyonBOT
#

classmethod from_dict(data)```
Converts a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") to a [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") provided it is in the format that Discord expects it to be in.

You can find out about this format in the [official Discord documentation](https://discord.com/developers/docs/resources/channel#embed-object).
small igloo
#

wait, server ID or text channel ID

placid skiff
placid skiff
#

if you don't want to use database

crisp shoal
placid skiff
boreal ravine
small igloo
boreal ravine
unkempt canyonBOT
#

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

Gets the list of webhooks from this channel.

Requires [`manage_webhooks`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") permissions.
small igloo
#

k ty

crisp shoal
placid skiff
#

then you iterate through the list like for webhook_ids in inter.channel.webhooks and check if the id is in the list

boreal ravine
#

this why inter though

placid skiff
#

or doing it in a single line doing this: if any(webhook_id == id for webhook_id in inter.channel.webhooks)

unkempt canyonBOT
#

json.loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)```
Deserialize *s* (a [`str`](https://docs.python.org/3/library/stdtypes.html#str "str"), [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray "bytearray") instance containing a JSON document) to a Python object using this [conversion table](https://docs.python.org/3/library/json.html#json-to-py-table).

The other arguments have the same meaning as in [`load()`](https://docs.python.org/3/library/json.html#json.load "json.load").

If the data being deserialized is not a valid JSON document, a [`JSONDecodeError`](https://docs.python.org/3/library/json.html#json.JSONDecodeError "json.JSONDecodeError") will be raised.

Changed in version 3.6: *s* can now be of type [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray "bytearray"). The input encoding should be UTF-8, UTF-16 or UTF-32.

Changed in version 3.9: The keyword argument *encoding* has been removed.
placid skiff
crisp shoal
maiden fable
unkempt canyonBOT
#

classmethod from_dict(data)```
Converts a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") to a [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") provided it is in the format that Discord expects it to be in.

You can find out about this format in the [official Discord documentation](https://discord.com/developers/docs/resources/channel#embed-object).
maiden fable
#

Nvm someone already told

small igloo
boreal ravine
slate swan
small igloo
slate swan
#

hi

placid skiff
small igloo
crisp shoal
#
async def msg(ctx, *, message):
    data = json.loads(message.content)
    e = discord.Embed.from_dict(data)
    await ctx.send(embed = e)

if i try to !msg {"description": wtv desc, "title": wtv title} it still don't send

slate swan
#

ah, remove the content from there

placid skiff
slate swan
#

everything else seems fine

small igloo
crisp shoal
#
async def msg(ctx, *, message):
    data = json.loads(message)
    e = discord.Embed.from_dict(data)
    await ctx.send(embed = e)

@slate swan will my msg cmd work now

placid skiff
#

change the database you want to use, i suggest sqlite if you're a newbie

placid skiff
#

then create a table where to store the webhooks id, add some more reference like the id of the channel where the webhook was created

small igloo
#

@placid skiff

#can i do "s = await ctx.channel.check_webhook(name="Webhook")"
            if any(webhook_id == id for webhook_id in inter.channel.webhooks):
                pass
            else:
                s = await ctx.channel.create_webhook(name="Salcash RPG Webhook")
            webhook = await bot.fetch_webhook(s.id)
            await ctx.message.delete()
            await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")```
placid skiff
small igloo
# placid skiff can you send me the whole command so i can think a way to implement this?
@bot.command(
    aliases=["say", "impersonate"]
)
async def repeat(ctx, mention:disnake.Member = None, *, text=None):
    if text == None:
        await ctx.send("where text")
    else:
        if mention == None:
            await ctx.send("pls mention someone")
        else:
            #can i do "s = await ctx.channel.check_webhook(name="Webhook")"
            if any(webhook_id == id for webhook_id in inter.channel.webhooks):
                pass
            else:
                s = await ctx.channel.create_webhook(name="Salcash RPG Webhook")
            webhook = await bot.fetch_webhook(s.id)
            await ctx.message.delete()
            await webhook.send(username=mention.name, avatar_url=mention.display_avatar, content=text+f"\n`requested by {ctx.author.name}`")```
crisp shoal
# slate swan will work

i tried to !msg {"description": wtv description, "title": wtv title} with the code above but doesn't send hm

slate swan
#

and there are many other required fields too

crisp shoal
#

oh

#

i got it, thanks sm

slate swan
#

you can do it inside the command itself

crisp shoal
slate swan
#

ah great then

placid skiff
small igloo
placid skiff
#

lol that will never work because id is None in that code

small igloo
placid skiff
#

well i'll start sending you the script, now i have to launch xD

placid skiff
#

i sent it in DM

boreal ravine
#

a

unkempt canyonBOT
#

discord/embeds.py line 183

type: EmbedType = 'rich',```
spring flax
#

hey @maiden fable how would i check if a cog is loaded or not

maiden fable
#

Just use bot.get_cog and see if it's returning None

spring flax
placid skiff
spring flax
#

i.e would i need to use bot.get_cog to compare it?

maiden fable
unkempt yacht
#

this is my code:

@commands.command(name="setstatus")
@commands.cooldown(rate=1, per=30)
@commands.has_guild_permissions(administrator=True)
async def setstatus(self, ctx: commands.Context, *, text: str):
        """Set the bot's status."""
        await self.bot.change_presence(activity=discord.Game(name=text))
        await ctx.send(f"The bot's status was changed to: {args}")
        await message.add_reaction(':tick:948182369347719209')```
I get an error  that there is missing 1 required positional argument. I'm not sure what the problem is.
slim ibex
#

first your indentation is off

unkempt yacht
#

thats discord

slim ibex
#

oh k

#

so I assume this is in a cog

unkempt yacht
#

ye

spring flax
#

give the full traceback

slim ibex
#

message.add_reaction prolly raises an error as message is not a parameter. But, tbh I'm not sure where the other pos arg is. give the traceback

unkempt yacht
#

ok 1 sec

slim ibex
#

is that it?

spring flax
#

give the full traceback

spring flax
unkempt yacht
#

Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 71, in wrapped
ret = await coro(*args, **kwargs)
TypeError: setstatus_error() missing 1 required positional argument: '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/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 979, in on_message
await self.process_commands(message)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 976, in process_commands
await self.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 943, in invoke
await ctx.command.dispatch_error(ctx, exc)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 422, in dispatch_error
await injected(cog, ctx, error)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 77, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: setstatus_error() missing 1 required positional argument: 'message'

maiden fable
unkempt yacht
#

there was quite a lot so i couldnt take ss of it all

spring flax
slim ibex
#

looks like an internal error

unkempt yacht
#

hmm

#

another thing i noticed is this:

dull terrace
#

whats the best way to dynamically access attribute names

spring flax
#

wait

#

you didn't even define message

#

@unkempt yacht ^

final iron
#

Can you give an example of what you want to do?

unkempt yacht
#

so would i do
message =

dull terrace
#

if i had self.attribute and i had attribute as a string i could do locals()["self.attribute"] for example

unkempt yacht
#

and something after the =

dull terrace
#

but use a variable for the attribute part

final iron
#

Still don't understand

unkempt yacht
#

i would right? im just not sure what to put after the =

final iron
#

๐Ÿคทโ€โ™‚๏ธ

dull terrace
#
locals()["self." + jeff]```
final iron
#

Ah

sage otter
#

setattr?

#

Is that what you're talking about?

unkempt yacht
spring flax
#

that's how you define a variable

unkempt yacht
#

what would i put after the =

cold sonnet
#

I have no idea what you're talking about but you're overcomplicating

unkempt yacht
#

to define message

spring flax
unkempt yacht
#

the message the user ran

dull terrace
#

does this explain better if save_type is the attribute name

spring flax
unkempt yacht
#

ohh tysmm

cold sonnet
#

spare yourself a variable

#

ctx.message.add_reaction

slate swan
#

Wut does this do ?@client.message_command() in disnake library

unkempt yacht
#

oh ok ty!

slate swan
spring flax
sage otter
#

!d setattr

unkempt canyonBOT
#

setattr(object, name, value)```
This is the counterpart of [`getattr()`](https://docs.python.org/3/library/functions.html#getattr "getattr"). The arguments are an object, a string, and an arbitrary value. The string may name an existing attribute or a new attribute. The function assigns the value to the attribute, provided the object allows it. For example, `setattr(x, 'foobar', 123)` is equivalent to `x.foobar = 123`.

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 set it with [`setattr()`](https://docs.python.org/3/library/functions.html#setattr "setattr").
dull terrace
#

ahhh okay

slate swan
dull terrace
#

thanks

cold sonnet
dull terrace
#

it's actually for map objects in that example

sage otter
#

yea to dynamically set attributes at runtime

dull terrace
#

wait would setattr work with a dictionary

#

oh i needed to use getattr

#

getattr(cls, 'fields')['key'] = 'value'

cold sonnet
#

!ot

unkempt canyonBOT
jolly basalt
#
role = discord.utils.get(ctx.guild.roles, name = 'Mod')
    mods = role.members
    for i in mods:
        print(f'{i.name} is {i.status}')
#

that does not work

#

it shows everyone is offline

cold sonnet
#

intents

#

you need presences intents

jolly basalt
#

i do

#

or do i?

cold sonnet
#

both in code and in the dev portal?

#

not only members

jolly basalt
jolly basalt
cold sonnet
#

yeah, you only have members

jolly basalt
#

so what should i add

cold sonnet
#

and why did you define a client?

jolly basalt
#

forgot to remove that

cold sonnet
jolly basalt
#

oki, tysm

cold sonnet
#

then you don't even need the other stuff

#

and don't forget the dev portal

jolly basalt
#

i enabled that

cold sonnet
#

๐Ÿ‘

jolly basalt
#

so, what i want to do is

#

check all the mods if they are online or dnd or smth

#

and i want to get the first person

#

for example,

#

{'a' : 'offline'
'b' : offline
'c' : 'online}

#

i want to get a first. if a is not responding, ill get c

#

if this is a dumb question, im sorry

boreal ravine
jolly basalt
#
for i in mods:
  if str(i.status) == 'online':
    x = i
    break

x.send('blah blah blah')
#

something like that?

boreal ravine
#

yes I suppose

#

why not send the message in the loop though

slim ibex
#

x doesnโ€™t exist out of that loop

unkempt yacht
#

docs for message content?

jolly basalt
slim ibex
#

oh

boreal ravine
unkempt canyonBOT
unkempt yacht
#

ty

quaint epoch
#

if a user is a bot user, how do i find it's owner?

#

like, any user

slim ibex
#

the person who owns the bot?

quaint epoch
maiden fable
#

!d discord.ext.commands.Bot.owner_id

unkempt canyonBOT
silk kelp
maiden fable
unkempt canyonBOT
#
I don't think so.

No documentation found for the requested symbol.

maiden fable
#

Bruh not documented

#

Anyways, just use get_user with the owner_id

slate swan
#
@commands.command()
    async def brps(self, ctx, member):
        p = await self.bot.get_prefix(ctx.message)
        prefix = p[0]
        if member == None:
            await ctx.send("Invalid syntax\n;mrps <member>\n Mention the member next time")

        if member == ctx.author:
            await ctx.send("Bruh, how can you play with yourself?")

        if member == self.bot.user:
            await ctx.send(f"Do `{prefix}rps` if you wanna play with me")```
#

the command doesnt even trigger

sage otter
#

just because a variable is not on the same indentation scope as something doesnโ€™t mean itโ€™s non existent else where

#

if that was the case we wouldnโ€™t have dynamically assigned variables

slim ibex
#

He said it was defined elsewhere

sage otter
#

You said what you said before he said that

slim ibex
#

yeah he clarified

sage otter
#

That was the problem tho. You made me think he wouldnโ€™t be able to access "x" if they didnโ€™t have it defined somewhere else

slim ibex
slate swan
sage otter
#

Because you know you said "x doesnโ€™t exist outside that loop"

slim ibex
#

yes I did say that

#

my fault

slate swan
#

how to find whether a member object is a bot or a human

boreal ravine
boreal ravine
slate swan
#

uhm it's documented in pycord docs

boreal ravine
#

nvm it is

final iron
slate swan
#

i found tht method from the docs itself

boreal ravine
#

yeah

quaint epoch
#

What object does await ctx.send() return?

spring flax
quaint epoch
spring flax
#

define the send as variable

quaint epoch
slate swan
#

how to find whether a member object is a bot or a human ;-;

quaint epoch
slate swan
#

ohh alright

spring flax
unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
quaint epoch
boreal ravine
tepid tiger
#

hi, can I ask a question about discord bot creation?

boreal ravine
#

using a string sometimes fail though

tepid tiger
#

I want vey simple things but i am doing something wrong

#

actually I am trying to do that; bot will remove a role of mentioned user in a spesific channel

#

but not as command, it can be in a sentence mentioned that user

#

i wrote that code :

  if "@" in message.content:
    message.content = message.content.split("@",1)[1] 
    message.content = message.content.split(" ",2)[0] 
    a = message.content
    a = a.replace("<","")
    a = a.replace(">","")
    a = a.replace("@","")
    a = a.replace("&","")
    a = a.replace("!","")
    await message.channel.send( a + " " + "is free!")
    #user_id = "<" + "@" + a + ">"
    #a = int(a)
    user = await client.fetch_user(a)
    role = discord.utils.get(user.guild.roles, id = a)
    await client.add_roles(user, role)
    await message.channel.send( user + " " + "is free!")
slate swan
slate swan
tepid tiger
#

no for example "@tepid tiger is free have a good day"

#

when i wrote that it will remove a role of that user

#

not the author's

slate swan
tepid tiger
#

not exactly,

#

it can be any sentence but its the important thing is

quaint epoch
#

how do i get the id for an emoji? (not with my bot just with my discord)

#

i tried right clicking and stuff, but it's not working

tepid tiger
#

mentioned user can be end of the senctes or begining of the senctes

honest vessel
#

hello botmakers

tepid tiger
#

"Today @tepid tiger is so happy"
"what a wonderful day right @tepid tiger ?"

#

these are examples

honest vessel
#

@quaint epochpost ur emoji and put \ infront of it

flat solstice
#

So I'm trying to adapt a dpy embed pagination lib to work with hikari which is going okay. This lib has ctx as a parameter in several places (for example py class Paginator: def __init__( self, bot: Union[AutoShardedBot, Bot], # ik I'll need to change this to gateway bot for hikari ctx: Union[ InteractionContext, # This is from one of the libs depancies (the paginator lib is a extenion of a different interactions lib) so does hikari have something similar Context, # Hikari doesn't have this TextChannel, # Hikari's is GuildtextChannel ik User, Member, ],and I'm wondering what I could swap this out with since hikari doesn't have ctx. I though about using lightbulb or tanjun but I don't want to tie it to one specific library, is there a way I can check if a import actually exits or not (say if I imported tanjuns ctx but don't have tanjun installed the bot would just carry on and disregard any tanjun ctx references) or should I try to make my own ctx for the paginator and if so does anyone know any good examples I could check out on how ctx is made

tepid tiger
#

i want to scan the sentences and find the mentioned user, then take his role

#

so i wrote if "@" in message.content that alows to find mentioned someone in the sentence

honest vessel
#

you have message.mentions or something like that

tepid tiger
#

but it takes the user id not user as an object, so i cannot give a role or cannot remove a role by using his user.id

honest vessel
#

u can fetch user

#

by id and get object

#

oh btw fetch_member

tepid tiger
#

did I explain clearly? ๐Ÿ˜…

honest vessel
#

better if u show code ๐Ÿ˜„

quaint epoch
#

i still can't fetch an emoji

#

await ctx.guild.fetch_emoji('๐Ÿ‘‹')

honest vessel
#

that is a global emoji

quaint epoch
honest vessel
#

!d discord.Guild.fetch_emoji

unkempt canyonBOT
#

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

Retrieves a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") from the guild.

Note

This method is an API call. For general usage, consider iterating over [`emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.emojis "discord.Guild.emojis") instead.
honest vessel
#

and you also doing wrong u using an unicode emoji and not an ID of an emoji

#

but still thats a unicode global emoji and not a discord-guild emoji so therefor it has no ID

spring flax
#

if I unload a cog, it won't be in bot.cogs right?

quaint epoch
#

this good

honest vessel
#

if u unload a cog its gone yes

honest vessel
quaint epoch
slim ibex
slate swan
#

!d disnake.Client.get_guild

unkempt canyonBOT
tepid tiger
#

@slate swan ?

spring flax
# honest vessel if u unload a cog its gone yes

Then why does

@bot.command()
async def cogs(ctx):

    loaded_cogs = set(bot.cogs.keys())
    all_cogs = set(list_of_cogs)
    unloaded_cogs = (all_cogs & loaded_cogs)
    await ctx.send(unloaded_cogs)โ€Š

This returns none even when i unload a cog

#

By none i mean it returns a empty set set()

slate swan
tepid tiger
slate swan
tepid tiger
#

actually there is a FIFA discord

#

and captains write their players name when they are free

#

so the players have the team role and when the captain say "this guy is free!" its automaticly lose his team role

#

we do it manually so we want to do that

honest vessel
#

@spring flaxbot.unload_extension

spring flax
spring flax
vocal snow
#

cogs or extensions?

honest vessel
#

bot.cogs

honest vessel
#

@spring flax oh bot.cogs will still have cogs even if unloaded i guess

spring flax
slate swan
honest vessel
#

@spring flaxthis is how i have to see cogs loaded or not,
first i have a global variable that contains a list of cogs i wanna load at botup then i use that list to check if its in bot.cogs or not

            for x in self.bot.botcogs:
                if x in self.bot.cogs:
                    description += f"โœ… **{x.title()}**\n"
                else:
                    description += f"โŒ **{x.title()}**\n"
slate swan
honest vessel
#

my_guild.owner

#

i guess

tepid tiger
#

okay; imagine that there are 2 different text channel; 1. is agreement room; which is when the captain agree with a palyer text his name in that room like " @tepid tiger is our player anymore" and we want to give ceksar to team role when he was mentioned in that room,

the 2. room is contract termination room; which is captain write the player name again when they cancel their contract with player such as " @tepid tiger is not our player anymore, good luck in football life..." and the his team role from the ceksar.

flat solstice
# slim ibex Union with autoshardedbot and bot?

yeah, it's a dpy extension lib that i'm trying to adapt to work with hikari (there's very little actual dpy code it's more the lib linking other things together). Hikari doesn't need autoshardedbot or bot bc it has gatewayBot (which is sharded all ready

tepid tiger
slate swan
#

if message.mentions(person):
if message.channel.id == id_of_contract_cahnnel: add role
if message.channel.id == id_of_termination_channel: remove role

Pseudo but should give you an idea

honest vessel
#
if not country.nato_member:
    russia.invade(country)
``` #withukrainewestand ๐Ÿ‡บ๐Ÿ‡ฆ
quaint epoch
#

if a member is a bot, how do i find it's owner?

honest vessel
#

u cant i think

quaint epoch
#

!d disnake.AppInfo

unkempt canyonBOT
#

class disnake.AppInfo```
Represents the application info for the bot provided by Discord.
quaint epoch
#

oh nice

honest vessel
#

oh

#

@quaint epochbutisnt that just your own bot?

flat solstice
#

so disnakes the currently recommended fork of dpy right?

quaint epoch
honest vessel
#

ah nice thanks ! didnt know that

boreal ravine
# spring flax Get loaded and unloaded cogs

I mean you could make a list of all the cogs you have and do something like this ```py
loaded = []
unloaded = []

cogs = ["Eco", "Mod", "Info"]

for key in dict(bot.cogs).keys():
if key not in cogs:
unloaded.append(key)
else:
loaded.append(key)

honest vessel
#

what i kinda showed him earlier

#
for x in self.bot.botcogs:
                if x in self.bot.cogs:
                    description += f"โœ… **{x.title()}**\n"
                else:
                    description += f"โŒ **{x.title()}**\n"
``` and that i have a list of the cogs i want to load on botup
#

wich is a global var called botcogs

quaint epoch
#

oh nvm you can't get a bots owner info

boreal ravine
quaint epoch
boreal ravine
#

!d discord.Client.application_info

unkempt canyonBOT
#

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

Retrieves the botโ€™s application information.
quaint epoch
#

for every bot, not just the current client

boreal ravine
#

oh nvm

boreal ravine
quaint epoch
placid skiff
quaint epoch
maiden fable
#

yea

quaint epoch
#

does disnake.RawReactionActionEvent let you check the user that added/removed the action?

modern fiber
#

Guys how can I run two bots at the same time? like how do I open pycharm two times

quaint epoch
#

!d disnake.RawReactionActionEvent.user_id

unkempt canyonBOT
quaint epoch
#

nice

boreal ravine
#

no parentheses

quaint epoch
#

!d disnake.Message.clear_reactions

stray carbon
#

is it possible to make a global userinfo command in discord.py??
(that shows user info even if they arent in the guild)

quaint epoch
#

lol i was working on the same thing

slate swan
#

how to have same check function for multiple buttons

stray carbon
quaint epoch
#

well, get or fetch what u prefer

slate swan
slate swan
#

no?

quaint epoch
#

!d disnake.Message.remove_reaction

unkempt canyonBOT
#

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

Removes a reaction by the member from the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://docs.disnake.dev/en/latest/api.html#disnake.Emoji "disnake.Emoji").

If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_messages "disnake.Permissions.manage_messages") permission is needed.

The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://docs.disnake.dev/en/latest/api.html#disnake.abc.Snowflake "disnake.abc.Snowflake") abc.
slate swan
#

get_user gets the user obj from cache which the bot only caches the user it can see

quaint epoch
#

then what about await bot.fetch_user()

slate swan
boreal ravine
quaint epoch
slate swan
stray carbon
# quaint epoch fetch the user

oh without guild,maybe this

@client.command()
async def userinfo(ctx, user:discord.User):
  mem = fetch_member(user)
  await ctx.send(f'Name: {user.name}')
slate swan
stray carbon
#

what uh

slate swan
stray carbon
slate swan
#

i think you ment user lol

#

!d discord.ext.commands.Bot.fetch_user

unkempt canyonBOT
#

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

Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.

Note

This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_user "discord.ext.commands.Bot.get_user") instead.
slate swan
stray carbon
#

user

scarlet rune
#
@commands.command(aliases=['senddm', 'dm', 'sdm'])
    async def send(self, ctx, target:disnake.Member, message=None):
        if message is None:
            await ctx.reply("You must include a message.")
        dmmessage = disnake.Embed(color=magcolor, description=message, timestamp=dt)
        dmmessage.set_footer(text=f'from {ctx.author.name}#{ctx.author.discriminator} | reply with: e!re <message>',
                             icon_url=ctx.author.avatar.url)
        await target.send(embed=dmmessage)
        await ctx.message.add_reaction('โœ…')
        print(f'{ctx.author.name}#{ctx.author.discriminator} messaged {target.name}#{target.discriminator};')

``` I forgot how to dm specific user, is this right? this seemed to be working back then. It's not working anymore
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**.
scarlet rune
scarlet rune
boreal ravine
#

hm

scarlet rune
boreal ravine
#

maybe the bot can't DM the member because the member disabled DMs

scarlet rune
#

i tried it on myself, it didn't work

scarlet rune
boreal ravine
#

do you have jishaku?

scarlet rune
boreal ravine
scarlet rune
#

never tried it

modest plover
#

Can a bot use either of these:

  1. Animated Emojis
  2. Emojis from a server it isn't in
boreal ravine
modest plover
#

How do I get the animated emojis then? I can't copy the id I'm on mobile and I also don't have nitro

sage otter
#

Put a backslash then the emoji and send

scarlet rune
modest plover
#

The way I get them atm is \:emoji: but I don't have nitro so I can't do that

scarlet rune
#

when i didn't put the message arg, the bot doesn't even reply with the if statement

boreal ravine
#

You are rate limited

fallow mauve
#

ok

boreal ravine
#

also is that your actual IP

fallow mauve
#

maybe ๐Ÿ‘€

slate swan
#

you just leaked your ip lmao

scarlet rune
boreal ravine
fallow mauve
modest plover
#

Don't

slate swan
#

thats just your replits ip then

fallow mauve
#

good

boreal ravine
coarse anvil
#

does anybody know the code to blacklist words?

fallow mauve
quaint epoch
#

how do you find when a guild was created

scarlet rune
boreal ravine
unkempt canyonBOT
quaint epoch
fallow mauve
boreal ravine
placid skiff
# quaint epoch thanks!

Bro try to use the docs sometimes, not because i don't want to help you but literally this is the same method you used for the message but with a different object lol

coarse anvil
boreal ravine
#

I recommend you use a proper IDE though (VSC/pycharm)

left crater
#

sublime is decent

placid skiff
#

VSC/Pycharm are already configured

left crater
#

its based on preference

placid skiff
#

Plus sublime is a text editor and not an IDE

boreal ravine
scarlet rune
placid skiff
boreal ravine
#

I'm clueless at this point

placid skiff
#

Do you have any on_message event?

slate swan
#

plus you can download pyright to check types

placid skiff
boreal ravine
scarlet rune
#

the only cog listener is on_ready it doesn't affect anything...

slate swan
boreal ravine
placid skiff
#

He is using disnake

scarlet rune
#

waiting for answer there, i hate that my bot starts breaking randomly

placid skiff
#

btw what IDE are you using?

scarlet rune
#

me? pycharm

placid skiff
#

Good then, add a breakpoint at if message is None and run a debug

#

write the command and let's see if the code runs

slate swan
boreal ravine
#

why not

final iron
#

It shouldn't be an issue

placid skiff
modern fiber
#

How do I make a bot send a custom emoji?

placid skiff
#

You have to use the id of the emoji and sent it by doing this :ID: i think

modern fiber
#

<:emoji-name:emoji-id>

#

or like this? huh' Ill try

wicked atlas
modern fiber
placid skiff
#

it should

boreal ravine
placid skiff
#

A wild Hunter has appeared

scarlet rune
scarlet rune
#

i'm clueless lol

placid skiff
#

Do you use the correct prefix?

scarlet rune
#

yeah

placid skiff
#

the command is in a cog?

scarlet rune
#

yeah

slate swan
placid skiff
#

do you loaded the cog?

scarlet rune
#

yeah, the other functions works well

boreal ravine
shell oar
#

im attempting to make an anti nuke/logging bot. basically uses the same idea and base of an anti, but logs instead of banning. my current way of getting user who triggered x event is [entry.user async for entry in guild.audit_logs(limit=1, action=event_action, oldest_first=False)][0]. that would ideally return the user object but that is flawed many ways. sometimes my bot is delayed and doesnt actually get the audit log and returns index error, sometimes discord is delayed and i get the same error. my bot may be behind and return a different user object. i notice audit_logs has other parameters such as before and after. i thought i could make a datetime object upon the event being triggered, and for the before add maybe timedelta 10 seconds, and for after subtract maybe timedelta 10 seconds. would this solve my problems?

i also thought about maybe doing something like

async for entry in guild.audit_logs(limit=10, action=event_action):
   if entry.target is x:
      return entry.user
      break``` 
or maybe dont event specify an action, and then in the if statement check target and action? 

just what would be the most optimal/fastest way to get the entry.user object?

seems like the parameters and the attributes on AuditLogEntry are almost identical, not sure what would be as optimal?

or is there another way to get the user who made x object
final iron
scarlet rune
#

imma try using slash command maybe if it shows any difference

placid skiff
#

Well with slash you should find no problem

#

but that is strange

slate swan
final iron
scarlet rune
#

indeed, and i still have 3 school projects on the line

boreal ravine
#

you guys it's just PEP8 at the end of the day it's not that big of a deal no one will read your shit code anyways?

sage otter
#

Okimii you probably thought it did because it mirrors any Messegeable.send().

slate swan
sage otter
#

Thatโ€™s only built ins okimii

slate swan
#

i thought about it

red sundial
boreal ravine
placid skiff
final iron
slate swan
#

bro whos talking about built inslemon_glass

maiden fable
#

Can u both take it to an ot channel? @slate swan @final iron

red sundial
#

no

final iron
slate swan
#

lmaooo

final iron
#

So what's the issue?

placid skiff
#

and the send method of a member/channel can't interfer with that command because you don't do something like this:

from discord.Guild.TextChannel import send

Even because you can't do that

boreal ravine
#

..

maiden fable
#

uhhhh?

boreal ravine
#

do you wanna get muted

daring olive
#

that's not the appropriate response to someone telling you to follow our rules

slate swan
red sundial
maiden fable
final iron
red sundial
daring olive
slate swan
final iron
daring olive
#

!rule 7 anyway, this is in fact one of our rules btw

unkempt canyonBOT
#

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

slate swan
#

you guys dont see my point on how to name a method correctlylemon_glass

sage otter
#

No okimii because your logic doesnโ€™t work

sage otter
#

The method naming rule only applies to built ins

placid skiff
#

Well guys let's cut this off

maiden fable
#

istg this would be the first argument I am not a part of and I am happy about it ๐Ÿ˜”

#

@daring olive shush time for this channel?

slate swan
boreal ravine
#

no

slate swan
daring olive
maiden fable
daring olive
#

i'm not sure i see an argument lol. disagreements are fine, however. so long as they remain civil. don't be sarcastic or demeaning or condescending and you're all good

red sundial
#

well said

slate swan
#

yuppithink

daring olive
#

like maybe overusing lemon_glass is a bit much

boreal ravine
placid skiff
#

what if i'm always sarcastic? xD

daring olive
#

best not to be sarcastic with strangers you don't know in a public space on the internet that has moderators

maiden fable
#

Also @slate swan that print func gonna return an error iirc

red sundial
#

its not like you have to follow it 100%

livid jacinth
#

Hey, i tryed to make a bot who send a message if a specific user come online. I dont know how i can check whether he is online and the Id. Does anyone can help me?

slate swan
placid skiff
maiden fable
slate swan
red sundial
maiden fable
#

One is enough for today

placid skiff
#

Oke boss

scarlet rune
slate swan
#

you guys do know pep means Python Enhancements Proposal rightlemon_glass

modern fiber
#

It doesn't work? Can someone help me how do I send custom emojis with bot?

scarlet rune
boreal ravine
placid skiff
#

it is written in the exception

livid jacinth
#

i forgot it

boreal ravine
red sundial
#

pip obviously

livid jacinth
#

yes

nocturne saddle
#

pycord >

boreal ravine
#

where did you download it from? pypi? github?

red sundial
#

pypi probably

livid jacinth
#

pypi ig

boreal ravine
#

!d discord.on_presence_update use this then

unkempt canyonBOT
#

discord.on_presence_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their presence.

This is called when one or more of the following things change:

โ€ข status

โ€ข activity

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

check if the member is a certain member

#

and if it's the member send the message to them

red sundial
# unkempt canyon

you would also need the presence intent for this don't forget about that

livid jacinth
#

I've tryed this if after.status is discord.Status.online:

livid jacinth
#

i dont know it dont send a message and i dont get an error

boreal ravine
#

maybe try casting the members status ```py
if ... == "online":
...

whole shoal
#

@client.event
async def on_guild_join(guild):
    await guild.leave()

Is this a good bot?

red sundial
#

๐Ÿคจ

whole shoal
#

Nicee time to make it

quaint epoch
#

the docs didn't cover this, member.pending is a bool that tells whether or not the member is verified, but what kind of verification?

#

like, a verified discord partner?

#

or verified through email?

red sundial
#

no like when you sign up you have to verify from email

quaint epoch
livid jacinth
#

It doesnt work

red sundial
#

so this can be used to ban spammers and raiders

boreal ravine
boreal ravine
red sundial
#

i always thought it was to prevent new accs

livid jacinth
boreal ravine
boreal ravine
#

you do know what casting is right?

livid jacinth
#

mhh no ig not

red sundial
#

str()

livid jacinth
#

aaa

livid jacinth
boreal ravine
#

yes

livid jacinth
#

Okayy its works but it spam the message and i want also the the message will send if a specific user comes online. can i do this? if str(after.status) == "online" and str(after.id) == "1235456":

boreal ravine
#

yes

#

IDs are integers though in the rewrite

livid jacinth
#

Ok it works thanks

#

But the bot spam the message what can I do about it?

#

did you know something?

slate swan
#

Channels

boreal ravine
#

does it send the message two times? or does it send the message more than two times

livid jacinth
#

more than two times

nimble plume
#

.