#discord-bots

1 messages Β· Page 997 of 1

slate swan
#

yes

frozen patio
#

Clash royale is ok

slate swan
#

better documentation

frozen patio
#

Yes

sick birch
slate swan
slate swan
keen talon
slate swan
#

no

frozen patio
slate swan
slate swan
sick birch
#

Guys please, way off topic

frozen patio
#

Ok

gaunt ice
#

tru

frozen patio
#

.ot

slate swan
#

!ot

unkempt canyonBOT
frozen patio
#

Mm

slate swan
#

come ot 3

#

robin mad he got raided on coc

frozen patio
#

Ok yes

slate swan
#

#ot3

gaunt ice
#

...

frozen patio
slate swan
quaint epoch
#

coc 🀨

slate swan
#

tf there are 012

radiant orbit
#

When I call client.user it returns the username along with it's 4 digit number, how do I make it so it just prints the name without the numbers?

slate swan
#

😳

radiant orbit
#

tytytyty

sick birch
#

yup

slate swan
stuck lily
#

hello... i'm building a discord bot that can monitoring several websites... the bot is online and monitoring the website now.. but the bot didn't send a respond message in the channel...

sick birch
#

Code?

stuck lily
#

i used this guy github as main references...

#

i just changing my token, channel id, website url etc...

unkempt canyonBOT
#

Hey @stuck lily!

It looks like you tried to attach file type(s) that we do not allow (.rar). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.

Feel free to ask in #community-meta if you think this is a mistake.

stuck lily
#

seems like i can't send all the files here since discord not support .zip

stuck lily
radiant orbit
#

x3

gaunt ice
#

I'm sry for ping

radiant orbit
#

npnp ty anyway

slate swan
#

ded chat

#

shit :'/

quick gust
#

it's a help channel, you don't need to point out if a chat isn't active because that won't help in any way

stuck lily
# sick birch Code?

if anyone can figure what went wrong with my code, its really2 helping me...

paper sluice
#

just ask questions to keep it alive :P

sick birch
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.

sick birch
#

It's just hard to tell where and what the issue is with nothing to go off of but your entire project directory

stuck lily
#

i change my token as 'my_token_here' for security purpose...

#

the issues with it, my discord bot is able to monitor my target website... but the bot didn't send any status on the discord channel...

sick birch
#

Any traceback?

stuck lily
#

after i run my bot... this pop-up showed telling me that the bot are now monitoring my target website

#

discord bot supposedly send message on discord channel like this

#

but it didn't send anything

#

its just update my bot status to this

tacit horizon
#

Py vs js

quaint epoch
#

i just like py more

stuck lily
stuck lily
slate swan
#

show code

#

@stuck lily

slate swan
sick birch
dull terrace
#

has anyone experimented with sound effects for their bots through using VC?

stuck lily
unkempt canyonBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.

steady ember
#

discord.ext.commands.errors.ChannelNotFound:

#

Error handler required!

stuck lily
slate swan
sick birch
molten shard
#

yo

#
async def mybanner(ctx):
    mbed = discord.Embed(
    color=discord.Colour(0x303136),
    description=f"{ctx.guild.name} [banner]({ctx.guild.banner_url})"





    )
    
    mbed.set_image(url=f"{ctx.author.banner_url}")
    await ctx.send(embed=mbed)```
#

i made this command to get a users banner and for some reason i get a error saying

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'banner_url'

#

and how is that?

stuck lily
molten shard
#

alot of my commands dont work

#

await ctx.reply dont work

stuck lily
slate swan
brisk dune
#

Same with ctx.author.banner.url, not ctx.author.banner_url

#

well nvm

#

!d discord.User.banner

unkempt canyonBOT
#

property banner```
Returns the user’s banner asset, if available.

New in version 2.0.

Note

