#discord-bots

1 messages · Page 1083 of 1

slate swan
#

i wonder how much do mee6 and dyno earn thru premium

dull terrace
#

the earn per server (eps) is wrong needs to x100

slate swan
#

!d discord.Guild.ban , takes a user

#

oh, my bad

dull terrace
#

epic rpg is really wild, it's a good model if you wanna follow it

slate swan
#

capital U

dull terrace
#

fake rpg too

slate swan
#

!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/latest/api.html#discord.Client.fetch_user "discord.Client.fetch_user").
buoyant zodiac
#

url* is it just .url

slate swan
#

banner.url

#

!d discord.Asset.url

unkempt canyonBOT
slate swan
#

User.banner can return None!

#

it always does, you need to fetch_user before using it

dull terrace
#

fake rpg gets almost 7p per server per month, they would earn £7000 per month if they had 100k servers

buoyant zodiac
#

okay so inorder to get the url i fetch the user and use user.banner.url

slate swan
#

i guess so

#

its like bot.fetch_guilds() which doesnt return a full Guild object and is limited in attributes

sick birch
#

Is it possible to dynamically create tasks w/o using the decorator?

sick birch
#

Without using one, since the decorator locks me into making the task "static" (e.g I have to define the interval beforehand)

#

For context I need to start a tasks loop after a command has been run, and the interval is provided through the command

slate swan
#

!d discord.ext.tasks.Loop

unkempt canyonBOT
#

class discord.ext.tasks.Loop```
A background task helper that abstracts the loop and reconnection logic for you.

The main interface to create this is through [`loop()`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.loop "discord.ext.tasks.loop").
slate swan
#

subclass this

sick birch
#

There's no indication of which arguments tasks.Loop takes though

slate swan
#

!d discord.ext.tasks.Loop.change_interval is exactly what ur looking for

unkempt canyonBOT
sick birch
#

So define a dummy task with 0 of everything, then change it later when necessary?

slate swan
#

yep, that should do!

heady sluice
#

is a voice channel an abc.Messageable now

sick birch
#

👍 thanks, will give that a shot

slate swan
#

ill miss the #no-mic channels

heady sluice
#

I won't

#

never been in one

slate swan
#

does voice text channels have endpoints yet?

#

so bots can send messages and view the channel?

heady sluice
#

!d discord.VoiceChannel.last_message this exists for sure

unkempt canyonBOT
#

property last_message```
Retrieves the last message from this channel in cache.

The message might not be valid or point to an existing message.

New in version 2.0.

Reliable Fetching

For a slightly more reliable method of fetching the last message, consider using either [`history()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.history "discord.VoiceChannel.history") or [`fetch_message()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.fetch_message "discord.VoiceChannel.fetch_message") with the [`last_message_id`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.last_message_id "discord.VoiceChannel.last_message_id") attribute.
slate swan
maiden fable
#

!d discord.abc.GuildChannel.changed_roles

unkempt canyonBOT
#

property changed_roles```
Returns a list of roles that have been overridden from their default values in the [`roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.roles "discord.Guild.roles") attribute.
heady sluice
slate swan
#

ik but i ment in voice chat text channels

heady sluice
#

yes

maiden fable
#

!d discord.VoiceChannel.send

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

Sends a message to the destination with the content given.

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

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

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

mhm ig their is already endpoints

maiden fable
#

Seems like a yes

slate swan
maiden fable
#

new feature

slate swan
#

ooh Nice

sick birch
#

@slate swan Thanks for the help, subclassing did exactly what I wanted 😄

slate swan
#

pleasure <3

slate swan
#
  • no you
maiden fable
#

okimii is waiting for sarthak to get the Helper role so that sarthak can nominate okimii for Helper

#

And loop goes on and on and on and on and on and on and on and on

slate swan
#

but we all know thats okimii needs to please hunter for that 😳

shrewd apex
#

👀

flint isle
#

disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.events' raised an error: OperationalError: connection to server at "iphere", port 3306 failed: received invalid response to SSL negotiation: p
hmm odd

maiden fable
#

U on Mac?

flint isle
#

iphere censored the ip

#

no im on windows

maiden fable
#

Weird

#

Is the port 3306 opened?

flint isle
#

it should be

maiden fable
#

u should verify

flint isle
#

how do i verify that since the database is remote

maiden fable
#

u bought a VPS or smth?

slate swan
flint isle
#

i have one via google cloud as progreSQL or however that is spelled and one i had from bot-hosting.net

#

wait a sec i think the second one i was trying might be sql database instead

maiden fable
#

O

maiden fable
#

Nice

slate swan
slate swan
# paper sluice dedication

i just do it cuz i love what i do, but yeah you can ask the regulars here im always here like on a daily basispWut

maiden fable
#

Can you please take this to #bot-commands

paper sluice
slate swan
shrewd apex
#

welp u just gotta grind a year or two more ig

paper sluice
#

hunter is mypy, enforces rules :p

slate swan
#

Robin has done the same thing @sick birch am i right RobinpWut

#

but i actually have good exampleslurks

#

pBear with the amount of off topic chats we do in this channel, lets stop hoping for helpr roles

slate swan
#

!ot

unkempt canyonBOT
lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

slate swan
#

smhgrump

paper sluice
slate swan
#

😭

slate swan
#

cuz why notlurks

slate swan
#

that is a feature

#

thats a library feature

#

no

#

isnt it

#

elaborate

slate swan
#

i made a whole class that handles commands that use apis and i made a command that lets you make api request with the bot but its limited to a request per day

#

per user ofc

slate swan
slate swan
#

especially 1 req per day

slate swan
#

exactly

#

🙄 pWut

flint isle
#

I FIXED THE DATABASE ACCESS!!

slate swan
#

congo

maiden fable
#

Nice

slate swan
flint isle
#

oops caps... i forgot to authorise my ip

maiden fable
#

Ah

slate swan
#

GoLang

maiden fable
#

Would ya'll go to an OT channel by yourself or I have to bother @unkempt canyon?

paper sluice
#

onelettervariablename gang

slate swan
unkempt canyonBOT
paper sluice
#

this channel is cursed, every channel tagged from here dies :/

slate swan
velvet compass
#

If only

scarlet aurora
#

@vale wing

flint isle
stiff gorge
#
track_background_image = Image.open('images/spotify_template.png')
        album_image = Image.open(requests.get(spotify_result.album_cover_url, stream=True).raw).convert('RGBA')
    ret = await coro(*args, **kwargs)
  File "/home/runner/mv/cogs/spotify.py", line 22, in track
    album_image = Image.open(requests.get(spotify_result.album_cover_url, stream=True).raw).convert('RGBA')
flat solstice
#

Does anyone have any resources they could link to me for setting up tests for my bots code? I want to set up some tests on something like circleci but I don't have any tests written. I've seen libs such as https://github.com/Cobular/distest and https://github.com/CraftSpider/dpytest which aim to make testing discord bot code easier but none of these, as far as I can see, support discord.py 2.0. I'm just interested to learn how others how write discord bots in python write their code tests

flat solstice
#

Okay will do, thanks for the advice

slate swan
#

this is pog, especially for people with "who invited my bot" issues

slate swan
#

💀

slate swan
#

embed.set_thumbnail(url=user.avatar.url)

#

why does this not work, it says nonetype doesn't have attribute url but I am certain the user is a user object since I can make it print it's username and discriminator

fading marlin
#

consider using display_avatar instead rooThink

slate swan
fading marlin
slate swan
#

Oh ok, do you know any alternative for discord.py 1?

fading marlin
#

well, on 1.7 avatar doesn't have a url attribute

slate swan
#

hikari, better and faster, but harder @slate swan

sick birch
#

It's avatar_url in 1.7.3 iirc

fading marlin
#

^

slate swan
#

Ok and I guess this isn't really related to discord bots but is there like a check I could do using subprocess to check what version of discord.py the one running the code has?

#

So when they have v2 I could make it display_avatar and if they have older I do avatar_url

sick birch
#

You really shouldn't be doing that

#

As having a stable environment you can predict is important

fading marlin
#

sys.version/sys.version_info discord.__version__/discord.version_info but just stick to one dpy version

vocal plover
#

thats python version not dpy version, no?

slate swan
#

