#discord-bots

1 messages · Page 26 of 1

lone lichen
#

I’ m pretty sure It’ s has_role not has_any_role

slate swan
#

Anyone has the mee6 bot comands

coarse raptor
#

hi, wierder question but would anyone know how i would take this site URL https://avatars2.githubusercontent.com/u/{num}?s=360 that returns images to be convertable and accepted into bot.user.edit(avatar=...)?

#

The doc states that it needs a bytes-like object and when i try to pass it in it says invalid or sum along those lines

sick birch
brazen raft
sick birch
#

And you might also need PIL

sick birch
slate swan
#

So python has its own docs for like how everything works and which commands to use for a certain thing (I think so at least). Does Discord have one of those for python? I know it has one for java.

fading marlin
#

!d discord this?

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.

fading marlin
#

or are you looking for the discord API docs?

slate swan
fading marlin
#

are you looking for a manual on how to use discord and its features?

lone lichen
#

My guess

fading marlin
slate swan
#

no. ive never coded a discord bot before and there is always an error with tutorials and such so i am looking for the command on how to create a discord command or something. the wrapper link is what im looking for (i think at least)

lone lichen
#

It’ s probably the best source, yt tutorials are not particularly good for this topic

slate swan
#

thank you for the help. docs always remind me i need to learn more about python so ill go to that and come back to these links

#

How do I add a color to the embed?

upbeat gust
slate swan
upbeat gust
#

it takes an int (0xFF0000) or instance of discord.Color, like discord.Color.red()

slate swan
#