This information is only available via [`Client.fetch_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
brisk dune
#

!d discord.Asset

unkempt canyonBOT
#

class discord.Asset```
Represents a CDN asset on Discord.

str(x) Returns the URL of the CDN asset.

len(x) Returns the length of the CDN asset’s URL.

x == y Checks if the asset is equal to another asset.

x != y Checks if the asset is not equal to another asset.

hash(x) Returns the hash of the asset.
brisk dune
#

to get the URL

slate swan
stuck lily
slate swan
#

... did even check the message?

#

Nvm

slate swan
#

Haha, cool

#

XD

#

..

slate swan
brisk dune
slate swan
slate swan
#

lunter

brisk dune
slate swan
#

that I lunter

brisk dune
slate swan
#

heh

brisk dune
#

Highlight ftw

paper sluice
#

!ot πŸ’€

slate swan
#

epic ot fail

brisk dune
#

I was just about to say I don't wanna derail this channel again

slate swan
#

Hey so I wanna do like a setup for my bot, example:
,setup cmdlogschn #general
And every command used in that particular server should say something like (user used cmd) in the channel mentioned during setup
Possible?

paper sluice
slate swan
#

idk

brisk dune
slate swan
slate swan
slate swan
slate swan
#

k

brisk dune
slate swan
#

k

#

mention

brisk dune
#

Have I been whooooshed?

slate swan
#

yeah kinda ig

#

dw, it's ok haha

brisk dune
slate swan
#

the number of time you edited your message is just... 😭

supple thorn
#

I smell mods

slate swan
#

oh shit, hi cokecane :")

supple thorn
#

Hello

supple thorn
#

A driver's license?

slate swan
slate swan
#

..

supple thorn
#

Oh wait

#

Aren't you 17

slate swan
#

Cokecan 2

supple thorn
#

Then your birthday is in 4 days

slate swan
#

is typing

#

yeah lmao, bro got the point

slate swan
supple thorn
#

Wait where ashley

slate swan
#

wha

#

@slate swan ash name fine

supple thorn
slate swan
#

Cokecane 2

supple thorn
#

πŸ˜”

slate swan
#

sus

slate swan
slate swan
supple thorn
slate swan
supple thorn
#

I was about to reply

slate swan
#

u ignoring me? lmao

slate swan
slate swan
#

πŸ’€ πŸ˜‚

supple thorn
#

No delete 😠

slate swan
#

lets all number up cokecane and change our nicknames

#

wait

supple thorn
#

This is how mods are forced to ban the name cokecane

slate swan
#

lmao

#

listen

#

guys listen

#

nvm wrong spelling of my name again-

slate swan
#

lmao

#

on a side note, we'll be warned sooner if we stay here

#

..

#

yo

#

@slate swan im making timer for my giveaway cmd :>

#

nice

slate swan
#
@bot.command()
async def cokeban(ctx):
    for members in ctx.guild.members:
       if members.name.lower() == "cokecane": 
           try:
                await members.ban(reason="cokecane")
           except:
                pass
heavy folio
#

.ban is a coro btw

slate swan
#

fine

brisk dune
# slate swan ```py @bot.command() async def cokeban(ctx): for members in ctx.guild.member...

Excerpt from a refactoring extension I use:

We suggest making the following changes to Function cokeban:

 @bot.command()
 async def cokeban(ctx):
     for members in ctx.guild.members:
-       if members.name.lower == "cokcane": 
-           try:
+        if members.name.lower == "cokcane": 
+            try:
                 members.ban(reason="cokecane")
-           except:
+            except Exception:
                 pass

Sourcery - Use except: Exception rather than bare except sourcery(suggestion)

slate swan
#

uh

brisk dune
#

lmao get refactored

slate swan
#

;-;

brisk dune
#

After accepting that one, I got this:

Function cokeban refactored with the following changes:

Use contextlib's suppress method to silence an error. (use-contextlib-suppress[ https://docs.sourcery.ai/refactorings/use-contextlib-suppress/ ])

+import contextlib
 import discord
 from discord.ext import commands
 import os

 async def cokeban(ctx):
     for members in ctx.guild.members:
         if members.name.lower == "cokcane": 
-            try:
+            with contextlib.suppress(Exception):
                 members.ban(reason="cokecane")
-            except Exception:
-                pass

Sourcery - Use contextlib's suppress method to silence an error. sourcery(refactoring)

slate swan
#

πŸ’€ oh gwad wtf

brisk dune
#

It turned this:

@bot.command()
async def cokeban(ctx):
    for members in ctx.guild.members:
       if members.name.lower == "cokecane": 
           try:
                await members.ban(reason="cokecane")
           except:
                pass

to this:

import contextlib
@bot.command()
async def cokeban(ctx):
    for members in ctx.guild.members:
        if members.name.lower == "cokcane": 
            with contextlib.suppress(Exception):
                members.ban(reason="cokecane")
slate swan
#

πŸ™„

#

very tilt cmd

sage ravine
#

Damn

slate swan
slate swan
sage ravine
#

🀣

brisk dune
slate swan
#

😎

brisk dune
slate swan
#

yo u cant copy me

brisk dune
#

Lmao ok I'll appoligize

#

I'm sorry

#

Let's not make this channel any more ot than it has to...

sage ravine
#
import contextlib
@bot.command()
async def cokeban(ctx):
    for members in ctx.guild.members:
        if members.name.lower == "cokcane": 
            with contextlib.suppress(Exception):
                members.ban(reason="cokecane")β€Š

This is New for me

#

The exception

slate swan
paper sluice
sage ravine
#

XD i have to try this
Haven't used this

slate swan
#

now get questioned

brisk dune
slate swan
#

"refactoring engine"

paper sluice
#

πŸ‘€

sage ravine
brisk dune
slate swan
sage ravine
slate swan
#

done

paper sluice
#

u dont need to run it...

heavy folio
#

no i just saw that again because discord decided to be dumb and jumped to that message when i came back here

slate swan
#

..

heavy folio
slate swan
#

so much chat related to cokecane

slate swan
#

We are choosing the cmd to ban

#

anyone want a coffe?

brisk dune
#

coffe

sage ravine
#

A bare except: clause will catch SystemExit and KeyboardInterrupt exceptions, making it harder to interrupt a program with Control-C, and can disguise other problems.

paper sluice
#

~~bare except will also catch a robber, so we should keep it ~~

sage ravine
#

Use contextlib's suppress method to silence a specific error, instead of passing in an exception handler. This refactoring will add an import for contextlib if needed.

Before

try:
    travel_world(days=80)
except DistractionError:
    pass
After

import contextlib

with contextlib.suppress(DistractionError):
    travel_world(days=80)
sage ravine
#

I was reading that article

paper sluice
sage ravine
#

Like?

paper sluice
#

catching a robber....

sage ravine
#

Using python

paper sluice
#

sure

sage ravine
#

Well

slate swan
#

This is embed title
this is embed description
today at 11:30

sage ravine
#

Not a bad idea

#

hey
Hello
Bye

slate swan
#

nice for normal msg errors

sage ravine
#

Who have study automata here?

paper sluice
slate swan
#

promotion get banned

brisk dune
#

It's literally not a promotion

#

but ok, I'll remove it

paper sluice
#

ah ive seen this

paper sluice
sage ravine
#

Does sharing a link here result ban?

slate swan
sage ravine
#

How to do minutes ago?

paper sluice
#

the format is <t:time-in-epoch:formatter>

sage ravine
#

<t:1650779940:R>

paper sluice
#

!d discord.utils.format_dt

unkempt canyonBOT
#

discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.10)") for presentation within Discord.