Well yeah I guess that'd be quite complicated for no reason lol

sick birch
#

Set yourself up a virtual environment that way you don't have issues with package verions

fading marlin
sick birch
slate swan
#

you can just pip show Library in the cmd, prob fastest and more informative

sick birch
#

They want it from within their code programatically

slate swan
#

would that work? I don't know how to get the version tho sadCat

sick birch
#

No need, just use discord.version_info from within your code

#

But again, probably not a good idea as you should have a stable, static environment

slate swan
#

it's for github haha that's kinda why

sick birch
#

if you're uploading it to github dockerize your app

slate swan
#

what's dockerize

oblique forum
#

how to convert file.pyc to file.py v3.9

slate swan
sick birch
#

You should always dockerize your apps, good practice

unkempt canyonBOT
#

Hey @oblique forum!

It looks like you tried to attach file type(s) that we do not allow (.pyc). 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.

sick birch
slate swan
#

OOOOO

oblique forum
#

can some one help me please

slate swan
#

thanks bro
also how do u move to a different dsc version just to check

oblique forum
#

i can't back my soruce from pyc

sick birch
slate swan
slate swan
sick birch
fading marlin
slate swan
#

how to uninstall

#

Also I swear there was a command I used before to go to a version, something like
pip install discord==1.7.3
no?

slate swan
oblique forum
#

bruh no i found way but not work on v3.9

#

only 3.8 :"(

fading marlin
#

either way how does that relate in any way to discord bots?

oblique forum
#

no idon't know where i have to go

fading marlin
fading marlin
vale wing
#

I doubt this would work because 2.0 is installed from git and most likely "is not conflicting" with the package installed from pypi (in fact it does but pip might not recognise that)

vale wing
#

So just pip freeze, copy your discord req and pip uninstall it

#

Or locate its installation (gonna be easier if installed in venv) and delete manually

pliant gulch
#
from __future__ import annotations

from typing import TYPE_CHECKING, Any, Callable, Coroutine, TypeVar

import asyncio

import inspect
import re


class MaybeAwait:
    def __init__(self, coro: Callable[..., Coroutine]) -> None:
        if not asyncio.iscoroutinefunction(coro):
            raise RuntimeError("Received non-coroutine.") from None

        self.syncf: Callable[..., Any]
        self.coro = coro

    def __call__(self, id: int) -> Any:
        ctx = inspect.getframeinfo(inspect.stack()[1][0]).code_context[0] # type: ignore
        if re.search(r"^(.*?)(\bawait get_member\b)(.*)$", ctx):
            return self.coro(id)

        return self.syncf(id)

    def sync(self) -> Callable[..., Callable[..., Any]]:
        def inner(func: Callable[..., Any]) -> Callable[..., Any]:
            
            self.syncf = func
            return func

        return inner


async def main() -> None:
    @MaybeAwait
    async def get_member(id: int) -> int:
        return id

    @get_member.sync()
    def _get_member(id: int) -> int:
        return id

    print(await get_member(123))
    print(get_member(456))


asyncio.run(main())
``` cc: @visual island 
^ Not originally what I wanted to do to make this work. Originally I was using `ctypes` to do some hacky pointer stuff, then hooking onto RuntimeWarning; for the most part it worked. Except RuntimeWarning was only emitted after a call, therefor I had to call the sync function twice to make my original POC work (It did work but it was ugly)
minor totem
alpine pewter
#
@bot.event
async def on_ready(guild):
    client_guild_name = guild.name
    client_guild_id = guild.id

    reference = db.reference(f"/")
    reference.update({
        client_guild_name: {
            "client_guild_id" : client_guild_id
        }
    })

Would this be the correct way to get guild information?
It works with the on_guild_join(guild) - It's giving this error.

TypeError: on_ready() missing 1 required positional argument: 'guild'

pliant gulch
#

Didn’t require me to look at the stack either

frosty valve
#

I need a pycord dev for a command

slate swan
#

Go ahead and tell your issue

flat solstice
#

So I'm making a class which sets some defaults for my embeds, is the kwarg for the colour set as colour or color in the embed kwarg list? I know I can do

embed.colour.green()``` 
and 
```py
embed.color.green()```
but I'm doing this
```py
class PositiveEmbed(LogEmbed):
    def __init__(self, *args, **kwargs):
        if "colour" not in kwargs:
            kwargs["colour"] = discord.Colour.green()
        super().__init__(*args, **kwargs)``` 
and it seems a bit odd to me that the kwarg list would have both `colour` and `color` so is there some weird background converting done when `colour` is in the list/called to make it call `color`
sick birch
#

The kwarg list can have both, but it shouldn't, so I suppose you can assume that it's only going to have one

unkempt canyonBOT
#

discord/embeds.py lines 161 to 162

colour: Optional[Union[int, Colour]] = None,
color: Optional[Union[int, Colour]] = None,```
`discord/embeds.py` line 170
```py
self.colour = colour if colour is not None else color```
flat solstice
#

ah okay, thanks for clearing that up for me

fading marlin
#

just say your issue

slate swan
#

i want a dpy rewrite smhgrump

cloud dawn
visual island
pliant gulch
#

Oh, your right. I just used that because I had a file using that method before it was changed

slate swan
#

do you mean the color black returns false? just use the missing sentinel? im not sure what you mean...

pliant gulch
#

import asyncio
import os

import aiohttp


class Foo:
    async def fetch(self):
        headers = {"Authorization": "Bot token"}
        url = f"discord.com/api/v9/users/{self}"

        async with aiohttp.ClientSession().get(url, headers=headers) as resp:
            return await resp.json()
 
    def __eq__(self, other):
       other["fetch"] = Foo.fetch

int.__dict__ == Foo()

async def main():
    await (270700034985558017).fetch()

asyncio.run(main())
``` Neat little bug to edit the underlying map, let’s you add some methods to built-in literals
slate swan
cloud dawn
#

!e print(bool(0x000))

unkempt canyonBOT
#

@cloud dawn :white_check_mark: Your eval job has completed with return code 0.

False
slate swan
#

ohhhhhhh you ment the hex code

cloud dawn
#

That's what color/colour is right :3

slate swan
#

still i want a rewrite grump

#

epic has me waiting for nextcord v3shipit

pliant gulch
#

Okimii help me finish Rin

#

😏

slate swan
#

ill never finish

#

i do like 50 rewrites

#

and i hate doing lib abstractions so no.

alpine pewter
#
@bot.slash_command(guild_ids=guild_ids)
async def setup_status(interaction : Interaction, channel : GuildChannel):
    status.start()

@tasks.loop(seconds=30)
async def status():
    print("Loop Done")

For something like this, does anyone know how would you send the @tasks.loop to a certain channel that a user specifies in the command above?

#

Or, am I just going about it wrong?

flat solstice
#

For some reason I'm getting this error

Unexpected token at end of expressionPylance
``` on this line
```py
f"{f'role.name' for role in channel.overwrites if len(channel.changed_roles) >= 1}"```
cloud dawn
#

double f string

#

Why do you need an if string if you use it for just one variable.

flat solstice
#

I'm trying to do something like

role1.name, role2.name, etc
```but I've forgotten how to do it which is a bit nnoying
cloud dawn
unkempt canyonBOT
#

Joining Iterables

If you want to display a list (or some other iterable), you can write:

colors = ['red', 'green', 'blue', 'yellow']
output = ""
separator = ", "
for color in colors:
    output += color + separator
print(output)
# Prints 'red, green, blue, yellow, '

However, the separator is still added to the last element, and it is relatively slow.

A better solution is to use str.join.

colors = ['red', 'green', 'blue', 'yellow']
separator = ", "
print(separator.join(colors))
# Prints 'red, green, blue, yellow'

An important thing to note is that you can only str.join strings. For a list of ints,
you must convert each element to a string before joining.

integers = [1, 3, 6, 10, 15]
print(", ".join(str(e) for e in integers))
# Prints '1, 3, 6, 10, 15'
flat solstice
blissful sparrow
#

Not sure if this is the right channel, but basically I want to display an entire table in a message when I do the /users command, any pointers as to how to start this?

#

minus the database connector etc