I forgor to ask but how do u install the latest version of discord PY? (it's been a while and I dont rember)

brazen raft
#

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

slate swan
#

How do I make mention command?

sick birch
sick birch
unkempt canyonBOT
slate swan
sick birch
slate swan
compact urchin
#

Whats wrong guys pls

sick birch
# compact urchin

Wrong channel, but since your issue is small I'll answer it anyway. Functions can have only one output (return statement). Anything after the first return won't run

sick birch
#

What version are you on?

sick birch
# compact urchin Okay, thanks a lot

That message was intended for @slate swan, sorry. The one above the message you replied to was meant for you. If that was a wrong reply, just ignore that lol

compact urchin
#

Oh okay 😅

slate swan
#

How can I make the bot put the avatar of the person who used the command in the thumbnail?

sick birch
#

I'm a bit out of it sorry, what was the original issue?

slate swan
sick birch
#

Could you print(getpuuid), and let me see the output?

#

Also as an unrelated word of advice, use aiohttp over requests

#

!paste Could you paste all thousands of lines in here?

unkempt canyonBOT
#

Pasting large amounts of code

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

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

slate swan
#
@bot.command()
async def work(ctx):
	coin = os.getenv('coin')+100
	await ctx.send(coin)

What's wrong?

upbeat gust
sick birch
#

My dms are closed, sorry. If it's that long, could you first find the data sub-dict inside of it, and just send that?

sick birch
unkempt canyonBOT
#

@sick birch :white_check_mark: Your 3.11 eval job has completed with return code 0.

<class 'int'>
sick birch
#

Nevermind lol, thought it was

upbeat gust
#

yeah

sick birch
#

Due to the special syntax and the hex() and whatnot

upbeat gust
#

ah fair

slate swan
upbeat gust
#

read it-

#

it tells you exactly whats wrong

#

and if you cant solve that yourself, you shouldnt be using dpy

slate swan
#

:/

sick birch
unkempt canyonBOT
#

@sick birch :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | TypeError: can only concatenate str (not "int") to str
upbeat gust
sick birch
#

Look familiar?

slate swan
#

by the way, thanks for the help

upbeat gust
upbeat gust
#

you cant add these together

sick birch
#

Great, can you find the metadata subdict inside of the data dict?

mossy jacinth
#

Well hello guys! My python is a little bit rusty but why does my bot just ignore this?

sick birch
#

So in reality, your error is a context object, and your ctx is an error object. So a context object will never be of instance MissingPermissions

mossy jacinth
#

Thanks!

sick birch
#

Therefore, if there's an error, you'll never know it. Also, you should probably find a way to print out the traceback, instead of just sending a generic one on Discord. raise error is a quick and easy way to do this, but it acts sort of as a return statement, so nothing after it is run. You can also use the traceback library

#

Then that's probably where the error is

#

what's the datatype of the data subdict? A list, or another dict?

#

E.g does it look like this:

"data": {
  ...
}

or

"data": [
  ...
]

?

#

Ah found it then

#

When it's a [], it's a list so you have to index it by a number. E.g data[0] to get the first item inside, data[1] to get the 2nd item, etc

sick birch
#

Is that.. meant to be sarcastic? I feel like I definitely did not explain that well 😅

slate swan
#

no literal

#

See!

sick birch
#

😊 thank you, that made me feel better

#

You said there was no metadata subdict, so it should've errored on that line, no?

slate swan
#

What's your api response

sick birch
#

It was too long even for pastebin

slate swan
#

then the link

sick birch
#

Okay yeah data is 100% a list

#

each of those has the metadata inside it

#

so getpuuid["data"][0]["metadata"]["map"] would print out "Icebox"

#

getpuuid["data"][1]["metadata"]["map"] prints out Pearl
getpuuid["data"][2]["metadata"]["map"] prints out Haven
getpuuid["data"][3]["metadata"]["map"] prints out Haven
getpuuid["data"][4]["metadata"]["map"] prints out Breeze

#

is that what you're looking for?

slate swan
#

Robin too fast

slate swan
sick birch
#

Having a nice way to view the response really helps, e.g Firefox

#

Firefox is an excellent developer tool in many regards

slender hamlet
#

I had the right thing the whole time, just the wrongly placed [0]...

#

Thanks for taking your time to help me, I really appreciate it! @sick birch

worthy lintel
#

Hello?

#

Can someone take a look at the avocado help channel?

slate swan
#

!e

unkempt canyonBOT
#
Missing required argument

code

slate swan
#

evaluate command.

#

!slashcommands

#

where can i fix this

#

huh nice u use VSCode too :D

slate swan
silk fulcrum
unkempt canyonBOT
#

class discord.app_commands.AppCommand```
Represents a application command.

In common parlance this is referred to as a “Slash Command” or a “Context Menu Command”.

New in version 2.0...
silk fulcrum
#

if u use dpy

slate swan
#

where can i fix this i need help

slate swan
#

does anybody know what this means?

silk fulcrum
# slate swan

Your token is of some weird type, not str, you can assume that it is str putting bot.run(str(os.environ.get("DISCORD_BOT_SECRET")))

#

patience....

#

you will be answered at some point, no need to spam

slate swan
#

nah people wont respond to messages higher up its rare if someone does that

mossy jacinth
#

Uhh i dont know how to describe this but this shouldnt happen 💀 any ideas how to fix it? Happens with ban too

silk fulcrum
#

well if you resend your problem only 1 time rn, then I'd understand, but you were like resending it every 30 secs

slate swan
silk fulcrum
slate swan
#

i put that in and it gave me some runtime error

silk fulcrum
silk fulcrum
slate swan
#

@silk fulcrum

silk fulcrum
#

you changed nothing...

slate swan
#

I did but after that it gave me a runtime error so i changed it back

#

but ill put it back and show you the error

silk fulcrum
#

ok

#

also make sure to save file

#

cus as I see right now it's not saved

slate swan
slate swan
#

the str error dosent pop up just this now vote_up

silk fulcrum
#

Your token, that you passed in .env file is invalid

slate swan
silk fulcrum
#

yes

slate swan
#

thats also the error i get when i run it from a host

#

@silk fulcrum

silk fulcrum
#

Make sure you:

  • put your token in quotes "TOKEN"
  • you saved your .env file
silk fulcrum
# slate swan

that's a error with JSON, not related to the token

slate swan
#

@silk fulcrum you able to call and help me at all for just a minute please

silk fulcrum
#

hm... wait a sec I'll tell you if I can

slate swan
silk fulcrum
slate swan
slate swan
#

yo can someone help me

mossy jacinth
#

Can someone tell me how to make the time it got created simpler?

silk fulcrum
#

!d datetime.datetime.strftime

unkempt canyonBOT
#

datetime.strftime(format)```
Return a string representing the date and time, controlled by an explicit format string. For a complete list of formatting directives, see [strftime() and strptime() Behavior](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior).
silk fulcrum
cold tide
#
premium.set_footer(text="Please use !buy in [#998759012889809046](/guild/267624335836053506/channel/998759012889809046/)")
#

The channel isnt showing just the id idk why.

slate swan
#

cannot import "app_commands"

#

[windows username censored due to privacy]

cold tide
slate swan
#

Oh I know why

cold tide
#

Why?

slate swan
#

It doesnt work in footers

cold tide
#

Awh damn

#

They should add that feature

slate swan
#

Just like emojis and stuffs can't work in the title

shrewd apex
#

it dosent work in author and footer

vast gale
#

pog

#

I added typings to Permissions()

#

and everything that takes raw permission flags

slate swan
# vast gale

Mhm quite nice, but why exactly? better parsing?

vast gale
#

better typing

#

helps with detecting incorrect permissions names in advance

silk fulcrum
#

hi okimii!! 👋

slate swan
#

wait nvm on that question, you said typings and not a creation of a new obj, thats my fault, arl sorry for the ghost ping!

mossy jacinth
#

How can i make something like this?

silk fulcrum
#

Just type that

mossy jacinth
#

I mean like, if the User has lets say Admin role, it shows what he can do like Kick members, ban members but if u dont have any roles it just shows nothing its hard to describe

torn sail
unkempt canyonBOT
#

property guild_permissions```
Returns the member’s guild permissions.

This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").

This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.

Changed in version 2.0: Member timeouts are taken into consideration.
torn sail
#

Iterate over this

mossy jacinth
slate swan
#

!e

a = ["lol", "ok"]
print(", ".join(a))
unkempt canyonBOT
#

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

lol, ok
silk fulcrum
#

!e py perms = ['create_instant_invite', 'kick_members', 'administrator'] print(", ".join([perm.replace("_", " ").title() for perm in perms]))

unkempt canyonBOT
#

@silk fulcrum :white_check_mark: Your 3.11 eval job has completed with return code 0.

Create Instant Invite, Kick Members, Administrator
silk fulcrum
#

👁️

slate swan
#

epic

left idol
#

in pycord how can i pass context into my button class

#

idk if its bad practice or not but rn i just have my class inside of my command function

slate swan
slate swan
#

or you can just ```py
button = Button()
button.ctx = ctx

silk fulcrum
shrewd apex
#

!d discord.ui.Button.view

unkempt canyonBOT
shrewd apex
paper sluice
silk fulcrum
#

bruhp(

shrewd apex
keen oak
#

!discord.ui.button.view

#

!d discord.ui.Button.view

shrewd apex
#

lmfao

robust fulcrum
#

Guys how can I change all button colours on button click?

paper sluice
robust fulcrum
paper sluice
#

you can get all the components of the view using view.children, then you can loop over it and change the style

robust fulcrum
paper sluice
#

yea

inner perch
#

Am getting tis error after updating python

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    bot = commands.Bot(command_prefix="-")
TypeError: __init__() missing 1 required keyword-only argument: 'intents'
left idol
#

im in pycord and i can't seem to have my OptionChoice show up at all. im trying a test command but it still isn't showing up,

classes_list = [
    OptionChoice(name = 'Tank', Value = 'Tank'),
    OptionChoice(name = 'Assassin', Value = 'Assassin'),
    OptionChoice(name = 'Fighter', Value = 'Fighter')
]
#
async def poopingtest(ctx, classes: Option(str, 'Class choice', choices = classes_list)):```
paper sluice
inner perch
#

its not verified

#

so what would i do

robust fulcrum
slate swan
#

you dont need to get verified to get intents, it's more of a vice versa

slate swan
robust fulcrum
slate swan
#

a view has children (dont know how)

#

not Button

robust fulcrum
slate swan
#

Can you put inside a command a def?

silk fulcrum
slate swan
#

Like
async def cmd():
def

#

Can you do that?

#

Master @silk fulcrum

silk fulcrum
#

if you mean py async def cmd(): def another_func(): ... ... then yes

slate swan
#

Ok thanks master @silk fulcrum

#

@Master32#2476

#

@silk fulcrum

inner perch
#

I have this button and its working fine but why is it saying that the interaction failed when its working fine? I have no errors in the console but this is the button part of my script.

class Buttons(discord.ui.View):
    def __init__(self, *, timeout=180):
        super().__init__(timeout=timeout)
    @discord.ui.button(label="Button",style=discord.ButtonStyle.gray)
    async def Button(self,button:discord.ui.Button,interaction:discord.Interaction):
      print("Clicked")
      Log = bot.get_channel(1001412638368075828)
      await Log.send("I got clicked!")
torn sail
#

!d discord.Interaction.response

unkempt canyonBOT
#

Returns an object responsible for handling responding to the interaction.

A response can only be done once. If secondary messages need to be sent, consider using followup instead.

torn sail
#

!d discord.InteractionResponse.send_message

unkempt canyonBOT
#

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

Responds to this interaction by sending a message.
torn sail
#

!d discord.InteractionResponse.defer

unkempt canyonBOT
#

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

Defers the interaction response.

This is typically used when the interaction is acknowledged and a secondary action will be done later.

This is only supported with the following interaction types...
slate swan
short relic
#

how can i make it so that each role has a specific cooldown for a command?

limber bison
#
class Setup_1(commands.Bot):
    async def load(self , extension):
        await self.load_extension("extension")
    
    async def unload(self , extension):
        await self.unload_extension("extension")

    async def reload(self , extension):
        await self.reload_extension("extension")   

for filename in os.listdir('./commands'):
    if filename.endswith('.py'):
        Extension.load(f'commands.{filename[:-3]}')
    elif not filename.endswith('.py'):
        filenametemp =  filename
        for filename in os.listdir(f'./commands/{filenametemp}'):
            if filename.endswith('.py'):
                 Extension.load(f'commands.{filenametemp}.{filename[:-3]}')```

whats wrong ?
silk fulcrum
paper sluice
#
    async def load(self , extension):
        await self.load_extension("extension")

pithink

limber bison
paper sluice
#

extension is in a str

silk fulcrum
#

also then it'd be logical to have a name attr

#

and like.. dir attr

#

and bot attr

#

and do self.bot.load_extension(self.dir + "." + self.name)

#

idk

short relic
#

can i do something like

@bot.command()
async def ping(ctx):
    if <id> not in ctx.author.roles:
        @commands.cooldown(1, 300, commands.BucketType.user)
silk fulcrum
#

nope

short relic
silk fulcrum
#

there is custom cooldown

limber bison
#
class setup_1(commands.Bot):
    async def load(self , extension):
        await self.load_extension("extension")
    
    async def unload(self , extension):
        await self.unload_extension("extension")

    async def reload(self , extension):
        await self.reload_extension("extension")   

for filename in os.listdir('./commands'):
    if filename.endswith('.py'):
        setup_1.load(f'commands.{filename[:-3]}')
    elif not filename.endswith('.py'):
        filenametemp =  filename
        for filename in os.listdir(f'./commands/{filenametemp}'):
            if filename.endswith('.py'):
                 setup_1.load(f'commands.{filenametemp}.{filename[:-3]}')```

now ?
silk fulcrum
#

i dont remember, is it CooldownMapping or smth else

short relic
silk fulcrum
torn sail
silk fulcrum
#

you cannot just go and try, there must be a predicate

#

dynamic...

short relic
torn sail
#

And modify it

torn sail
short relic
torn sail
#

Yeah

#

You can return whatever cooldown u want or even None

silk fulcrum
short relic
silk fulcrum
limber bison
#
class setup_1(commands.Bot):
    async def load(self , extension):
        await self.load_extension(extension)
    
    async def unload(self , extension):
        await self.unload_extension(extension)

    async def reload(self , extension):
        await self.reload_extension(extension)   

for filename in os.listdir('./commands'):
    if filename.endswith('.py'):
        setup_1.load(f'commands.{filename[:-3]}')
    elif not filename.endswith('.py'):
        filenametemp =  filename
        for filename in os.listdir(f'./commands/{filenametemp}'):
            if filename.endswith('.py'):
                 setup_1.load(f'commands.{filenametemp}.{filename[:-3]}')```

now ?
silk fulcrum
#

oh

#

well you cannot use it like that

limber bison
silk fulcrum
#

load is not a classmethod

limber bison
#

plssssssss

#

1 line

silk fulcrum
#

not spoonfeeding

limber bison
#

not spoonfeeding i an not getting it '

#

thats why i ask

silk fulcrum
#

you either make load a classmethod or create an instance of setup_1, like setpup = setup1() and then do setpup.load(...)

silk fulcrum
#

!classmethod

unkempt canyonBOT
#

Although most methods are tied to an object instance, it can sometimes be useful to create a method that does something with the class itself. To achieve this in Python, you can use the @classmethod decorator. This is often used to provide alternative constructors for a class.

For example, you may be writing a class that takes some magic token (like an API key) as a constructor argument, but you sometimes read this token from a configuration file. You could make use of a @classmethod to create an alternate constructor for when you want to read from the configuration file.

class Bot:
    def __init__(self, token: str):
        self._token = token  

    @classmethod
    def from_config(cls, config: dict) -> Bot:
        token = config['token']
        return cls(token)

# now we can create the bot instance like this
alternative_bot = Bot.from_config(default_config)

# but this still works, too
regular_bot = Bot("tokenstring")

This is just one of the many use cases of @classmethod. A more in-depth explanation can be found here.

limber bison
#

at start !

#

???????????????????????????????????????????????????????????????????????

silk fulcrum
# limber bison any other method to load cog ?

idk and idc, I have this py for extension in initial_extensions: try: await self.load_extension(extension) except Exception as e: print(f'Failed to load extension {extension}.', file=sys.stderr) traceback.print_exc() in setup_hook method in my Bot subclass and i have initial_extensions variable, which contains ('cogs.mod', 'cogs.meta', 'cogs.owner')

limber bison
#
 async def load1():

    for filename in os.listdir('./commands'):
        if filename.endswith('.py'):
            await client.load_extension( f'commands.{filename[:-3]}')
        elif not filename.endswith('.py'):
            filenametemp =  filename
            for filename in os.listdir(f'./commands/{filenametemp}'):
                if filename.endswith('.py'):
                    await client.load_extension(f'commands.{filenametemp}.{filename[:-3]}')    ```
what about this
silk fulcrum
#

looks bad

limber bison
#

lul

#

why

#

🥲

silk fulcrum
#

because as I see you already have a Bot instance (client), so why would you need this class at ll

limber bison
#
 async def load1():

    for filename in os.listdir('./commands'):
        if filename.endswith('.py'):
            await client.load_extension( f'commands.{filename[:-3]}')
        elif not filename.endswith('.py'):
            filenametemp =  filename
            for filename in os.listdir(f'./commands/{filenametemp}'):
                if filename.endswith('.py'):
                    await client.load_extension(f'commands.{filenametemp}.{filename[:-3]}')

setup = load1()

    ```
#

this ?

silk fulcrum
#

load1() must be awaited

limber bison
#

got it

silk fulcrum
#

and why would you need to put it in a variable

#

it doesn't return anything

limber bison
#

dont understand

silk fulcrum
#

your load1 function is async, that means that to run you need to do await load1()

#

or asyncio.run(load1)

limber bison
#

this will not work

silk fulcrum
#

yes

#

but asyncio.run(load1)

robust fulcrum
silk fulcrum
#

will

limber bison
silk fulcrum
unkempt canyonBOT
#

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

A shorthand coroutine for [`login()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.login "discord.ext.commands.Bot.login") + [`connect()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.connect "discord.ext.commands.Bot.connect").
silk fulcrum
#

@limber bison what's your code, cus this indent looks sus

limber bison
#

client = commands.Bot(command_prefix=commands.when_mentioned_or(config["prefix"]) , intents=intents )

#

this is clent

#

client

slate swan
#
@commands.command()
    async def wanted(self,ctx, member: discord.Member = None):
        if member == None:
            member = ctx.author

        wanted = Image.open("wanted.png")

        asset = ctx.author.avatar.url_as(size=128)

        data = BytesIO(await asset.read())
        pfp = Image.open(data)

        pfp = pfp.resize((177,177))

        wanted.paste(pfp, (120,212))

        wanted.save("profile.jpg")

        await ctx.send(file = discord.File("profile.jpg"))
``` no command response
silk fulcrum
slate swan
#

Nope

silk fulcrum
#

also this py if member == None: member = ctx.author can be replaced with this py member = member or ctx.author

limber bison
#

() = corutine

slate swan
#

Wb the command response?*

silk fulcrum
#

() = run the function

limber bison
#

async def func(): ...

func # coroutine function
func() # coroutine

#

🤔

silk fulcrum
slate swan
silk fulcrum
#

I don't know this method

#

Python neither

limber bison
#

🥲

quaint epoch
#

you need to use the current event loop

#

!d asyncio.get_event_loop

#

!d asyncio.get_running_loop

unkempt canyonBOT
#

asyncio.get_running_loop()```
Return the running event loop in the current OS thread.

If there is no running event loop a [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError "RuntimeError") is raised. This function can only be called from a coroutine or a callback.

New in version 3.7.
slate swan
limber bison
slate swan
#

and you need to call the function not just specify the name

slate swan
#

I don’t have a on_message event

zealous jay
#

oh

slate swan
#

How can the bot get this badge?

cold tide
#
@bot.command()
async def bal(ctx):
    with open("data.txt") as json_file:
        points = json.load(json_file)
        for user in points["points"]:
            if user["id"] == ctx.author.id:
                point_num = user["points"]
                await ctx.send(f"You have {point_num} points")
                with open("data.txt", "w") as outfile:
                    json.dump(points, outfile)

Im very very new to json can someone help?

paper sluice
slate swan
#

I added slash command to my bot and i had await bot.tree.sync(guild=...) and i removed the guild and i got the badge but i have the same slash command two times

tame raft
#

anyone make bots?

slate swan
#
from discord.ext import commands

RoleChecker = commands.Bot(command_prefix="+")

@RoleChecker.event
async def on_ready ():
  print ("Reaaaady")

@RoleChecker.command()
async def mbr(ctx ,role : discord.Role):
  TheRole = ctx.guild.get_role (role.id)
  await ctx.send ("**Members list for role : "+role.mention+"**")
  for member in ctx.guild.members :
    if TheRole in member.roles :
      await ctx.send (member.name)

RoleChecker.run ("token")```
#

is there an error?

#

just try it

silk fulcrum
tame raft
slate swan
silk fulcrum
#

oh you mean make bot for you?

slate swan
silk fulcrum
slate swan
tame raft
slate swan
silk fulcrum
unkempt canyonBOT
#

Hey @pearl shoal! I noticed you posted a seemingly valid Discord API token in your message and have removed your message. This means that your token has been compromised. Please change your token immediately at: https://discordapp.com/developers/applications/me

Feel free to re-post it with the token removed. If you believe this was a mistake, please let us know!

silk fulcrum
pearl shoal
#
from discord.ext import commands

TOKEN = 'lolNSG8CFZT0z1Oq1vpf9T1S2A'
client = commands.Bot(command_prefix='@')

@client.event
async def on_ready():
    print('{client.user} is on')


    
@commands.has_permissions(kick_members=True)
@client.command()

async def kick(ctx, member: discord.Member, *, reason=None):
    if reason==None:
      reason="no reason provided"
    await member.kick()
    kick_messages = [f"Pichu used charm to kick ", "Pikachu used thunder shock to kick ", "Raichu used walt switch to kick ", "Squirtle used water gun to kick ", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}", 
"Venusaur used solar beam to kick ", "Charmander used Flame thrower to kick ", "Charmeleon used metal claw to kick ", "Charizard used inferno to kick "]
    await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')

@client.command(aliases= ['user', 'info']) 
@commands.has_permissions(kick_members=True)
async def whois(ctx, member : discord.Member):
    embed = discord.Embed(title = member.name , description = member.mention , color = discord.Color.green())
    embed.add_field(name = "ID", value = str(member.id) , inline = True)
    embed.set_thumbnail(url = member.avatar_url)
    embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by{ctx.author.name}")
    
    await ctx.send(embed=embed)
    
@client.command(aliases= ['user', 'info'])
@commands.has_permissions(kick_members=True)
async def help(ctx, member : discord.Member):
    embed = discord.Embed(title = "Commands for Pokebot", description = "There are a lot of  commands in PokeMod like @kick, @ban, @whois and some secret chatbot commands that you need to find out for yourself", color = discord.Color.blue)
client.run(TOKEN)
#

error - Traceback (most recent call last):
File "c:\Users\Dell\Desktop\LEARN BO\afasasa.py", line 37, in <module>
async def help(ctx, member : discord.Member):
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 1263, in decorator
self.add_command(result)
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 1149, in add_command
raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

silk fulcrum
slate swan
#

but the list has no members

shrewd apex
#
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="+")

@bot.event
async def on_ready():
  print ("Reaaaady")

@bot.command()
async def mbr(ctx: commands.Context ,role: discord.Role) -> None:
  members = [i.name for i in ctx.guild.members if role in i.roles]
  await ctx.send(f"**Members list for role : {role.mention}\n{', '.join(members)}**")

bot.run("token")
pearl shoal
#

thanks

silk fulcrum
shrewd apex
#

what are u going to try thats the same code

silk fulcrum
shrewd apex
#

yes

#

fixing it up

slate swan
slate swan
silk fulcrum
#

!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 Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, 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.

silk fulcrum
#

Hey @slate swan! You want free nitro?

slate swan
silk fulcrum
silk fulcrum
#

you are my fren 🫂

pearl shoal
#
import random
from discord.ext import commands

TOKEN = 'owo'
client = commands.Bot(command_prefix='@', help_command=None)

@client.event
async def on_ready():
    print('{client.user} is on')


    
@commands.has_permissions(kick_members=True)
@client.command()

async def kick(ctx, member: discord.Member, *, reason=None):
    if reason==None:
      reason="no reason provided"
    await member.kick()
    kick_messages = [f"Pichu used charm to kick ", "Pikachu used thunder shock to kick ", "Raichu used walt switch to kick ", "Squirtle used water gun to kick ", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}", 
"Venusaur used solar beam to kick ", "Charmander used Flame thrower to kick ", "Charmeleon used metal claw to kick ", "Charizard used inferno to kick "]
    await ctx.send(f'{random.choice(kick_messages) + " " + (member.mention)}')

@client.command(aliases= ['user', 'info']) 
@commands.has_permissions(kick_members=True)
async def whois(ctx, member : discord.Member):
    embed = discord.Embed(title = member.name , description = member.mention , color = discord.Color.green())
    embed.add_field(name = "ID", value = str(member.id) , inline = True)
    embed.set_thumbnail(url = member.avatar_url)
    embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by{ctx.author.name}")
    
    await ctx.send(embed=embed)
    
@client.command(aliases= ['user', 'info'])
@commands.has_permissions(kick_members=True)
async def help(ctx, member : discord.Member):
    embed = discord.Embed(title = "Commands for Pokebot", description = "There are a lot of  commands in PokeMod like @kick, @ban, @whois and some secret chatbot commands that you need to find out for yourself", color = discord.Color.blue)

    await ctx.send(embed=embed)
client.run(TOKEN)
slate swan
#

anyone, i dont really need it lol, just dont paste it in servers, self bots would get it lol

slate swan
#

[<Member id=1006192867225645096 name='Roles Checker' discriminator='0940' bot=True nick=None guild=<Guild id=997474724911259718 name='Summer Scripts </>' shard_id=None chunked=False member_count=16>>]

pearl shoal
#

CV

slate swan
#

oh and morning my utc -4 beanspithink

pearl shoal
#

error - Traceback (most recent call last):
File "c:\Users\Dell\Desktop\LEARN BO\afasasa.py", line 37, in <module>
async def help(ctx, member : discord.Member):
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 1263, in decorator
self.add_command(result)
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 1149, in add_command
raise CommandRegistrationError(command.name)
discord.ext.commands.errors.CommandRegistrationError: The command help is already an existing command or alias.

silk fulcrum
slate swan
shrewd apex
#

same thing

slate swan
shrewd apex
#

so early 🗿

slate swan
silk fulcrum
shrewd apex
swift pumice
slate swan
pearl shoal
#

lol 7:35pm for me sed

silk fulcrum
shrewd apex
silk fulcrum
#

okimii is my fren and you not

swift pumice
unkempt canyonBOT
swift pumice
silk fulcrum
#

activly believes

slate swan
#

This intent will not be enforced until after August 31, 2022.

shrewd apex
slate swan
#

i must wait to try the code ?

pearl shoal
#

p!shhh

silk fulcrum
slate swan
silk fulcrum
#

ignore it

shrewd apex
swift pumice
silk fulcrum
shrewd apex
swift pumice
pearl shoal
#

hm

shrewd apex
slate swan
#

why is everyone assuming they cant code something when an exception is raised😭

pearl shoal
#

i alr did tht but didnt work

silk fulcrum
swift pumice
#

bot.remove_command('help')

shrewd apex
swift pumice
pearl shoal
#

can we do ```client.remove_command("help")

#

oh ok

slate swan
#

its too early for this, im going to maky myself some waffles yert

shrewd apex
#

if u wanna make ur own "help" command then do as Elias said

pearl shoal
#

thanks Elias'

swift pumice
#

np 🐝

silk fulcrum
shrewd apex
#

oof

#

rip

pearl shoal
#

whats invoke_without_command?

slate swan
#

Thanks!pithink

silk fulcrum
#

but he rejected

swift pumice
slate swan
#

any idea how to do rpc with discord guys i wanna integrate it to my app

silk fulcrum
#

@slate swan arent you he?

slate swan
#

idk

#

call me whatever i dont mind

#

call me a banana i wouldnt mind

slate swan
#

how

silk fulcrum
#

Woo, friend request from Asher, progress

slate swan
#

i beg theres too many channels, some one help me

shrewd apex
#

lmfao 💀

slate swan
slate swan
#

i was too lazy to learn the help commands args, its a pain either way soooo....

silk fulcrum
#

own API wrapper lmoa?

shrewd apex
#

lmoa💀

slate swan
#

i have made one for discords api lmao

swift pumice
slate swan
#

you sound like a minion now, you fell for the trap

silk fulcrum
swift pumice
silk fulcrum
slate swan
#

🍞

swift pumice
shrewd apex
silk fulcrum
#

wait I sound like maniac, did I fall for the trap?

#

or do I?

#

im stupid i dont what did i sound like

shrewd apex
#

idk if i am not drunk enough but i am not getting oki and 32's jokes

swift pumice
silk fulcrum
slate swan
#

you guys want some wafflesyert

shrewd apex
swift pumice
slate swan
shrewd apex
#

eh I'll pass

silk fulcrum
#

I have ice cream in my fridge, but I dont have waffles, that's just what I need

shrewd apex
#

atleast get some honey or maple syrup 🗿

slate swan
#

im quite skilled at making waffles

silk fulcrum
slate swan
#

i grab them from the refrigerator and yeet them in the microwavepithink

shrewd apex
#

Frozen waffles ?💀

slate swan
swift pumice
silk fulcrum
slate swan
swift pumice
#

😔

silk fulcrum
shrewd apex
swift pumice
slate swan
#

this is ot3yert

shrewd apex
shrewd apex
slate swan
swift pumice
shrewd apex
slate swan
#

jk i just have a skill issue in cooking

#

only if i could understand cookings syntax

slate swan
#

😔

shrewd apex
slate swan
#

make me some dinner qt, what are you waiting for?

shrewd apex
#

come over then 👀

slate swan
#

😉

slate swan
#

im pretty good playing it, but i have no money to buy it😔

#

anyways lets change topics i hate talking about how broke i am

#

.topic

lament depotBOT
#
**What commands/features are you proud of making?**

Suggest more topics here!

shrewd apex
#

i don't even get pocket money🗿

slate swan
#

i only got 6 dollars in my wallet, take it or leave it

silk fulcrum
#

what happened here? I just helped my friend to install WSL... I have no idea why he wanted it

swift pumice
slate swan
silk fulcrum
#

me on linux: sad nogame noises

slate swan
#

which distro

#

👀

silk fulcrum
#

what is distro

slate swan
#

linux distribution

swift pumice
silk fulcrum
#

i guess this is correct answer

slate swan
silk fulcrum
slate swan
#

yup

silk fulcrum
slate swan
#

my dad barely knows how to use his phone😭

slate swan
#

💀

swift pumice
slate swan
#

you have a whole db of memes 😭

swift pumice
slate swan
#

ok thats just shit posting at this point

swift pumice
slate swan
#

!ot

unkempt canyonBOT
swift pumice
#

ok sry

slate swan
#
async def balance(ctx,user = None):
  if user == None :
    await ctx.send (ctx.author.name+" has...")
  elif user == discord.Member : 
    await ctx.send (user.name+" has...")```
#

any help

#

What is the error / what are you trying to do

slate swan
#

an instance isnt the same as a class object you would need to use isinstance

slate swan
#

!d isinstance

unkempt canyonBOT
#

isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.

Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
slate swan
slate swan
#

Oh btw is there any extension for pretty text colours in vsc ?

slate swan
slate swan
#

Yes

slate swan
slate swan
slate swan
slate swan
slate swan
#

its the one i use which was recommended by @slate swan

#

Slide a screenshot

slate swan
#

Imagine if vsc had light theme

#

it does lol

#

Wonder who uses it pithink

#

Any pinkish theme?

slate swan
slate swan
slate swan
#

probably search for pink themes in the ext search in vsc

cold tide
#

Im very very new to json how would i start?

slate swan
# slate swan but i didn't understand 🙂

isinstance takes 2 arguments, the first one is the type you want to check, the second one is the type you want it to match with, it would return boolean value of the condition if its True or not

slate swan
#

looks soo good

#

nice

cold tide
#

I need to learn for a currency system

slate swan
cold tide
#

idk how to start

slate swan
#

just learn to use a database and know how to use python

#

ash can see the future😳

cold tide
slate swan
#

oh and you should take her advice, ashs has experience in js herself so i wouldnt argue with her she scares me

#

this is better

cold tide
#

I was asking my dad since hes helping code a website for those who are withdrawing from drug addictions.

slate swan
#

mhm nice, well it depends what you would do with json, really

slate swan
#

ash is pretty cool, shes insulted many times but i wouldve done the same

#

😭

shrewd apex
#

no the scares me part 👀

cold tide
#

How would i show bots latency?

cold tide
#

:

slate swan
shrewd apex
unkempt canyonBOT
#

property latency```
Measures latency between a HEARTBEAT and a HEARTBEAT\_ACK in seconds.

This could be referred to as the Discord WebSocket protocol latency.
cold tide
#

Like showing the bots response time

slate swan
#

it still depends which latency youre searching for lol

shrewd apex
cold tide
#
ms = round(bot.latency * 1000)```
#

Like that?

slate swan
#

10 to go

slate swan
shrewd apex
#

oki likes making op running around in circles

slate swan
cold tide
#

Alr

cold tide
slate swan
#

anyway can we stop spamming nsfw emojis?

cold tide
#

Yeah mb

shrewd apex
slate swan
silk fulcrum
slate swan
shrewd apex
slate swan
slate swan
# cold tide Whats the code??
async def balance(ctx,user = None):
  if user == None :
    await ctx.send (ctx.author.name+" has...")
  elif user == discord.Member : 
    await ctx.send (user.name+" has...")```
#

why is everyone making me look bad, im a great child

slate swan
slate swan
slate swan
#

i love pitbulls

slate swan
#

And a black van?

slate swan
#

Or car maybe

slate swan
cold tide
#

Ah okay

#

Whats the command meant to do??

cold tide
slate swan
#

my problem isn't here

cold tide
#
with open("data.txt") as json_file:
    points = json.load(json_file)

points["points"].append({
    "id": member.id,
    "points": 0,
})

with open("data.txt", "w") as outfile:
    json.dump(points, outfile)

Make a file called data.txt and add this points: []}

cold tide
slate swan
#

no i don't need this, my problem is when i type -balance

cold tide
#

Yes...

slate swan
#

i want it to use ctx.author

#

but when i use -balance "mention"

cold tide
#

Like show ctx.authors balance??

slate swan
#

i want it to use discord.Member

#

his issue is with differentiating types lmao

slate swan
#

so i couldn't learn them

#

what

#

🙂 nothing

cold tide
#
@bot.command()
aysnc def balance(ctx,user=None):
   if user==None:
      await ctx.send(f"{ctx.author} has...")
elif user=discord.Member.id():
      await ctx.sendf"{ctx.author} has...")