This allows for a locale-independent way of presenting data using Discord specific Markdown...
paper sluice
#

there is this also which u can use, for ur bots

brisk dune
#

Well damn, TIL

bleak karma
#

help?

for filename in os.listdir("./cogs"):
    if filename.endswith(".py"):
      bot.load_extension(f"cogs.{filename[:-3]}")
      print(f"{filename} Cog Loaded!")

it gives me an error:

main.py:30: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
  bot.load_extension(f"events.{filename[:-3]}")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

but if i put await bot.load_extension it wont work either

brisk dune
#

It might be an indentation error

#

if that's the same indentation you have in your actual code

stuck lily
#

is there any website of site that have basic code for discord bot build?

slate swan
#

example folder i mean.. that they've in their repo

#

:'/

slate swan
#

sparky shush

#

Ok

#

lmao

#

uh

#

Pfp

#

Change pfp

#

no

#

πŸ’€ yeah, even i dont like that idea too much

#

friends be thinking that i'm catfishing πŸ’€

#

lmao

slate swan
#

lmao

#

Lol

#

Ur already cat fish

#

i like cats tho

#

nvm, this is off topic

#

Pls change ur name to the original one

paper sluice
slate swan
#

Both of u

slate swan
#

I can load without it

#

πŸ€” it wasn't an async function before right?

#

Without awaiting it

slate swan
paper sluice
slate swan
keen talon
slate swan
slate swan
paper sluice
slate swan
slate swan
#

🐍

#

you could monkey patch the library code and change it to a normal function

#

Im using latest disnake ig

#

..

#

me too lmao, like i'm using latest py-cord.. and still ain't feeling the need to await...

slate swan
#

no disnake.Bot

slate swan
slate swan
slate swan
paper sluice
#

my sense of names has left, and grammar f

slate swan
#

..

#

ego is typing

slate swan
#
    @commands.command(name="help", description="view the usage for a command", usage='help [cmd]', aliases=['commands', 'usage'])
    async def help(self, ctx, command=None):
        if command is None:
            # commandsList = ""
            # for command in bot.commands:
            #     commandsList += f"`{command.name}`,"
            commandsList = []
            for command in self.bot.commands:
                if command.require_var_positional:
                    commandsList.append(f"{command.name}*****")
                else:
                    commandsList.append(f"{command.name}")
            embed = discord.Embed(
                description=f"**questions @ woke#7396**\n"
                            f"{len(self.bot.commands)} commands in total\n"
                            f"\u200b\n"
                            f"{', '.join(commandsList)}",
                color=0x8e65b3)
            await ctx.send(embed=embed)
        else:
            for cmd in self.bot.commands:
                if command == cmd.name or command in cmd.aliases:
                    if not cmd.aliases:
                        cmd.aliases.append("no aliases")
                    embed = discord.Embed(title=cmd.name,
                                          color=0x8e65b3,
                                          description=cmd.description
                                          )
                    embed.add_field(name="usage", value=cmd.usage, inline=False)
                    embed.add_field(name="aliases", value=', '.join(cmd.aliases), inline=False)
                    await ctx.send(embed=embed)