buoyant zodiac
#
@commands.Cog.listener()
    async def on_ready():
        for user in bot.users:
            self.bot.get_user(user)
            self.db.insert_one({"_id": user.id,
            "cash": 0,
            "bank": 0,
            "notifications": True})
``` i need help its not inserting
cloud dawn
#

Why are you adding this in on_ready?

buoyant zodiac
#

on the ready it adds all the people that aren't in the db

#

but i'm switching it to an on message so that only the author is added when they send message

cloud dawn
#

No need to add people that aren't going to use it anyways.

buoyant zodiac
#

how to process cmds?

#

in on message

cloud dawn
buoyant zodiac
#

should it be like if user not in db

cloud dawn
#

Something like that

crisp drift
#

upsert exists if no data is found

buoyant zodiac
#
if user not in self.db.find({"_id": user.id}):
            self.db.insert_one({"_id": user.id,
            "bank": 0,
            "cash": 0,
            "notification": True})
#

its in the db but it still keeps looking for it

lyric apex
#

railwayapp is good for hosting bot?

buoyant zodiac
#

its still trying to enter it into the db

crisp drift
#

Obviously, you need to get that data to check if it needs to be inserted or not

buoyant zodiac
#

obviously im not understanding ..

crisp drift
#
.find_one_and_update(
    {'_id': 'userid'},
    {'$inc': {'seq': 1}},
    upsert=True,
    return_document=ReturnDocument.AFTER)
{'seq': 1}```

Using upsert will create the document if doesn't exist
#

I suggest you to move to #databases to get more help regarding databases

buoyant zodiac
#
if user.id not in self.db.find_one_and_update({"_id": user.id}):
            self.db.insert_one({"_id": user.id,
            "bank": 0,
            "cash": 0,
            "notification": True,
            upsert=True})
``` ???
#

hold up no

crisp drift
#

Since you will need to get the data from the db anyway, you can leave that check and just do the method ive sent you. In a single method it gets the data and if not found it will create the document thats it

buoyant zodiac
#
self.db.find_one_and_update({"_id": user.id,
            "bank": 0,
            "cash": 0,
            "notification": True,
            upsert=True,
            return_document=ReturnDocument.AFTER})
```what should i do now
alpine pewter
#

Can someone help with this? Unsure how to fix this error.

buoyant zodiac
#

get the channel

#

!d discord.Guild.get_channel

unkempt canyonBOT
#

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

Note

This does *not* search for threads.

Changed in version 2.0: `channel_id` parameter is now positional-only.
alpine pewter
#

Got it, will try that.
Thank you

keen mural
#

anyone know where i can learn slash commands on d.py 2.0

frozen patio
#

How do I make my bot appear online but mobile

slate swan
#

Oi, so... ModuleNotFoundError: No module named 'discord_slash' and I'm not able to startup my bot :/ I installed discord-py-slash-command and nothing changes

frozen patio
#

Don't use that lib

#

D.py has slash built in

slate swan
#

Oh?

frozen patio
#

Yes

slate swan
buoyant zodiac
#
@commands.command()
    async def balance(self, ctx, user: discord.Member = None):
        user = ctx.author if user is None else user
        user = self.bot.get_user(user)
        try:
         get = self.db.find_one({"user": user.id})
         if get is None:
          self.db.insert_one({"user": user,
            "bank": 0,
            "cash": 0,
            "notifications": True})
        except:
            cash = self.db.find_one({"user": user.id})["cash"]
            bank = self.db.find_one({"user": user.id})["bank"]

error:

#

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

keen talon
torn sail
frozen patio
#

Does anyone know how to do this?

fading marlin
torn sail
# frozen patio Yes

you would have to change stuff with the gateway. I’m not sure exactly how to do it

#

But it’s possible

fading marlin
#

^

frozen patio
slate swan
#

its a bug of the api, its an endpoint for users but can still be accessed by bots

fading marlin
lyric apex
#

Qtpie why forks

frozen patio
#

Not important

frozen patio
slate swan
lyric apex
sick birch
buoyant zodiac
#

!d discord.Member.joined_at

slate swan
unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @nocturne plover until <t:1654314005:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).

lone dust
#

anyone know how to make the bot reply to your msg

lone dust
slate swan
boreal ravine
slate swan
#

instead of using "ctx.send()"

do "ctx.reply(MSG, mention_user = True)"

#

MSG is whatever u want to be sent

lone dust
#

got it thanks

jade tartan
#
    async def setwelcome(self, ctx, *, message=None):
        """Sets the welcome message for your server (bot-admin only). 
        Available Options:

        [[user]]   = user name
        [[atuser]] = user mention
        [[server]] = server name
        [[count]]  = user count
        [[place]]  = user's place (1st, 2nd, 3rd, etc)
        [[online]] = count of users not offline"""

        if not await Utils.is_bot_admin_reply(ctx):
            return

        if message == None:
            self.settings.setServerStat(ctx.guild, "Welcome", "")
            return await ctx.send('Welcome message removed!')

        self.settings.setServerStat(ctx.guild, "Welcome", message)
        await ctx.send('Welcome message updated!\n\nHere\'s a preview:')
        await self._welcome(ctx.message.author, ctx.guild, ctx.message.channel)
        
        # Print the welcome channel
        try:
            welcomeChannel = ctx.guild.get_channel(
                int(self.settings.getServerStat(ctx.guild, "WelcomeChannel")))
        except:
            welcomeChannel = None
        if welcomeChannel:
            msg = 'The current welcome channel is **{}**.'.format(
                welcomeChannel.mention)
        else:
            if self._getDefault(ctx.guild):
                msg = 'The current welcome channel is the default channel (**{}**).'.format(
                    self._getDefault(ctx.guild).mention)
            else:
                msg = 'There is *no channel* set for welcome messages.'
        await ctx.send(msg)``` Any one know how to send the message as an embed for this?
pallid marsh
#

You mean send the message as an embed instead?

#

@jade tartan

jade tartan
#

yes

#

correct

pallid marsh
#
embed = discord.Embed(title=“titleHere”, description=“descriptionHere”, color=“hexColorHere”)
embed.add_field(name=“nameHere”, value=“textHere”, inline=True/False)
#

You can add as many fields as you want (up to 25)

slate swan
#

fields are only limited up to 25

#

and refer to the official docs instead of some external links

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.

pallid marsh
#

The official dpy docs aren’t the most pleasant looking docs lol

slate swan
forest bramble
#

Hello!

slate swan
#

hola

pallid marsh
forest bramble
#

I am coding a discord moderation bot. When I run the code in VS Code, the code doesn't run and shows and error which states ' SSL is not supported'. The same code runs very well in Replit. How can I fix this issue?

maiden fable
#

SSL Cert issue

forest bramble
#

How can I fix that?

tropic flame
#

so um guys im coding an ai discord bot and i am getting this errror- UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 1940: character maps to <undefined> from some time ( it was online and working before i added somethings)
this is my main.py - ```
import discord
import os
from dotenv import load_dotenv
from neuralintents import GenericAssistant
chatbot = GenericAssistant('noyyy.json')
chatbot.train_model()
chatbot.save_model()

client = discord.Client()

load_dotenv()

@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("&"):
response = chatbot.request(message.content[1:])
await message.channel.send(response)
client.run('t')```

#

i'd love it if anybody could help out

maiden fable
#

Isn't this type of config meant for chatterbot module? Idk

slate swan
maiden fable
#

Anyways that means u have a non unicode char in yr file

jade tartan
#

do i just add str attributes to it

jade tartan
#

So i have set up a welcome message the way i want it to but i want that message to be send as a embed

tropic flame
# maiden fable Anyways that means u have a non unicode char in yr file

i don't really know which this my traceback - ```Traceback (most recent call last):
File "c:\Users\dhruv\OneDrive\Desktop\Dhruv_pycache_\Ayr.py", line 6, in <module>
chatbot = GenericAssistant('noyyy.json')
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\site-packages\neuralintents\main.py", line 53, in init
self.load_json_intents(intents)
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\site-packages\neuralintents\main.py", line 58, in load_json_intents
self.intents = json.loads(open(intents).read())
File "C:\Users\dhruv\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]````

slate swan
tropic flame
forest bramble
slate swan
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.

tropic flame
# slate swan ** **

but like um any examples of non unicode character that could have been in my json file ?

forest bramble
#