#

there

#

should work @slate swan

shrewd apex
#

u guys know any good windows themes?👀

slate swan
#

would never work

slate swan
#

user would be a str

cold tide
#

Woops

slate swan
#

because the user is always as None

cold tide
#

Yeah

#

ik

slate swan
#

and whats aysnc new keyword?😭

silk fulcrum
shrewd apex
#

ignored...

slate swan
silk fulcrum
paper sluice
cold tide
#
@bot.command()
aysnc def balance(ctx,user=None):
   if user==None:
      await ctx.send(f"{ctx.author} has...")
elif user==discord.Member.id():
      await ctx.sendf"{ctx.author} has...") 
slate swan
#

💀

cold tide
#

that might work idek

slate swan
#

aysnc keyword💀 😭

cold tide
#

bro your issue is differentiating types

slate swan
#

i dont mean to offend anyone its just kinda funny to me

silk fulcrum
#

discord.Member.id() 💀

slate swan
#
@bot.command()
async def balance(ctx, user: discord.Member = none):
     if user == none:
          user = ctx.author
     await ctx.send(f”{user.mention} is having 69.”)

I’m wrong, maybe*

slate swan
cold tide
#

what do you want your command to do? @slate swan

paper sluice
cold tide
#
@bot.command()
aysnc def balance(ctx,user=None):
   if user==None:
      await ctx.send(f"{ctx.author} has...")