this is my help cmd, how do i make it so i can see the help embed from group commands?
for instance:
,help welcome works
BUT
,help welcome add doesn't work

keen talon
slate swan
#

Bye imma go play some games

slate swan
slate swan
keen talon
tired hinge
#

how do i make an argument optional in a command?

slate swan
paper sluice
#

Tobey Maguire was good :)

slate swan
#

1st

tired hinge
slate swan
slate swan
paper sluice
keen talon
slate swan
#

on u r not

slate swan
#

oh lol nvm

#

Boat

#

Change ur name!!!

slate swan
#

my bro, ego, been typign since last 2 minutes

slate swan
#

oh lol πŸ˜‚

slate swan
paper sluice
slate swan
#

I've already looked that over and read it through carefully a few times, but it just makes no sense

paper sluice
#

πŸ€¦β€β™‚οΈ

slate swan
#

sparky as nail typer?

paper sluice
#

snail

slate swan
#

sheesh

#

Ye im snail typer

#

i was literally about to say that same thing for u .. like wtf what have u even been typing

slate swan
paper sluice
#

rip

slate swan
#

Imagine so fast without using pc

keen talon
slate swan
keen talon
slate swan
#

Delete dc now

unkempt canyonBOT
#

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

paper sluice
#

they pollute the chat with embeds then delete

unkempt canyonBOT
slate swan
#
        role = discord.utils.get(ctx.guild.roles, name="muted")
        if member is None:
            return await ctx.send("missing arguments")
        if member is not None:
            if member.top_role >= ctx.guild.me.top_role:
                return await ctx.send("i can't mute someone above my top role")
        if role not in ctx.guild.roles:
            perms = discord.Permissions(send_messages=False, speak=False)
            await ctx.guild.create_role(name="muted", permissions=perms)

how do i make it so when it creates the role, it also makes it so it edits the category/channel permissions to send_messages=False & speak=False?

waxen ruin
#

can I store additional data in a message not visible to users using discord.py? For example, I send a message showing the profile of a user via my bot, and then the bot has added a delete reaction to it. How can I store the owner users user id or some other unique id for the user to that message, so that when the user reacts to that message, it checks if the message is owned by the user, and only the user can delete it.

#

So basically make the reaction buttons of one message only usable by a certain user

#

And hard coding is not an option as it basically is like a server list

#

Thanks

junior plinth
slate swan
stray carbon
#
emoji = "![s_online](https://cdn.discordapp.com/emojis/967675394339770368.webp?size=128 "s_online")" if round(self.bot.latency * 1000)<100 "![s_dnd](https://cdn.discordapp.com/emojis/967675629015273553.webp?size=128 "s_dnd")" elif round(self.bot.latency * 1000)<500 else "![s_dnd](https://cdn.discordapp.com/emojis/967675447963955220.webp?size=128 "s_dnd")"
        ```
#

what is proper syntax for this

quaint epoch
junior plinth
quaint epoch
#

just set a default value

slate swan
junior plinth
quaint epoch
slate swan
quaint epoch
junior plinth
slate swan
#

str = None

waxen ruin
slate swan
#

then u can do
if not str:

quaint epoch
unkempt canyonBOT
#

await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sets the channel specific permission overwrites for a target in the channel.

The `target` parameter should either be a [`Member`](https://docs.disnake.dev/en/latest/api.html#disnake.Member "disnake.Member") or a [`Role`](https://docs.disnake.dev/en/latest/api.html#disnake.Role "disnake.Role") that belongs to guild.

The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://docs.disnake.dev/en/latest/api.html#disnake.PermissionOverwrite "disnake.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions "disnake.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.

If the `overwrite` parameter is `None`, then the permission overwrites are deleted.

You must have [`Permissions.manage_roles`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.manage_roles "disnake.Permissions.manage_roles") permission to do this...
slate swan
#

isn't disnake for pycord?

#

i'm just using regular d.py lol

quaint epoch
junior plinth
waxen ruin
# unkempt canyon

wow this is a perfect example @junior plinth , only the user who ran this command can delete this prompt, not any other user

#

how do i do something like this?

quaint epoch
#

!d discord.TextChannel.set_permissions

unkempt canyonBOT
#

await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Sets the channel specific permission overwrites for a target in the channel.

The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that belongs to guild.

The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.

If the `overwrite` parameter is `None`, then the permission overwrites are deleted.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
junior plinth
#

!d discord.Client.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.10)"). 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.10)") 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.10)") 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**...
slate swan
dusky pine
junior plinth
dusky pine
#

Both are forks of discord.py (which is maintained and probably has more features)

junior plinth
#

see the examples as well for better understanding

waxen ruin
junior plinth
junior plinth
#

claim a help channel if you want

#

then ping me there

quaint epoch
#

for example, ```py