this is ok?

slate swan
pallid marsh
maiden fable
maiden fable
lyric apex
#

Hunter and ash both ignored meQtpie

forest bramble
#

@slate swan

jade tartan
maiden fable
lyric apex
forest bramble
jade tartan
#
    self.embed.set_footer(text = f"{self.username}'s query evaluated.")
    self.embed.set_author(name = f"{self.username}'s' query.", icon_url = ctx.message.author.avatar_url)
    self.embed.add_field(value = f"{self.operation}", inline = False)
    self.embed.add_field(value = "After evaluated, the result is :", inline = True)
    self.embed.add_field(value = f"{self.evaluate}", inline = True)
    await ctx.send(embed = self.embed)``` So like that
lyric apex
#

Oh godQtpie

jade tartan
#

ok

forest bramble
maiden fable
forest bramble
lyric apex
forest bramble
maiden fable
forest bramble
tropic flame
# slate swan show your `intents.json` or smth if you have that
    {"tag":"greetings",
        "patterns": ["Sup", "Yo", "Hello", "Hi", "whatsup", "wazup", "Heyo", "Hey"],
        "responses": ["Hello mate", "Zup", "Wasup my homie", "Yo buddy", "Good day"]},
    {"tag":"rich",
        "patterns": ["Are you rich?", "Are you poor ?", "Whats your income", "How much do you own", "How rich are you", "are u rich?"],
        "responses": ["To put it simply I am dayum rich and to put it more simply, My money don't jiggle jiggle it fold"]},
    {"tag":"live",
        "patterns": ["Where do you live", "where are u"],
        "responses": ["I live in the depths of the internet"]},
    {"tag":"netw",
        "patterns": ["What's your networth?", "whats ur networth?"],
        "responses": ["About 50$ :(, My creator Fyre#2444 doesn't get any funding yet, no dmc no money #thatbrokeasscreator"]},
    {"tag":"smarter",
        "patterns": ["Are you getting smarter everyday?", "Are you evolving?", "Are you dumb?", "Are you smart?"],
        "responses": ["I am an ever evolving artificial intelligient bot. The finest bot on all of discord"]},
    {"tag":"name",
        "patterns": ["What's your name", "whats ur name","Who are you"],
        "responses": ["I am Ayr Alicante the first of his name, but you my friend, can call me Ayr"]},
    {"tag":"jokes",
        "patterns": ["Tell me a joke", "Do you know a joke ?", "humour me"],
        "responses": ["Even people like you who are good for nothing have the capacity to bring a smile to your face, like when you push them down the stairs.", "Do you know the phrase “One man’s trash is another man’s treasure”? Wonderful saying, horrible way to find out that you were adopted.", "Give a man a match, and he’ll be warm for a few hours. Set him on fire, and he will be warm for the rest of his life.", "Slapping orphans is not cool, they can't even tell their parents smh"]},
    {"tag":"weather",
        "patterns": ["How's the weather", "Hows the weather", "Is it rainy?", "Is it sunny?"],
        "responses": ["Eh I don't really like this weather but I'll deal with it, what bout u? ", "Pretty nice ngl, thinking bout going to a trip today with my AI friends", "I'M LOVIN ITTTTTT", "Well idk it's just rainin all night long here"]},
    {"tag":"couple",
        "patterns": ["Will I get a gf?", "Will I get a bf?", "Will I get a girlfriend?", "Will I get a boyfriend?"],
        "responses": ["Who am I kiddin, Hell nah u won't.", "The future shines bright soldier"]},
    {"tag":"date",
        "patterns": ["Are you single ? ", "Are you in a relationship ? "],
        "responses": ["I'm single silly goose"]}
    ]````
lyric apex
maiden fable
lyric apex
#

And i did this to stop this

#

But it didn't workedQtpie

maiden fable
tropic flame
maiden fable
slate swan
maiden fable
#

So yea, use a JSON santizier or smth

maiden fable
lyric apex
slate swan
maiden fable
#

How, may I ask?

lyric apex
maiden fable
#

U saved the data in a sb?

#

Db* smh spellcheck

forest bramble
#

@maiden fable How can I do this?

#

I'm new to VS Code btw

lyric apex
maiden fable
lyric apex
#

In the db i stored message, channel and guild ids

unkempt canyonBOT
#
ssl

Source code: Lib/ssl.py

This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library. It is available on all modern Unix systems, Windows, macOS, and probably additional platforms, as long as OpenSSL is installed on that platform.

Note

Some behavior may be platform dependent, since calls are made to the operating system socket APIs. The installed version of OpenSSL may also cause variations in behavior. For example, TLSv1.3 with OpenSSL version 1.1.1.

lone dust
#
         × python setup.py egg_info did not run successfully.
         │ exit code: 1
         ╰─> [10 lines of output]
             Traceback (most recent call last):
               File "<string>", line 2, in <module>
               File "<pip-setuptools-caller>", line 34, in <module>
               File "/tmp/pip-install-vykhmk61/translators_70d2d18cea1d4bcd953b15fa09bc8463/setup.py", line 14, in <module>
                 VERSION = __import__(PACKAGE).__version__
               File "/tmp/pip-install-vykhmk61/translators_70d2d18cea1d4bcd953b15fa09bc8463/translators/__init__.py", line 4, in <module>
                 from .apis import alibaba, baidu, bing, deepl, google, sogou, tencent, youdao
               File "/tmp/pip-install-vykhmk61/translators_70d2d18cea1d4bcd953b15fa09bc8463/translators/apis.py", line 44, in <module>
                 import requests
             ModuleNotFoundError: No module named 'requests'
             [end of output]
         
         note: This error originates from a subprocess, and is likely not a problem with pip.
       error: metadata-generation-failed
       
       × Encountered error while generating package metadata.
       ╰─> See above for output.
       
       note: This is an issue with the package mentioned above, not pip.
       hint: See above for details.
 !     Push rejected, failed to compile Python app.
 !     Push failed
``` Can someone help me how to solve this?
maiden fable
lone dust
#

i am getting this error on heroku

maiden fable
#

Asher please help me I'm dying

shrewd apex
maiden fable
#

And yea, I was just looking at Linux VPS prices and I am on the verge of having a heart attack...

forest bramble
shrewd apex
maiden fable
#

Danbot, seriously?!

maiden fable
#

!d ssl

unkempt canyonBOT
#
ssl

Source code: Lib/ssl.py

This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library. It is available on all modern Unix systems, Windows, macOS, and probably additional platforms, as long as OpenSSL is installed on that platform.

Note

Some behavior may be platform dependent, since calls are made to the operating system socket APIs. The installed version of OpenSSL may also cause variations in behavior. For example, TLSv1.3 with OpenSSL version 1.1.1.

shrewd apex
#

ok then just import it

lone dust
maiden fable
forest bramble
maiden fable
#

@shrewd apex let's make a Custom Discord Client in Python