elif user=ctx.author:
      await ctx.sendf"{ctx.author} has...")
slate swan
#

None

slate swan
#

💀

slate swan
cold tide
#

that works @slate swan

silk fulcrum
#

== None 💀

slate swan
slate swan
#

user = user or ctx.author 💀

cold tide
#

yeah

slate swan
#

You said it to me

slate swan
cold tide
#

Oh like pls bal @cold tide

slate swan
#

dankmemer 💀

cold tide
silk fulcrum
# slate swan Ye ik

you didnt get me, I meant that you should consider using is None instead of == 💀

cold tide
#

uhm ask someone else bro

cold tide
#

Im not the guy for that

#

that command is usless without json anyways

slate swan
#

i already answered his question you can chill lol

silk fulcrum
#

aysnc me pls

cold tide
#

Bro will just value everyone with 0 for now

slate swan
cerulean solstice
#
import discord
from discord.ext import commands
import random

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


@bot.event
async def on_ready():
  activity = discord.watching(name = "Discord Servers")
  await bot.change_presence(status=discord.Status.idle, activity=activity)
  print("The bot is online")
  

@bot.command(aliases=['Ping', 'PING'])
async def ping(ctx):
  await ctx.send(f":ping_pong: The bots latency is {round(bot.latency * 1000)}ms")