method 1

overwrite = discord.PermissionOverwrite() # create a copy of perms
overwrite.send_messages = False # change wanted perms
overwrite.manage_messages = False
await channel.set_permissions(role_obj, overwrite=overwrite) # use the channel object to set the perms for the role_obj to overwrite

method 2

await channel.set_permissions(role_obj, send_messages=False, manage_messages=False)

same as method 1 but just set the perms to key word values```

slate swan
#

arent overwrites supposed to be dicts?

quaint epoch
stuck lily
#

hello, if the instruction tell us to write 'pip install' something, where do we suppose to type it? i try cmd, not working... p/s the requirement need me to install ping3

slate swan
stuck lily
#

C:\WINDOWS\system32>pip install -r requirement.txt
Fatal error in launcher: Unable to create process using '"C:\Users\AMD\AppData\Local\Programs\Python\Python310\python.exe" "C:\Users\AMD\AppData\Local\Programs\Python\Python310\Scripts\pip.exe" install -r requirement.txt': The system cannot find the file specified.

#

i got this error

quaint epoch
#

in the cwd

slate swan
stuck lily
#

yes... when i install phyton before... i include PATH as well

#

kinda weird, i run pip install on cmd before and its work well... this time it doesn't exist

slate swan
#

it cannot find the requirement.txt

#

cause its requirements.txt :bruh:

tired hinge
#

i added a cog and restarted my bot, the new commands work in a server but not in another? its weird

stuck lily
#

the requirement need me to install ping3 module... any other way for me to do that?

slate swan
tired hinge
slate swan
#

If the user provides any member object by pinging them, is it == to discord.Member?

quaint epoch
#

is this concept good? like a reminder command, you can create a repeater that repeats every time specified, like >repeat 1D, would repeat every 1 day forever, until you cancel it. It's meant to help you run commands at intervals, like if there is a cooldown on a command in dank memer, just set a repeat for every length of the cooldown and you can keep grinding it constantly

tired hinge
slate swan
#

I take an argument member: discord.Member = None.
And if the command user pings the member, will it be equal to discord.Member?

quaint epoch
# slate swan WDYM>
async def mute(ctx, member: discord.Member, reason: str='None'):``` would accept , 879807617260716143, HRLO77#3508, or @quaint epoch as a member
#

the : discord.Member reads that as a member

slate swan
quaint epoch
#

ez

slate swan
#

...

quaint epoch
#

i actually forget how you clean up prefixes

#

lemme read up

slate swan
quaint epoch
slate swan
#

!e

class Someclass:
  ...
a: Someclass = 12
print (a == Someclass)
unkempt canyonBOT
#

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

False
tired hinge
slate swan
#

Oh!

quaint epoch
#

how do you clean up prefixes again?

slate swan
#

That works

quaint epoch
#

!d disnake.Message.clean_content

unkempt canyonBOT
#

A property that returns the content in a β€œcleaned up” manner. This basically means that mentions are transformed into the way the client shows it. e.g. <#id> will transform into #name.

This will also transform @everyone and @here mentions into non-mentions.

Note

This does not affect markdown. If you want to escape or remove markdown then use utils.escape_markdown() or utils.remove_markdown() respectively, along with this function.

quaint epoch
#

yeah, this is it

slate swan
tired hinge
#

ok so like im rly confused rn, some commands are not working in specific servers

stuck lily
#

YEAHHH... finallyy did it... thanks u all for helping me!!! lemon_fingerguns_shades

tired hinge
#

any reasons this could happen?

#

i regenerated my token & restarted, the commands still do not work in one specific server

tired hinge
slate swan
tired hinge
#

server a

#

server b

slate swan
#

an issue with your help command....?

tired hinge
#

the commands don't work either

slate swan
#

smh

#

probably an internal problem

tired hinge
#

oh my gosh

#

oh my gosh i'm so sorry

slate swan
#

....?

tired hinge
#

was an error with help command

slate swan
#

lmao

#

its alright, shit happens

#

dont set the colour easy

#

!e

def a(some: int = 'Hi'):
  print (some == int)
a()
#

or if you mean that extra strip, that remains

#

mhm

unkempt canyonBOT
#

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

False
slate swan
#

What

#

wth was that smh

#

why would anyone do that

#

thanks

#

just set the colour to be the same the embed colour

#

!d discord.Embed

unkempt canyonBOT
#

class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, 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.

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

Changed in version 2.0: `Embed.Empty` has been removed in favour of `None`.
slate swan
#