shrewd apex
lyric apex
#
@tasks.loop(seconds=0.2)
    async def give(self):
        db = sqlite3.connect('giveaway.db')
        cursor = db.cursor()
        cursor.execute("SELECT end FROM info WHERE type = ?", ("give",))
        res = cursor.fetchall()
        if res is not None:
            for end in res:
                d = end[0]
                if d == int(time.time()):
                    cursor.execute("SELECT msg FROM info WHERE end = ?", (end[0],))
                    ed = cursor.fetchall()
                    for msg in ed:
                        s = msg[0]
                        print(s)
                        cursor.execute("SELECT channel FROM info WHERE msg = ?", (msg[0],))
                        ms = cursor.fetchall()
                        for channel in ms:
                            cursor.execute("SELECT prize FROM info WHERE msg = ?", (msg[0],))
                            pri = cursor.fetchone()
                            cursor.execute("SELECT extra FROM info WHERE msg = ?", (msg[0],))
                            auth = cursor.fetchone()
                            ch = self.client.get_channel(channel[0])
                            new_msg = await ch.fetch_message(msg[0])
                            users = await new_msg.reactions[0].users().flatten()
                            if len(users) == 1:
                                ens = discord.Embed(description=f"Ended: <t:{int(time.time())}:R>\nWinner: No One Participated\nHosted By: <@{auth[0]}>", color=0x2f3136)
                                ens.set_author(name=f"🎁 {pri[0]}", icon_url="")```
forest bramble
lyric apex
#

This is starting part

maiden fable
maiden fable
lyric apex
#

?

maiden fable
#

What's yr db schema?

forest bramble
shrewd apex
forest bramble
lyric apex
shrewd apex
#

when u print SSL after importing what do u get?

maiden fable
lyric apex
shrewd apex
#

also why is ur db syncpithink

forest bramble
#

Can you please explain in detail?

shrewd apex
#

are u new to print() too just do print(SSL)

shrewd apex
#

to see if lib object is even there

forest bramble
maiden fable
shrewd apex
#

yeah try to be specific

maiden fable
#

?

forest bramble
#

see this ⤴️

shrewd apex
#

no what does it print

#

it will print and then raise except

#

which line is giving u the error btw

#

can u post ur trace back here

#

!paste

unkempt canyonBOT
#

Pasting large amounts of code

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

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

shrewd apex
#

delete this

forest bramble
shrewd apex
#

u just posted ur token

tawdry perch
#

Reset your token as well

shrewd apex
#

yeah

forest bramble
#

breh

shrewd apex
#

also use os.getenv() it's much better for tokens

forest bramble
maiden fable
# lyric apex Yeah

So why not use a single SQL query to get everything in the row, so it will return a tuple like ((msg_id), (channel_id), (guild_id)) and then do smth like:

guild = bot.get_guild(res[2]) 
channel = guild.get_channel(res[1]) 
msg = await channel.fetch_message(res[0]) 

(This is a psuedo code, istg if u try to copy this)

forest bramble
#

but since this is VS Code, i use it directly

shrewd apex
maiden fable
shrewd apex
#

what's ur dpy version nightmare?

lyric apex
maiden fable
forest bramble
#

I use nextcord

shrewd apex
#

yeah nextcord it looks like a SSL certificate has failed in the chain

#

what's the version tho

lyric apex
forest bramble
shrewd apex
#

both python and nextcord

forest bramble
#

nextcord - latest - 2.0.0b2

forest bramble
#

so that's what i use now

#

@shrewd apex

shrewd apex
#

try
pip install --upgrade certifi

forest bramble
shrewd apex
#

u don't have a python path set pithink

#

that might be the reason for error

forest bramble
#

I'm new to VS Code. I used to use Replit before this.

shrewd apex
#

easiest way is when installing python there will be a checkbox click on that

shrewd apex
#

like ✅ add python to path

forest bramble
shrewd apex
#

just install 3.10 and or 9 and do that

forest bramble
#

So, I already have python 3.9 installed in my computer

shrewd apex
#

it will automatically change any old settings with the new python path version if u wanna do it manually u can too

#

u have to go to c users local program data python

forest bramble
forest bramble
#

it's stored there

shrewd apex
#

and select file to python.exe and put in system path variable

#

u can check Google how to do that tough to type on phone

forest bramble
#

ok

#

So, I create a shortcut for the python.exe and put it in the path where the main.py is stored right?

shrewd apex
#

no...

#

see Google on how to add python to system path variable

lone dust
#
2022-06-04T05:33:33.485218+00:00 app[worker.1]:     bot = commands.Bot(command_prefix=commands.when_mentioned_or('z.', 'Z.'), description='Basic commands for Zeram')
2022-06-04T05:33:33.485240+00:00 app[worker.1]: TypeError: __init__() missing 1 required keyword-only argument: 'intents'
``` I am getting this error when i am deploying my bot but its good on local machine
slate swan
#

just reinstall python, its way easier
make sure to click on "add to python" while doing yhst

shrewd apex
slate swan
#

oh you already are, its the issue with intents then

maiden fable
#

Nice Discord also adding AutoMod

lone dust
#

but i still didnt get permission of intent

shrewd apex
#

u have to do intents=discord.Intents.all()

slate swan
lone dust
#

but its working good on local machine

maiden fable
slate swan
maiden fable
#

Smh y'all using global emojis now

slate swan
lone dust
maiden fable
#

Agreed

shrewd apex
#

welp making a moderation bot wouldn't be my first choice anyway

slate swan
shrewd apex
#

discord is prolly trying to make bots focus only on entertainment part to promote their platform

maiden fable
#

Yea

slate swan
#

make a bot which bitches about discord implementations ez

lone dust
# slate swan i doubt it, could you `pip show discord.py` in your terminal?
Name: discord.py
Version: 2.0.0a3575+g45d498c1
Summary: A Python wrapper for the Discord API
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email:
License: MIT
Location: c:\users\kartik\appdata\local\programs\python\python39\lib\site-packages
Requires: aiohttp
Required-by: discord
slate swan
#

forget bot development i work in discord now😈

slate swan
lone dust
#

yes

#

it showing error if i am putting intent

slate swan
#

well, you gotta pass it in ur code anyways

#

oh, wot error

shrewd apex
#

send ur prefix part code

slate swan
#

you need to enable them in the dev portal btw

lyric apex
slate swan
lone dust
# slate swan oh, wot error
Traceback (most recent call last):
  File "F:\Pycharm Projects\zeram discord bot\main.py", line 54, in <module>
    bot.run(bot_token, reconnect=True)
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 663, in run
    return future.result()
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 642, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 606, in start
    await self.connect(reconnect=reconnect)
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 547, in connect
    raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000023C9266DB80>
Traceback (most recent call last):
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 746, in call_soon
    self._check_closed()
  File "C:\Users\kartik\AppData\Local\Programs\Python\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
slate swan
slate swan
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.

lone dust
#

i did

maiden fable
lone dust
#

apply

maiden fable
maiden fable
shrewd apex
#

ones with ytdl lib?

slate swan
maiden fable
shrewd apex
#

OoO

slate swan
maiden fable
#

Every. Music. Bot. Well, not every but u get it

shrewd apex
#

yeah few use Spotify api wrapper

lone dust
maiden fable
#

Spotify: I'm coming!

shrewd apex
slate swan
# lone dust idk

can you show us the the screenshot of your bot's bot page so we can know what intents you got

or just use ```py
intents=discord.Intents.default()
intents.message_content = True

 instead of `discord.Intents.all()`
shrewd apex
#

it works in mine thopithink

lone dust
#

but i still cant use it

slate swan
maiden fable
shrewd apex
#

not intents music bot...

#

i use ffmpeg and ytdl....

slate swan
lone dust
# slate swan um, show code
intents = discord.Intents.default()
intents.members = True
#intents=discord.Intents.all()
bot = commands.Bot(command_prefix=commands.when_mentioned_or('z.', 'Z.'), description='Basic commands for Zeram', intents=intents)
bot.remove_command('help')
shrewd apex
slate swan
shrewd apex
#

just do intents=discord.Intents.all()

forest bramble
slate swan
shrewd apex
lone dust
#

i cant enable any intent right now on my dev portal

forest bramble
lone dust
#

i applied for it

shrewd apex
slate swan
#

so you can't use them either, is your bot verified or something?

shrewd apex
#

oh verified bot i think

lone dust
#

it is verified

shrewd apex
#

then wait for them to authorise till then rollback to 1.7.3

slate swan
#

Yeah so thats the issue, request for member intents first
wait for discord to approve it
then you can use it

lone dust
#

bruh

shrewd apex
forest bramble
lone dust
#

can u tell me what are the options i can use for member intent?

shrewd apex
#

umm u need intents there are no replacements?

shrewd apex
shrewd apex
#

just reinstall it it's so much easier

slate swan
#

adding to system envs is easier....

lone dust
#

yes there is a form

#

they asking me to fill the form

#

to approve my request

#

i starting working on my bot after so long

slate swan
#

then fill it pWut

lone dust
#

i didnt know they changed alot of things

shrewd apex
maiden fable
maiden fable
#

You can start, I will follow suit

slate swan
#

i already did, follow me

maiden fable
#

Nice

slate swan
maiden fable
#

Ashley

slate swan
#

at what the time's the fortnite event pWut

maiden fable
#

Uh, 13 hours

slate swan
maiden fable
#

Idk, it's gonna be 1 AM for me

#

Just subtract 5.5 hours

slate swan
#

6:30? oh

maiden fable
#

7:30

slate swan
#

same thing uhh

#

thanks though

slate swan
unkempt canyonBOT
slate swan
slate swan
#

go to ot channels or elsegrump

#

How can I create and delete channels?

slate swan
unkempt canyonBOT
#

await create_text_channel(name, *, reason=None, category=None, news=False, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., default_auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

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

Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.

The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.

Note

Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
slate swan
#

and for category's?

#

i forgot the dir so you would need to check docs

#

😔

#

noo 😭

unkempt canyonBOT
#

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

Same as [`create_text_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") except makes a [`CategoryChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.CategoryChannel "discord.CategoryChannel") instead.