@bot.command(aliases=['8ball', '8Ball', '8-ball'])
async def eightball(ctx, *, question):
  responses = [":8ball: *As I see it, yes*", ":8ball: *Im tired, ask again later*", ":8ball: *A simple NO*", ":8ball: *Maybe?*", ":8ball: *Most Likely*", ":8ball: *A straight YES*", ":8ball: *Without A Doubt*", ":8ball: *I dont think so*", ":8ball: *Yesnt?*"]
  await ctx.send(f"{random.choice(responses)}")
  

@bot.event
async def on_member_join(member):
  channel = member.guild.system_channel
  await channel.send(f"{member.mention} Welcome To The Server!")

@bot.event
async def on_member_remove(member):
  channel = member.guild.system_channel
  await channel.send(f"Bye-Bye{member.mention}")

bot.run("Token")

the error is

Ignoring exception in on_ready
Traceback (most recent call last):
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 10, in on_ready
    activity = discord.watching(name = "Discord Servers")
AttributeError: module 'discord' has no attribute 'watching'

could someone pls help!

slate swan
#

iirc it was 3.11 not sure

paper sluice
#

they should add a new keyword, reason, im bored

slate swan
cold tide
#

i have*

slate swan
slate swan
paper sluice
cold tide
#

Well why dont you show the whole code