yeah just set the colour to be jet black or smth

lofty tide
#

Can someone help me to understand how do i develop a discord bot in python?

maiden fable
#

!d discord @lofty tide

unkempt canyonBOT
#

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

Creating a Bot account is a pretty straightforward process.

slate swan
#

l

lofty tide
slate swan
#

google "discord developer site"

#

Now I know how hard it is to make discord bots...

slate swan
#

Just an advanced "warn" command took me around 1 hour.

#

Which handle every exception.

#

And keep track of warns.

slate swan
#

Ah ok

#

What are you tryin' to say? @slate swan

slate swan
#

This happened with jaguar

#

Yeah lol

#

Type quicker

#

Please I beg

#

no

#

I will literally go insane

#

lol

slate swan
slate swan
#

nothing :"

slate swan
slate swan
#

Got it

slate swan
#

yes i am Eito :")

#

Exposed

#

?...?

#

Ay I don’t understand what I’m saying cause I just woke up

#

lmao it's okay

#

Back to discord bots

#

Yes

slate swan
#

+1 ^

#

bruhh?

#

bro

#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

slate swan
#

use this from next time :")

#

ok sorry

#

don't say sorry, it makes me feel guilty lmao

#

lmao

slate swan
slate swan
slate swan
slate swan
paper sluice
#

do u have members intents enabled?

slate swan
#

i forgot to ask that

#

same

#

then he can use fetch_user ig

slate swan
# lofty tide then how do i create a bot account?