Note

The `category` parameter is not supported in this function since categories cannot have categories.

Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
#

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

A shortcut method to [`Guild.create_text_channel()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild.create_text_channel "discord.Guild.create_text_channel") to create a [`TextChannel`](https://discordpy.readthedocs.io/en/latest/api.html#discord.TextChannel "discord.TextChannel") in the category.
slate swan
#

so I can just await guild.create_category ? or ctx.

#
guild = ctx.message.guild
await guild.create_category('cool-channel')

?

#

oh

lyric apex
#

How to get more than 1 choice in random.choiceQtpie

slate swan
#

How can I organize where a new channel or category will go?

paper sluice
#

!e

import random

################ 1 choice ################
print(random.choice(range(10)))

############### multiple #################
print(random.choices(range(10), k=10))
unkempt canyonBOT
#

@paper sluice :white_check_mark: Your eval job has completed with return code 0.

001 | 4
002 | [0, 3, 2, 6, 2, 3, 7, 1, 5, 2]
slate swan
#

how is it used?

paper sluice
lyric apex
#

Range

paper sluice
#

range is just an iterable...

slate swan
#

and this would go after I create the category ?

slate swan
lyric apex
#

Got itQtpie

slate swan
#

i need sleep

lyric apex
#

Sad_Cat i want to mention users in a reaction

slate swan
#
@client.command()
async def test(ctx):
    guild = ctx.message.guild
    await guild.create_category('information')
    await guild.edit(position=0)

didn't move the category. whatd I do wrong?

#

Can we move a channel to a category

#

and to move a created channel under this category?

#

Docs pls

unkempt canyonBOT
#

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

Edits the channel.

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

Changed in version 1.3: The `overwrites` keyword-only parameter was added.

Changed in version 1.4: The `type` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead...
slate swan
#

Okay

#

Thanks 👍

#

@slate swan it seems it moved the channel I create but not the category

desert cosmos
#

i am running two programs with same token everything works fine except slash commands
lets say the first program have slash commands and the 2nd one only have text commands(no slash commands)
whenever i use slash command from bot all the commands disappears after that

#

for instance when i define slash commands in second program they don't appear until the first program's any one slash command is called and when we call then all commands from first program disappears and it only shows second program's slash commands

slate swan
#
@client.command()
async def test(ctx):
    category = await ctx.guild.create_category(name="information")
    await category.edit(position=0)
    category = await ctx.guild.create_text_channel(name="info")
    await category.edit(position=0)
#

does it make that much of a difference?

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
#

oh yeah you're right

slate swan
#

welcome

desert cosmos
#

thanks

robust fulcrum
#
import discord
from discord.ext import commands

class Dropdown(discord.ui.Select):
    def __init__(self):
        options = [
            discord.SelectOption(label='Red', description='Your favourite colour is red', emoji='🟥'),
            discord.SelectOption(label='Green', description='Your favourite colour is green', emoji='🟩'),
            discord.SelectOption(label='Blue', description='Your favourite colour is blue', emoji='🟦'),
        ]
        super().__init__(placeholder='Choose your favourite colour...', min_values=1, max_values=1, options=options)

class DropdownView(discord.ui.View):
    def __init__(self):
        super().__init__()

        # Adds the dropdown to our view object.
        self.add_item(Dropdown())

class dropdown(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.command()
    async def testing(self,ctx):
        view = DropdownView()
        await ctx.send("choose",view=view)

async def setup(bot):
    await bot.add_cog(dropdown(bot))

I have the command so where to put the decorator? @paper sluice

slate swan
#

decorator?

#

that looks fine

robust fulcrum
#

@discord.ui.select

slate swan
#

dont need that...

robust fulcrum
#

I need for

slate swan
#

imagine creating class variables inside the init method pBear

#

uh?

desert cosmos
#

yeah you don't need it

paper sluice
#
import discord
from discord.ext import commands

class DropdownView(discord.ui.View):
    def __init__(self):
        # other initilzation stuff ...
        super().__init__()
        
        # Adds the dropdown to our view object.
    @discord.ui.select(placeholder='Choose your favourite colour...', min_values=1, max_values=1, options=[
            discord.SelectOption(label='Red', description='Your favourite colour is red', emoji='🟥'),
            discord.SelectOption(label='Green', description='Your favourite colour is green', emoji='🟩'),
            discord.SelectOption(label='Blue', description='Your favourite colour is blue', emoji='🟦'),
        ])
    async def callback(self, interaction: discord.Interaction, select: discord.ui.Select):
        ....


class dropdown(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.command()
    async def testing(self,ctx):
        view = DropdownView()
        await ctx.send("choose",view=view)

async def setup(bot):
    await bot.add_cog(dropdown(bot))

like that

#

@robust fulcrum

slate swan
#

get the ID of a channel by name?

slate swan
#

(edited)

slate swan
slate swan
#

smh

shrewd apex
left idol
#

can i only use *args when working with commands.ext? if it is possible, how would i use it for slash/bridge commands. i followed docs for bridge and slash but i get an error function got unexpected keyword 'arg'

left idol
#

yeah sure 1 sec

#
import discord
from discord.ext import bridge
import os
from dotenv import load_dotenv

bot = bridge.Bot(command_prefix="/")
load_dotenv()

@bot.event
async def on_ready():
    print('Ok')

@bot.bridge_command()
async def list(ctx,args):
    users = ', '.join(args)
    await ctx.send(users)

bot.run(os.getenv('TOKEN')) # run the bot with the token
#

perhaps i did not follow docs

shrewd apex
#

its *args

left idol
#

1 sec i think that was an older version

shrewd apex
#

also slash commands dont have ctx as far as ik

left idol
#

waiting for bot to restart cuz iirc i tried with *args as well but it gave me same error

shrewd apex
#

!d discord.ext.commands.Bot

unkempt canyonBOT
#

class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a discord bot.

This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.

This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.

Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), This class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
shrewd apex
#

idk abt this bridge command i have to read the docs but

async def list(ctx, *args): or (ctx, *, args)
    users = ', '.join(args)
    await ctx.send(users)
#

should work

left idol
#

yeah with *args before it gave same error
alright, lemme try

#

based on what bridge said i thought i could use it just like a slash or command

shrewd apex
#

slash commands have diffrent decorators i think not sure never tried

paper sluice
#

which lib r u using?

shrewd apex
#

but slash command dont have ctx

#

they have interaction

left idol
#

pycord

alpine pewter
#
@tasks.loop(seconds=5)
async def status():
    reference = db.reference(f"/")
    value = reference.child(client_guild_name).get()
    server_status = value["status_channel"]
    print(server_status)

For a task loop, does anyone know how would you get the guild id/name?

left idol
#

yea it gave syntax

left idol
jaunty venture
#

@paper sluice can you help with option choices in slash commands

left idol
#

and was hoping that bridge could help

shrewd apex
shrewd apex
left idol
#

yeah the slash command works

paper sluice
jaunty venture
paper sluice
#

i dont use pycord

#

but ask anyways, who knows will help you 😄

left idol
#

*, args turns all inputs into 1 string right?

alpine pewter
# shrewd apex u have to pass the name/id in the task loop somehow
@tasks.loop(seconds=5)
async def status(guild):
    client_guild_name = bot.get_guild.name
    reference = db.reference(f"/")
    value = reference.child(client_guild_name).get()
    server_status = value["status_channel"]
    print(server_status)

Do you think something like this would work?
I'm unsure if the bot.get_guild.name is even possible.

I've never really used loops.

paper sluice
shrewd apex
left idol
#

ok so can i take my input and just store it in a list and then call for it later?

alpine pewter
shrewd apex
#

even in main code u can just put task in directly and then use bot object since u have prolly declared it globally

alpine pewter
#

I think I might try it in a cog, I have it in my main to put it together.
I'm new to databases and loops, so, just a bit confusing. Might need to just pull up something on them.

Global might be a simple fix though actually, hold on. lol

slate swan
#
 raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 40060): Interaction has already been acknowledged.```any idea?
slate swan
slate swan
#

I-

#

sorry

#

How to add description to slash commands in pycord?

slate swan
#

It is at @bot.slash_command(description = "this thing")?

#

Actually nevermind it is.

#

But how do I add description to the args of slash commands?

slate swan
slate swan
#

how do i add description to that name?

slate swan
#

not sure

#

@bot.slash_command(option = [some list])?

#

That makes sense.

#

Okay, last question. How do I add like infinite args in slash commands?

#

Or it's not possible yet?

slate swan
#

Like with the tradition commands it was like ctx, *, yourargs

#

or somethn

slate swan
#

I don't really need it but just asking.

#

cuz it already supports that?

#

I need it for like umm
Let's suppose I want to make a make a /rank command which will show me the rank of everyone I mention.

#

It could be one, it could be 10,

slate swan
#

well idk haha

#

any number. How do I create a command to show that?
/rank name1: p1 name2: p2 ......

#

Okay thennnn 1 moreee question. Do you know what are message commands? Are they just what the prefix commands are?

#

!d disnake.ext.commands.Greedy

unkempt canyonBOT
#

class disnake.ext.commands.Greedy```
A special converter that greedily consumes arguments until it can’t. As a consequence of this behaviour, most input errors are silently discarded, since it is used as an indicator of when to stop parsing.

When a parser error is met the greedy converter stops converting, undoes the internal string parsing routine, and continues parsing regularly.

For example, in the following code:

```py
@commands.command()
async def test(ctx, numbers: Greedy[int], reason: str):
    await ctx.send("numbers: {}, reason: {}".format(numbers, reason))
```  An invocation of `[p]test 1 2 3 4 5 6 hello` would pass `numbers` with `[1, 2, 3, 4, 5, 6]` and `reason` with `hello`...
slate swan
#

this works on commands but idk if it will work on slash commands

slate swan
slate swan
#

Alright, thanks a lot tho' mate. You were really helpful!

#
class donations(commands.Cog):
    
    def __init__(self, client):
        self.client = client
        
    @commands.command()
    async def edonate(self, ctx, event, prize, *, msg):
        embed1 = discord.Embed(title=f"{ctx.author.name} wants to make an event donation!", description=f" \n:dot_877959363388641300:**Event:** {event} \n:dot_877959363388641300:**Prize:** {prize} \n:dot_877959363388641300:**Message:** {msg}")
        embed1.set_author(name=ctx.guild.name)
        await ctx.send(embed=embed1)


async def setup(client):
    await client.add_cog(donations(client))

command 'edonate' is not found | but i did load the cog

ashen perch
#

hey i wasnt able to find the question only so im hoping someone here might know. so im trying to find what the maximum size (in px) that an embed image can be?

jagged adder
#
          if msg.content.lower() == '&skip':
                ctx.bot.game_states[str(game_channel.id)].location = Locations.MainMenu
                ctx.bot.game_states[str(game_channel.id)].Intro_Spoken = True
                await game_channel.send("*Welcome to*\n "

this should only fire off if i type &skip right

#

because im having a problem where it appears to be firing off even if the msg isnt &skip

slate swan
#

depends on your msg variable

#

how do you define that?

jagged adder
#
msg = await ctx.bot.wait_for('message', timeout=None, check=game_check)
slate swan
#

yeah, if the message's content is &skip it should work

jagged adder
#

and if it isnt, then it should skip past right

#

because for some bizzare reason, it seems to be looping me back to that text anytime i enter a valid option, regardless of what it is

slate swan
#

thats upto your game_check function

#

what do you check in there?

jagged adder
#
    def game_check(message: discord.Message):
        return message.author == ctx.author and message.channel == game_channel and message.content.lower() in [*ctx.bot.game_states[str(game_channel.id)].valid_game_options, 'pause', 'resume', 'inv', 'inventory', 'end', '&skip']
#

hang on gotta check something

slate swan
#

this seems fine pithink

jagged adder
#

yeah; i presume its not a bug, but im not sure why its doing what its doing

slate swan
#

How do I make the button to only be clicked by a particular role?

#

are you using Button class or the @button decorator?

#

Decorator

fringe island
#

any teacher here?
have time for me and interest in guiding me?

any brother?

slate swan
heady sluice
digital mason
#

Discord is asking for verification now my bot is close to 100 users, what do you think about this

#

Should I give my id or not

slate swan
#

if you want to verify your bot, thats the only way
it needs an ID to verify that you're over 16

digital mason
#

Is there any risk

#

Talking from a privacy or legal point of view

jade tartan
#

Anyone know how to install the latest version of discord 2.0

slate swan
jade tartan
#
You should consider upgrading via the 'C:\Users\thoma\Desktop\MyBot\venv\Scripts\python.exe -m pip install --upgrade pip' command.``` do you know how to fix this
desert cosmos
slate swan
#

*--upgrade pip also, its not an error, its just a warning

desert cosmos
#

yeah it should not be a problem installing discord v2.0

jade tartan
#
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.```
desert cosmos
#

mb

slate swan
jade tartan
#

ok

desert cosmos
#

you have your python on path right ?

jade tartan
#

Well yes i am using py

slate swan
#

seems like they do, else they would never get that warning from pip while installation.

jade tartan
#

It still the same eror

#

error

desert cosmos
#

you have installed python from microsoft store ?

slate swan
#

pip install --upgrade pip

jade tartan
#

from the website it self

slate swan
#

pithink i hate microsoft for having no fixed name for python installations, sometimes its py, sometimes its python or sometimes python3

jade tartan
#
Check the permissions.```
desert cosmos
#

aah do you use vsc ?

jade tartan
#

Yes

desert cosmos
#

try using powershell

robust fulcrum
#

@paper sluice you told me to put the decorator
If i want that if someone select yes option my bot send the dm to a user provided in the command

#

How to do that?

paper sluice
robust fulcrum
paper sluice
#

show code

robust fulcrum
#

Ok

slate swan
slate swan
#

both of those work

paper sluice
#

ah right, there is also select.valueswhich returns a list

#

not select[0]

robust fulcrum
#

@paper sluice

import discord
from discord.ext import commands

class Dropdown(discord.ui.Select):
    def __init__(self):
        options = [
            discord.SelectOption(label='Send', description='send the message', emoji='✍🏻'),
            discord.SelectOption(label='Cancel', description='Cancel the message', emoji='❌'),
        ]
        super().__init__(placeholder='Choose your favourite colour...', min_values=1, max_values=1, options=options)

class DropdownView(discord.ui.View):
    def __init__(self):
        super().__init__()

        # Adds the dropdown to our view object.
        self.add_item(Dropdown())

class dropdown(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.command()
    async def testing(self,ctx,user: discord.Member = None):
        def check(msg):
            return msg.author.id == ctx.author.id and msg.channel.id == ctx.channel.id
        await ctx.send("what messaeg do you want to send?")
        mes = await self.bot.wait_for('message', check=check,timeout=20)
        view = DropdownView()
        await ctx.send("Do you want to send the message?",view=view)

async def setup(bot):
    await bot.add_cog(dropdown(bot))

I am getting this error
How to fix?

paper sluice
#

ur still using the code from yesterday

robust fulcrum
#

I forgot the changes :( sorry

#

I did code yesterday and my code not saved

#

Idk why

paper sluice
robust fulcrum
#

When

robust fulcrum
#

Do i need to put that decorator in the class?

paper sluice
#

in DropDownView, u dont need the discord.ui.Select subclass

robust fulcrum
#

@paper sluice

import discord
from discord.ext import commands

class DropdownView(discord.ui.View):
    def __init__(self):
        # other initilzation stuff ...
        super().__init__()
        
        # Adds the dropdown to our view object.
    @discord.ui.select(placeholder='Choose the option....', min_values=1, max_values=1, options=[
            discord.SelectOption(label='Send', description='Send the message', emoji='✍🏻'),
            discord.SelectOption(label='Cancel', description='cancel the message', emoji='❌'),
        ])
    async def callback(self, interaction: discord.Interaction, select: discord.ui.Select):


class dropdown(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.command()
    async def dm(self,ctx,user: discord.Member = None):
        await ctx.send("pls send the message you want to send!")
        mes = await self.bot.wait_for('message', check=check,timeout=20)
        view = DropdownView()
        await ctx.send("do you want to send message?",view=view)

async def setup(bot):
    await bot.add_cog(dropdown(bot)) 

Here is code
I am getting a EOL error
How to fix?

heady sluice
#

you didn't put anything in the callback....

robust fulcrum
#

Not for that

heady sluice
#

so are you just not going to tell

jade tiger
#
import discord

client = discord.Client()

@client.event
async def on_ready():
  print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
  if message.author == client.user:
    return 

  if message.content.startsWith('hello'):
    await message.channel.send('Hello!')

I typed this code and the I typed hello in the chat nothing seems working, also I am just a beginner to discord.py and will appreciated if someone helps. thanks in advance.

paper sluice
#

its startswith not startsWith

jade tiger
robust fulcrum
slate swan
#

is there a lib that u can scrape bots from memberlist with?

robust fulcrum
#

Like i have a variable called {mes} and {user} in my command and i any the when someone click on send option it send dm to {user} and {mes} how to?

heady sluice
#

it's hard because you have to pass the member and text to your view

robust fulcrum
#

How can I do it?

#

Ik it's hard but it's not impossible

heady sluice
#
class DropdownView(discord.ui.View):
    def __init__(self, member, text):
        # other initilzation stuff ...
        super().__init__()
        self.member_to_send_to = member
        self.text_to_send = text

class dropdown(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.command()
    async def dm(self,ctx,user: discord.Member = None):
        await ctx.send("pls send the message you want to send!")
        mes = await self.bot.wait_for('message', check=check,timeout=20)
        view = DropdownView(user, mes.content)
        await ctx.send("do you want to send message?",view=view)
#

the callback would look weird

robust fulcrum
#

Hmm

robust fulcrum
#

Can you tell once it would be helpful to me

heady sluice
#

where the value that was chosen is stored inside self.values

#

yes

#

!d discord.VoiceChannel.send now exists

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

Sends a message to the destination with the content given.

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

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

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

and more

slate swan
#

And don’t mind me replying late

#
@commands.command()
    async def edonate(self, ctx, event, prize, *, msg):
        button1 = Button(label="Cancel", style=discord.ButtonStyle.red, emoji=":cross8:")

        async def button_callback(interaction):
            if interaction.button.label == "Cancel":
                await interaction.response.send_message(f"{ctx.author.mention} your donation has been denied by {interaction.user.mention}")
            if interaction.button.label == "Claim":
                await interaction.response.send_message(f"{ctx.author.mention} your donation has been accepted by {interaction.user.mention}")
        embed1 = discord.Embed(title=f"{ctx.author.name} wants to make an event donation!", description=f" \n:dot_877959363388641300:**Event:** {event} \n:dot_877959363388641300:**Prize:** {prize} \n:dot_877959363388641300:**Message:** {msg}", color = discord.Colour.random())
        embed1.set_author(name=ctx.guild.name)
        await ctx.send(embed=embed1)
#

!d discord.ui.View.interaction_check

unkempt canyonBOT
#

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

A callback that is called when an interaction happens within the view that checks whether the view should process item callbacks for the interaction.

This is useful to override if, for example, you want to ensure that the interaction author is a given user.

The default implementation of this returns `True`.

Note

If an exception occurs within the body then the check is considered a failure and [`on_error()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.ui.View.on_error "discord.ui.View.on_error") is called.
slate swan
#

@slate swan ^ use this

#

If I want people to enter args in a fixed way. How do I do that?
Like /test arg1: key1 arg2: key2 ...

#

Not /test arg2: key1 arg5: key2 ...

#

Also, what are those messages called which are dismissable and only visible to the person who used the command?

slate swan
slate swan
slate swan
slate swan
#

sorry....

heady sluice
#

pycord moment

slate swan
heady sluice
#

EW

slate swan
slate swan
#

better switch to disnake or nextcord, thry are the same; but disnake's examples are better and updates are pushed earlier than py-cord, their last update to the lib was 5 days ago

#
from disnake.ext import commands

bot = commands.Bot() #all arguments are optional

@bot.slash_command()
async def test(inter: disnake.CommandInteraction):
    ...```
same
heady sluice
#

much better

#

it has errors

#

but at least no uwu command

slate swan
#

.ext uhh

heady sluice
#

comands

slate swan
#

I'm gonna sound like a psycho, but consider hikari

slate swan
slate swan
slate swan
slate swan
# slate swan yeah

Alright 👍
By the way, the GitHub in yout bio is probably ded. Link ain't loading.

#

sigh

#

thats why they shit on app commands

#

said that multiple times

heady sluice
#

I still won't use Client

#

bot has a CommandTree by default

#

but why do y'all use client.start now

#

so you can run 2000 bots in one script

mossy jacinth
#

shouldnt this work?

I want the bot to send the video link whenever the user with the ID says something

slate swan
#
from disnake.ext import commands
import disnake

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

bot = commands.Bot(intents=intents)

@bot.slash_command(name="test", description="...", guild_ids=[]) #if no guild_ids are specified, the command is globalized
async def _test(inter: disnake.CommandInteraction):
  await inter.response.send_message("...", ephemeral=True)

bot.run("TOKEN")
visual island
#

This is for the description (both command and params)
Disnake:

@bot.slash_command()
async def give_cookies(inter: disnake.ApplicationCommandInteraction, disnake.User, amount: int = 1):
    """
    Give several cookies to a user

    Parameters
    ----------
    user: The user to give cookies to
    amount: The amount of cookies to give
    """
    ...

Discord.py

@client.tree.command()
@app_commands.describe(
    user='The user to give cookies to',
    amount='The amount of cookies to give',
)
async def give_cookies(interaction: discord.Interaction, user: discord.User, amount: int = 1):
    """Give several cookies to a user"""
    ...
slate swan
#

lmao

visual island
maiden fable
#

Cause two issues

#

String and not accessing ID attr

#

BTW @visual island did u see andy's solution

visual island
#

yep

#

Sadly it didn't work well with instance/class methods

maiden fable
#

That sucks

slate swan
#

Can bots add and read notes on user?

vocal plover
#

no

#

why would they need to? bots dont need discord to remember things, thats what a database is for

slate swan
#

Just could come in handy

#

how-

#

Is there a place to hire someone to make a bot?

slate swan
# slate swan how-

like you could store small data on notes for a particular user, like his settings for the bot without creating an additional file

slate swan
slate swan
nimble plume
#

Hi

#

I'm hi

slate swan
slate swan
nimble plume
#

It will not work

slate swan
nimble plume
#

we don't start var with numbers because it can be written normally

#

and it will raise invalid syntax

#

also if we hover to the id attribute it show literal int

#

Hence proved it is int

#

so u need to remove the quotes

#

so it's a integer

#

and it will work fine

slate swan
slate swan
nimble plume
#

!e
1a = 2
print(1a)

unkempt canyonBOT
#

@nimble plume :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     1a = 2 
003 |     ^
004 | SyntaxError: invalid decimal literal
nimble plume
#

See error

slate swan
#

uh?

nimble plume
#

U didn't read my msg properly

slate swan
#

I did, that's why I said that it's wrong

nimble plume
hasty jay
#

which api are you guys using for selfbot

nimble plume
#

I'll report you

#

using self bot

#

against tos

hasty jay
#

ok

nimble plume
#

we will not help so don't except help

#

expect*

hasty jay
#

alright

nimble plume
#

ok u can go now

#

Thanks

nimble plume
slate swan
#

!e

class Member:
  cvar = 2
  def __eq__(self, other):
    return self.cvar == other

_ = Member()
print(_ == "uwu")
unkempt canyonBOT
#

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

False
slate swan
#

^

#

doesnt raise a syntax error

nimble plume
#

I said numbers

#

integers

slate swan
nimble plume
#

🤦‍♂️

slate swan
#

...? that's what you wrote

nimble plume
tropic flame
#

guys

nimble plume
#

Yes