slate swan
slate swan
#

i will make 2 commands

cerulean solstice
slate swan
#

it's better

cold tide
cerulean solstice
cold tide
#

your gonna need something like this

slate swan
#

The error is in on_ready

cold tide
#
@bot.command()
async def bal(ctx):
    with open("data.txt") as json_file:
        points = json.load(json_file)
        for user in points["points"]:
            if user["id"] == ctx.author.id:
                point_num = user["points"]
                await ctx.send(f"You have {point_num} points")
                with open("data.txt", "w") as outfile:
                    json.dump(points, outfile)
slate swan
#

If you’ve read the error

silk fulcrum
paper sluice
cold tide
#

Without that your commands are usless

cold tide
#

sorry

#

😭😭

slate swan
#
async def mybalance(ctx,user):
  user = ctx.author
  await ctx.send (user.name+" has...")

@Winter.command()
async def balance(ctx,user):
  user = discord.Member
  await ctx.send (user.name+" has...")```
#

Give me command suggestion

silk fulcrum
slate swan
cold tide
#
@bot.command()
aysnc def balance(ctx,user=None):
   if user==None:
      await ctx.send(f"{ctx.author} has...")
elif user=discord.Member.id():
      await ctx.sendf"{ctx.author} has...") 
slate swan
#

aysnc🤐

cold tide
silk fulcrum
#

ayo, sync me rn

slate swan
#
async def mybalance(ctx):
  await ctx.send (ctx.author.name+" has...")

@Winter.command()
async def balance(ctx,user):
  user = discord.Member
  await ctx.send (user.name+" has...")```