TO CREATE A BOT ACCOUNT FOR DISCORD.

  • Visit https://discord.com/developers (alternatively search discord developer portal using a search engine)

  • Login/Sign Up
    -> On the applications page (https://discord.com/developers/applications), Choose CREATE NEW APPLICATION

  • Type in your desired name

  • A new application is now created

  • In the menu of your application, go to the bot tab of your app from the navigation bar on the left

  • Click on CREATE A BOT (or whatever is written there) and CONFIRM it

  • Scroll down, Toggle the required Intents, and set the required Permissions

  • Now select Oauth2 from the navigation bar on the left, Click on general, Set the required Permissions and the method for app authorization (or whatever it is)

  • Now click on URL Generator, select the required permissions, scroll down and copy the url, paste it in your web browser, and authorize it and choose a server to add it to

slate swan
#

do u have members intent?

#

yes or no...?

#

yes

slate swan
slate swan
#

πŸ‘ no cap

paper sluice
lofty tide
slate swan
#

i was saying that to ashley...

slate swan
paper sluice
#

show ur intents @slate swan

slate swan
unkempt canyonBOT
slate swan
#

use this ^

slate swan
#

then DM to yourself.. πŸ’€

lofty tide
slate swan
#

you're good

#

!d discord.AppInfo.owner

unkempt canyonBOT
slate swan
#

πŸ€” woah i didn't know we had this thing.. i ws aware of bot.owner_id only

slate swan
slate swan
slate swan
#

πŸ€” yeah yeah, thanks tho

slate swan
#

ouch

#

with lmao

lofty tide
slate swan
#

so eito is ashuwuley and ashley is eito

#

oo so APP is like the one in developer portal, but not related to bot, right? @slate swan

slate swan
slate swan
cold sonnet
slate swan
#

LOL

slate swan
slate swan
slate swan
lofty tide
#

butttt can u answer my question?

lofty tide
slate swan
#

πŸ˜‚

cold sonnet
slate swan
#

thanks, thats what ill call my bot

#

ooo samee that's what i call most of irl ppl

slate swan
#

my friend -> mf, guys

cold sonnet
#

nah definitely not

slate swan
slate swan
unkempt canyonBOT
keen talon
buoyant zodiac
#
``` what does this mean
lofty tide
slate swan
unkempt canyonBOT
slate swan
#

yes ^

slate swan
#

LMAO that sounds wrong

lofty tide
keen talon
slate swan
buoyant zodiac
#

its mongo but

slate swan
slate swan
buoyant zodiac
#

yes, i didnt know there was channel for such

maiden fable
lofty tide
slate swan
slate swan
#

but try to get the grip tho

scarlet rune
#

!d discord.ext.commands.errors.BadArgument

paper sluice
slate swan
slate swan
#

back

scarlet rune
paper sluice
slate swan
slate swan
#

πŸ˜‚

maiden fable
#

I'mma just go away

lofty tide
maiden fable
lofty tide
paper sluice
slate swan
#

hurt*

slate swan
#

nvm NVM

maiden fable
slate swan
maiden fable
#

Ik (:

paper sluice
#

chat moving kinda wild

slate swan
#

fr

maiden fable
lofty tide
slate swan
slate swan
lofty tide
#

not that good but basic

slate swan
#
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 "main.py", line 193, in foo
    await me.send("``I have been added to:``")
AttributeError: 'NoneType' object has no attribute 'send'
slate swan
maiden fable
slate swan
#

..

slate swan
maiden fable
slate swan
slate swan
slate swan
lofty tide
slate swan
paper sluice
#

client.listen("on_guild_join") u can pass it in like this?

slate swan
#

@client.listen("on_guild_join") ?

maiden fable
slate swan
#

thats how listeners work

maiden fable
#

Yea

maiden fable
#

!resources @lofty tide I would suggest looking into this

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
#

lmao eito nub

slate swan
#

:>

maiden fable
slate swan
#

...

slate swan
#

!intents

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate swan
slate swan
paper sluice
maiden fable
#

!d discord.ext.commands.Bot.listen this prevents the bot from overriding the default listeners

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").

Example...
slate swan
#

like imagine they not having permission to send message in 1st channel of hat guild

maiden fable
slate swan
paper sluice
#

!d discord.Intents @slate swan

unkempt canyonBOT
#

class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").

New in version 1.5...
slate swan
lofty tide
gaunt ice
#

hm

maiden fable
gaunt ice
#

what is up guys

slate swan
#

all bad

slate swan
gaunt ice
maiden fable
keen talon
slate swan
slate swan
maiden fable
gaunt ice
keen talon
slate swan
# lofty tide ofc
import discord #importing the library
from discord.ext import commands # importing the commands framework from that same library

bot = commands.Bot(command_prefix="uwu", intents=discord.Intents.default()) # initiating your bot 

@bot.command() # command decorator to register the below function as a bot command
async def ping(ctx:  commands.Context): # an asynchronous function initiator, this function will be responsible for the behaviour of the command. On a side note, the first argument passed is always required by the commands
     await ctx.send("No pong, an uwu for you instead") #sending the message back when the command was used
     
@bot.listen("on_ready")
async def on_ready_uwu():
       print("online") # this function will print "online" when the bot is ready to use

bot.run("token") #starting your bot, in essence, getting it online and working

NOTE: the above code follows the syntax of discord.py

maiden fable
slate swan
maiden fable
slate swan
stray carbon
#
    async def on_ready(self):
        print(f'Logged in as {self.user} (ID: {self.user.id})')
        print('------')
        while True:
            statusType = random.randint(0, 1)
            if statusType == 0:
                await client.change_presence(status=discord.Status.idle, activity=discord.Activity(type=discord.ActivityType.playing, name=f"with {len(set(self.get_all_members()))} users"))
            else:
                await client.change_presence(status=discord.Status.idle, activity=discord.Activity(type=discord.ActivityType.watching, name=f"{len(set(self.get_all_members()))} users"))
        asyncio.sleep(16)

this aint looping, it remains same always EM_sob

keen talon
slate swan
stray carbon
#

shouldnt it change after every 16s?

maiden fable
unkempt canyonBOT
#

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

why is there 2 ashleys

keen talon
maiden fable
#

Use this (:

slate swan
lofty tide
slate swan
slate swan
lofty tide
stray carbon
slate swan
#

channel go brrrrr

paper sluice
maiden fable
#

?tag bb exists

slate swan
#

?tag bb

novel apexBOT
#

This is not a Modmail thread.

keen talon
slate swan
#

no

slate swan
maiden fable
lofty tide
slate swan
#

πŸ˜‚ lol

maiden fable
lofty tide
keen talon
slate swan
slate swan
#

hi

#

hewoo

#

i said hi and chat ded nice

maiden fable
slate swan
#

at least i replied.. eito nice guy :>

lofty tide
slate swan
#

sand

lofty tide
#

send*

slate swan
#

sed*

lofty tide
#

srry

slate swan
#

πŸ₯ͺ
πŸ”—
πŸ₯ͺ

maiden fable
slate swan
#

LMFAO

slate swan
#

πŸ˜‘πŸ˜­

lofty tide
#

k im going to play minecraft (:

maiden fable
#

What I interpreted:
-> Someone named Eito changed his name to Ashley
-> Someone named Ashley changed his her name to Eito

slate swan
#

!ot i wanted to do it

unkempt canyonBOT
slate swan
#

create_custom_emoji takes a byte-like object

#

!d discord.Guild.create_custom_emoji

unkempt canyonBOT
#

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

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

There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.

You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.
slate swan
#

πŸ’€

#

agreed

feral lichen
#

ong

slate swan
#

..

#

well if you're familiar with python, coro, OOP then it's easy...like OOP is the main part..

#

imo

#

class shit

feral lichen
#

hes not new to coding lol ik him

slate swan
#

oh lol, is he trolling?

feral lichen
#

no

slate swan
#

no

slate swan
slate swan
feral lichen
#

bro i know how to code too and i still can barley read the docs

slate swan
slate swan
slate swan
#

dont we mean class objects when we say classes here?

#

yeah lol

slate swan
#

just pass in a Bytes or a Bytes-like object of the image instead of you know, passing the url

maiden fable
#

classes are..... fun to attend

slate swan
#

lol

maiden fable
#

In short, you need to get the image file

slate swan
#

and convert it to bytes

maiden fable
#

@slate swan idc if u report me (:

#

!d bytes

unkempt canyonBOT
#

class bytes([source[, encoding[, errors]]])```
Firstly, the syntax for bytes literals is largely the same as that for string literals, except that a `b` prefix is added:

β€’ Single quotes: `b'still allows embedded "double" quotes'`

β€’ Double quotes: `b"still allows embedded 'single' quotes"`

β€’ Triple quoted: `b'''3 single quotes'''`, `b"""3 double quotes"""`

Only ASCII characters are permitted in bytes literals (regardless of the declared source code encoding). Any binary values over 127 must be entered into bytes literals using the appropriate escape sequence...
slate swan
lofty tide
slate swan
slate swan
lofty tide
slate swan
#

...

#

okay, i'm a troll now........?

maiden fable
#

@lofty tide I would suggest u go to #python-discussion and ask them on how to get started with Python coding

slate swan
#

^ +1

maiden fable
#

Nvm

slate swan
#

while True:
print("+1")

slate swan
paper sluice
slate swan
maiden fable
slate swan
slate swan
slate swan
#

LMFAOO WTH

paper sluice
slate swan
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 143 (SIGTERM).

001 | +1
002 | +1
003 | +1
004 | +1
005 | +1
006 | +1
007 | +1
008 | +1
009 | +1
010 | +1
011 | +1
... (truncated - too many lines)

Full output: too long to upload

lofty tide
slate swan
maiden fable
slate swan
slate swan
paper sluice
slate swan
#

pls move to ot

#

!ot

unkempt canyonBOT
maiden fable
slate swan
#

imagine asking hunter to move to an ot channel

maiden fable
#

Eh, I'm going out anyways

slate swan
maiden fable
#

Mb

paper sluice
slate swan
maiden fable
#

I wish I could tho. Would be the best thing ever

slate swan
slate swan
#

!ot finally i got a chance to do i t:>

unkempt canyonBOT
#

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

maiden fable
#

Bruh everyone stop using these ot commands now

slate swan
#

and move on?

#

1 miss :<

slate swan
#

......?

#

idk, good night, its already 8 am

#

8 am

#

who sleep at 8 am

paper sluice
#

chat's getting out of hand, imma ask a question related to discord-bots
how do i make my bot bake a cake

slate swan
#

microwave and a cake.....?
how....

#

I mean, ovens exist

#

microwave and ovens are same ig

#

no

#

channel turning from discord bots to recipe

slate swan
#

nice, ima learn something today :")

#

take a knife make a cut put salt in it

#

u will be a angel

#

microwaves are ideal only for heating things up, plus you can set temperatures as desired in an oven and you need a specific temperature for baking a cake

#

nvm

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
# lament depot

i'd love it if hikari made views simpler without miru support

slate swan
slate swan
slate swan
lofty tide
#

@slate swan but, how do i link my bot to the code?

slate swan
slate swan
slate swan
#

hikari is dependent on anime

#

oooo

#

what.....

#

wtf waitt

unkempt canyonBOT
#

src/extensions/fun.py lines 79 to 83

act_row = (
    fun.bot.rest.build_action_row()
    .add_select_menu(str(context.author.id))
    .set_placeholder("Select an animal.")
)```
slate swan
#

Average lame joke

#

^ +1 πŸ’€

#

..

unkempt canyonBOT
slate swan
#

πŸ€” why u chose hikari over discord.py tho? @slate swan

lofty tide
slate swan
#

yes

slate swan
#

doesnt hikari sounds like anime

slate swan
slate swan
#

:>

lofty tide
#

it*

slate swan
slate swan
slate swan
#

you gotta reset it and copy it

lofty tide
maiden fable
slate swan
cold sonnet
slate swan
lofty tide
slate swan
#

literally the best file in the library

maiden fable
#

Agreed

lofty tide
slate swan
little ivy
little ivy
#

Why wont this work?

slate swan
#

suppose you want to send a message to channel with id 123 you can simply py await bot.http.send_message(123, content="....") instead of manually get_x'ing the stuff

slate swan
slate swan
#

literaly

maiden fable
slate swan
slate swan
#

for hikari is bot.rest.create_message

maiden fable
slate swan
#

..

slate swan
slate swan
#

LMAO

little ivy
maiden fable
# maiden fable Ik

I meant hikari allows using the underlying http methods directly which is good

slate swan
#

yeaah