#

and now ?

silk fulcrum
cold tide
slate swan
slate swan
# silk fulcrum hm?

im not a gold digger, im a cat digger, i search for cute cats, aka your cat

slate swan
cold tide
#

Ohhh okay

slate swan
#

Just a simple command

silk fulcrum
slate swan
#

But interactive

slate swan
silk fulcrum
#

@slate swan WAIT, WHERE is my cat???!?!?! i cant find him!!!

cold tide
#

py```
if ctx.author.id==

silk fulcrum
#

nononono dont tell me you stole him

#

nowayyysnc

slate swan
#

😳 ✌️ peace out

paper sluice
silk fulcrum
cold tide
#

Yeah mb

silk fulcrum
slate swan
paper sluice
#

ik

cerulean solstice
#
Ignoring exception in on_ready
Traceback (most recent call last):
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 10, in on_ready
    await bot.change_presence(status=discord.Status.idle, activity=discord.watching('Discord Servers'))
AttributeError: module 'discord' has no attribute 'watching'
@bot.event
async def on_ready():
  await bot.change_presence(status=discord.Status.idle, activity=discord.watching('Discord Servers'))
  print("The bot is online")

could someone pls help
im dumb and i know it

slate swan
#
async def mybalance(ctx):
  await ctx.send ("You have...")

@Winter.command()
async def balance(ctx,user : discord.Member):
  await ctx.send (user.name+" has...")```
#

finally this worked

#

you guys have both been given an answer already?

cold tide
cerulean solstice
cold tide
#

i suggest using python docs...

slate swan
#

Okimi

slate swan
silk fulcrum
cerulean solstice
#
Ignoring exception in on_ready
Traceback (most recent call last):
  File "/home/runner/Astro/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "main.py", line 10, in on_ready
    await bot.change_presence(status=discord.Status.idle, activity=discord.ActivityType.watching('Discord Servers'))
TypeError: '_EnumValue_ActivityType' object is not callable
silk fulcrum
#

!d discord.ActivityType.watching

unkempt canyonBOT
slate swan
cerulean solstice
cold tide
#

I love how jsons website hasnt been updated since the 90's Lol

cold tide
#

Np

slate swan
#

who knows tinydb ?

silk fulcrum
whole sparrow
#

When Im using slash commands in disnake why do I get this error?

[WARNING] Failed to overwrite global commands due to 400 Bad Request (error code: 50035): Invalid Form Body
In 0.options.0.description: This field is required
silk fulcrum
whole sparrow
#

yh idk what that means

#

this is a snippet of the code for slash command

#
    @commands.slash_command(description="poggers") #The aliases in this decorator is made so people can also use "bal" as the command name. eg. .bal
    async def balance(self, ctx, user:disnake.Member = None): #user is defaulted as None if the user just want's to check their own balance.
        #The user can therefore check their own balance or someone elses. This is a polymorphic function.
        if user == None: #If the user input's no other user's id or their @.
            author = ctx.message.author #Variable contains the message sender user's instance object.
            pfp = author.display_avatar #The user's profile picture URL link
silk fulcrum
#

um ig that means that you have command that is called something like /ban or /tableflip

#

they're default by discord

whole sparrow
#

but balance isnt one of them

shrewd apex
#

damn more comments than code

whole sparrow
#

this was for a school project i needed to comment

#

but reusing the code

shrewd apex
#

i have never seen so much comment in my life is cs project or English project 👀

#

code should be understandable just from reading

whole sparrow
#

Yeah but what they wanted to see is how you understand the code and commenting was part of the overall marks so I had to write so much unecessary stuff

#

but it was worthit i did decent in the end

shrewd apex
#

and then the indents ==None CTX.message.author💀

slate swan
#

ngl over commenting is something beginner's do, i only comment to e.g specify a task needs to be done or implemented so contributors know

whole sparrow
#

Ah indents are fucked because of discord ngl it doesnt look like that

#

Like I said, I only did this for a school project id never do something so goddam tedious

silk fulcrum
#

leave school

shrewd apex
#
@commands.slash_command()
async def balance(self, inter: disnake.Interaction, user: disnake.Member = None) -> None:
    member = inter.user or user
    pfp = member.display_avatar.url
#

slash command dosent use ctx

silk fulcrum
#

discord + disnake compilation, new song of year

shrewd apex
austere vale
#

is it possible to have your bot check for ongoing giveaways and resume them when it starts up? or is there no way to do that and you just have to keep the bot alive the whole time during a giveaway?

whole sparrow
unkempt canyonBOT
#

Lib/random.py line 459

n += 0.0    # convert to float for a small speed improvement```
silk fulcrum
slate swan
paper sluice
unkempt canyonBOT
#

Lib/random.py line 462

cum_weights = list(_accumulate(weights))```
slate swan
#

stdlib btw

austere vale
#

does anyone know how to create an embed where the embed gets changed/edited depending on the user reacting? like Mudae bot

slate swan
#

why the hell does a stdlib have such bad var naming💀

paper sluice
slate swan
paper sluice
#

idek if i spelt it right lol

cold tide
#

Quick question in which i don't mean any offence, how can you be non binary but say your biologically male?

slate swan
cold tide
#

Ah okay cool

slate swan
cold tide
silk fulcrum
silk fulcrum
slate swan
#
    db.update({"balance":NewAuthorAmount, Mem.name==ctx.author.name})
                                                                   ^
SyntaxError: invalid syntax```
#

where is the problem

cold tide
#

Mem.name

#

is that your variab?

slate swan
cold tide
#

Okay

cold tide
#

Yeah

silk fulcrum
#

forgot how dicts work? check our free python courses

slate swan
cold tide
slate swan
slate swan
cold tide
silk fulcrum
#

so it should be something: Mem.name==ctx.author.name

cold tide
#

Wheres your f string??

#

dont you need that?

silk fulcrum
#

not just Mem.name==ctx.author.name

slate swan
#

im not saying you did something wrong just be careful

slate swan
#

this is right

silk fulcrum
#

no this is not

slate swan
#

but this is wrong

#

i didn't find the syntax different

cold tide
#

can you please send the full code??

silk fulcrum
#

you separate "balance" and other key with comma

silk fulcrum
slate swan
#
async def transfer(ctx,receiver:discord.Member,amount: int):
  AuthorListSearch = db.search(Mem.name==ctx.author.name)
  AuthorDictionarySearch = AuthorListSearch[0]

  ReceiverListSearch = db.search(Mem.name==ctx.author.name)
  ReceiverDictionarySearch = AuthorListSearch[0]
  if int(AuthorDictionarySearch.get("balance")) >= int(amount) :
    NewAuthorAmount = int(AuthorDictionarySearch.get("balance")) - int(amount)
    NewReceiverAmount = int(ReceiverDictionarySearch.get("balance")) + int (amount)
    
    db.update({"balance":NewAuthorAmount, Mem.name==ctx.author.name})
    db.update({"balance":NewReceiverAmount, Mem.name==receiver.name})

    await ctx.send(ctx.author.name+" transferred" + amount + " to "+ receiver.mention)```
slate swan
silk fulcrum
#

whatever..

slate swan
#

my brain will explose ._.

onyx aspen
#

damn no need to be rude, Master32

slate swan
#

hes just annoyed lol

onyx aspen
#

anyway- I have a question about adding slash commands?

cold tide
#

Sure

silk fulcrum
onyx aspen
silk fulcrum
slate swan
#

see, i can say by personal experience hes a quite nice person

slate swan
silk fulcrum
#

Master32: absolutely loses his mind

onyx aspen
#

well- mainly how do you add them?

slate swan
#

you register them with a decorator, depends on which library tho

silk fulcrum
onyx aspen
#

mhm

swift pumice
#

banana moment

slate swan
#

*like

#

hikari😳

onyx aspen
#

i can paste my code if that helps?

slate swan
#

im making my own now

slate swan
onyx aspen
#

I'm very new to this so I don't really understand much lmao

silk fulcrum
slate swan
onyx aspen
slate swan
silk fulcrum
slate swan
#

ive made my own discord api wrapper its pain having a good structure

slate swan