#discord-bots

1 messages · Page 629 of 1

tawdry perch
#

they are logged to mods channel

slate swan
#

Guys, i'm making a discord bot with python, how i check if have a None value in an array?

cedar stream
maiden fable
#

activity=None

tawdry perch
maiden fable
slate swan
cedar stream
#

If None in list mby

sullen shoal
#

another way should be, yes that ^

cedar stream
#

Try this, otherwise u have to write a for loop

maiden fable
#

Nvm yea

slate swan
#

i can give a example wait

maiden fable
#

That's a faster way. Sorry

cedar stream
#

Try something like this

slate swan
maiden fable
#

Code

cedar stream
#

Not sure tho

tawdry perch
#

breh I have most of commands for modeation that mee6 has

cedar stream
sullen shoal
#

mee6sux

tawdry perch
#

but the fact is @unkempt canyon > than other mod bots

cedar stream
quick gust
slate swan
#

THE BEST EXAMPLE FOREVER

someSplitList = message.content.split(' ')
command = someSplitList[0]
firstArg = someSplitList[1]
if firstArg == None:
   await message.channel.send('You need mention a user!')
cedar stream
slate swan
slate swan
velvet tinsel
slate swan
cedar stream
tawdry perch
#

now I got a command idea: a note command

slate swan
velvet tinsel
#

I don’t know how to help so I’m gonna sit back and watch this

sullen shoal
cedar stream
tawdry perch
#

lol

velvet tinsel
cedar stream
tawdry perch
sullen shoal
#

though editing is gonnn be pain but i think i can do sometthing about that

slate swan
slate swan
cedar stream
slate swan
velvet tinsel
tawdry perch
#

there are few more but these are main commands

slate swan
#

I would like to understand if it is possible to check if there really is this value in the table

cedar stream
tawdry perch
#

nah, I'm looking for useful ideas

tawdry perch
#

You may notice it's focused on moderation

meager chasm
cedar stream
slate swan
#

helppy await client.change_presence(activity=None)not working

cedar stream
cedar stream
slate swan
tawdry perch
cedar stream
maiden fable
velvet tinsel
slate swan
slate swan
tawdry perch
velvet tinsel
#

Ok

tawdry perch
cedar stream
velvet tinsel
#

Spam checker

tawdry perch
#

Exists

maiden fable
velvet tinsel
#

F

cedar stream
velvet tinsel
#

What’s the problem?

cedar stream
#

Lmao mby u can make direct request to api

slate swan
# tawdry perch Autorespond?

When someone say the name of an admin, bot will send a message which is like```
Person: Blank

Bot: He is the one who suggested this function

Person: Yea!```

cedar stream
velvet tinsel
#

You’re not dumb

slate swan
#

i have to use await?

cedar stream
slate swan
velvet tinsel
cedar stream
slate swan
slate swan
cedar stream
velvet tinsel
slate swan
slate swan
tawdry perch
velvet tinsel
#

What do you need Blank?

cedar stream
slate swan
#

This is kinda ot ngl

velvet tinsel
velvet tinsel
cedar stream
slate swan
cedar stream
slate swan
cedar stream
#

Make a direct api call

#

Look in discord dev portal docs

velvet tinsel
slate swan
velvet tinsel
#

I wish there was a rerun command in discord py

#

😭

cedar stream
#

Wdym rerun?

velvet tinsel
#

You can make a function and run the first function and after some time run the other function

cedar stream
#

Cant u?

#

What?

velvet tinsel
cedar stream
#

Okok

velvet tinsel
slate swan
cedar stream
#

Use disnake

slate swan
#

Use disnake

#

@cedar stream bro?

sullen shoal
#

disnake Use

cedar stream
#

Yes

slate swan
cedar stream
#

Not anymore

velvet tinsel
#

Yes looked it up on GitHub

slate swan
velvet tinsel
#

They didn’t provide enough info

cedar stream
#

What did u find?

slate swan
velvet tinsel
#

Myb that

slate swan
velvet tinsel
#

Idk

slate swan
velvet tinsel
slate swan
velvet tinsel
#

💀

#

Idk

#

I don’t know how to remove bot presence

#

I guess you can’t 🤷‍♂️

cedar stream
cedar stream
velvet tinsel
slate swan
#

Or just do:
pip install system64

#

😳

velvet tinsel
cedar stream
#

Or just do sudo rm -rf .

velvet tinsel
#

You have to use the make it work function

slate swan
velvet tinsel
cedar stream
#

Just brick the computer

slate swan
cedar stream
slate swan
velvet tinsel
#

Before that kick it

#

And use your tools of torture

cedar stream
#

And rm -rf

slate swan
#

And make it explode

cedar stream
#

Sudo explode

sick talon
#

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

abstract kindle
#

How would I stop a specific command from raising an error?

sick talon
slate swan
#

Its a fork and its all the same syntax

abstract kindle
#
        elif isinstance(error, commands.CheckFailure):
            rightchannel = self.bot.get_channel(912978002332221470)
            if str(ctx.command) == 'register':
                await ctx.send(f"Please use {ctx.command} in {rightchannel.mention}.")
            elif str(ctx.command) == 'deleteaccount':
                return
            else:
                await ctx.send(f"Only registered users can use {ctx.command} in {rightchannel.mention}.")
sick talon
#

wdym ?

#

the path of the db ?

abstract kindle
#

In the middle if statement, I'm trying to make it so if the command is named 'deleteaccount', it won't bring up the error

slate swan
#

Not a bare except btw*

#

Yeah its all the same you just have to change discord to disnake

sick talon
#

wdym by path of the command pithink

slate swan
#

its:

except discord.Forbidden:
abstract kindle
#

@slate swan would I do ```py
try:
ctx.command
except commands.CheckFailure:
pass

#

Mainly wondering about how I would try the command, like the syntax for that

sullen shoal
#

make an error handler instead

boreal ravine
#

ctx.command is the command object afaik

abstract kindle
#

Scroll up @sullen shoal

sullen shoal
#

my answer remains the same

abstract kindle
#

cool

slate swan
#

Yeah i think so

#

Im not really familiar with slash commands

#

I do know how to make them bot im not good with thempithink

cedar stream
#

Yes

slate swan
#

Disnake?

cedar stream
#

In cogs u use commands.slash_command

jade jolt
#

how do i get a message then get the context for that message

cedar stream
slate swan
#

for a cog its always@commands.command()iirc

jade jolt
#

need to get a message i sent for the bot to edit inside a loop

cedar stream
#

u can do message.edit

#

No need for ctx

#

Did u register test guilds?

slate swan
#

Did you added the cog?

jade jolt
boreal ravine
unkempt canyonBOT
#

await get_context(message, *, cls=<class 'discord.ext.commands.context.Context'>)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Returns the invocation context from the message.

This is a more low-level counter-part for [`process_commands()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.process_commands "discord.ext.commands.Bot.process_commands") to allow users more fine grained control over the processing.

The returned context is not guaranteed to be a valid invocation context, [`Context.valid`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context.valid "discord.ext.commands.Context.valid") must be checked to make sure it is. If the context is not valid then it is not a valid candidate to be invoked under [`invoke()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.invoke "discord.ext.commands.Bot.invoke").
cedar stream
jade jolt
#

no

#

i have the id for it, i need to get the message from it

cedar stream
jade jolt
#

thank you 😃

cedar stream
#

Send ss of the cog

cedar stream
#

Yes

slate swan
#

!d discord.abc.Messageable.fetch_message

unkempt canyonBOT
#

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

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
slate swan
#

It's part of the 1.x migration.

cedar stream
slate swan
#

You can't.

#

Search the documentation by yourself.

cedar stream
#

Did u install disnake?

slate swan
#

Got replaced for a reason on discord.py - don't get it why they would add it again, but whatever

cedar stream
#

Yes he is asking for disnake 😂

#

Cant u see red underlined stuff?

slate swan
#

Yet they still kept the migration

#

Got to love disnake developers 🤡

cedar stream
#

Are u in venv?

slate swan
cedar stream
slate swan
cedar stream
#

Virtual environment

slate swan
#

Or do they have an API?

cedar stream
slate swan
cedar stream
#

Are u installing disnake in virtual environment

slate swan
#

It's Discord's API

slate swan
#

Has nothing to do with disnake

cedar stream
slate swan
#

The API is what Discord provides

cedar stream
slate swan
#

disnake is an API wrapper, totally not the same

cedar stream
#

What do u think it is

slate swan
#

Might want to check the definitions and difference between both of them.

cedar stream
slate swan
#

Disnake isnt a api its an api wrapper for the discord api

#

I'm making an API myself I'm pretty sure I know what it means..

cedar stream
slate swan
#

disnake interacts with Discord's API

#

Nothing more

cedar stream
slate swan
slate swan
#

Last night you told me i didnt while i know plenty about apis

#

Let me join their support server and ask that.

cedar stream
slate swan
#

Will come back

cedar stream
#

Go ahead

#

Are u in a virtual environment?

slate swan
#

Pip should be installed with python

#

If you cant use it,its not in the environment variables

#

Wdym by run pip

valid galleon
#

is there any method to get the id of the person who added the bot to the server? i want to send them a message and also the guild owner a message referring to the bot's setup process so yeah

#

try py -m pip install

cedar stream
slate swan
#

He needs to check if pip is in the environment vars

slate swan
# cedar stream Find out anything?

I've asked about it although I know the answer and will be taken for a clown in the server.
I will get back to you once I got the expected answer, to then make you check the definition of an API and an API wrapper again.

valid galleon
#

oh

slate swan
#

You go the your computers environment variables

cedar stream
slate swan
#

No you need to do that.

slate swan
valid galleon
cedar stream
slate swan
#

If you've never made any REST or websockets API I wouldn't ask people that do it to check what's the difference between an API and an API wrapper is.

cedar stream
slate swan
#

Were talking about an api:
Application programming interface

#

disnake is an API wrapper only as it only communicates with Discord's API.

#

Without Discord's API, disnake is nothing.

sick talon
#

how to get guild id inside a task ?

cedar stream
valid galleon
#

it connects to the discord API

#

it doesnt have its own api

cedar stream
#

Not rest service

cedar stream
valid galleon
slate swan
valid galleon
#

d.js is also an api wrapper

cedar stream
slate swan
#

Hey there! i was wondering how can i re-create the
pls fight command from dank memer but in py
can anyone help me out?

sick talon
cedar stream
slate swan
#

Technically i get his point, but for the sake of simplicity nah

cedar stream
slate swan
#

And i wouldnt really call that an api, because its not another application interacting with it

sick talon
slate swan
#

Disnake is a api wrapper for the discord api can you guys get it?

cedar stream
#

Lemme give yall an article

valid galleon
#

it doesnt need its own api

cedar stream
#

It clearly explains what an api is

slate swan
slate swan
#

The API is provided by Discord.

#

So what application is interacting with disnake?

cedar stream
#
MuleSoft

What is an API? (Application Programming Interface) API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API. What exactly is an API? Finall...

slate swan
#

Python interpreter?

cedar stream
slate swan
#

@cedar stream i think for you a api is this:
A pool in a beach

#

My god

velvet tinsel
cedar stream
#

It can be a piece of software

slate swan
#

You don't get it do you?

slate swan
cedar stream
#

Read this pls

viral citrus
#

Is someone able to tell me how to retrieve permissions from the permission integer returned by discord api?
Example: 2147483647
I want to get if the person has manage_guild
https://ibb.co/BLJ7D2L
https://discord.com/developers/docs/topics/permissions

Image image hosted in ImgBB

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

slate swan
slate swan
cedar stream
slate swan
#

The first sentence is enough.

velvet tinsel
#

I'm back

slate swan
#

No its not

velvet tinsel
#

what happened

slate swan
cedar stream
slate swan
#

Try repairing python with its setup

cedar stream
slate swan
#

Guys please stop

#

This is getting out of hand

sick talon
#

how to get the guild_id inside a task ?

cedar stream
#

Ping someone who is senior software engineer pls

#

Let them tell

slate swan
# cedar stream Read everything

APl (Discord's API) is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other (Discord and disnake).

disnake is not an API. It's not rocket science my guy...

#

^^^

#

Its a wrapper for the API u use it to simplify interacting with discord API

slate swan
cedar stream
jade jolt
#

is there a way to get the message using its id? i need to get it after the bot restarts, please help

slate swan
#

And discord is the API

cedar stream
#

Idc if library is api wrapper or some other shit, it has an api

#

Datetime library has an api

twin moon
#

username = await client.wait_for('message', check=lambda message: message.guild == None, message.author == ctx.author,timeout = 120)

username = await client.wait_for('message', check=lambda message: message.guild == None, message.author == ctx.author,timeout = 120)
                                                                                                                                       ^
SyntaxError: positional argument follows keyword argument```
cedar stream
#

Like

slate swan
#

Would you like to join disnake's server? @cedar stream

#

They wil explain to you.

cedar stream
slate swan
#

Contributors and members.

#

When you're the only one thinking disnake has its API and everyone says otherwise maybe it's time to stop being stubborn and accept you're wrong.

cedar stream
#

Here

#

Read pls

slate swan
sick talon
#

lemon_angrysad who to get the guild_id inside a task

unkempt canyonBOT
#

Here's how to format Python code on Discord:

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

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

slate swan
#

Its stackoverflow

velvet tinsel
jade jolt
#

i think he means how

sick talon
slate swan
#

You are not an application, if you consider ur code the application interacting with it maybe technically u have a point. But for the sake of simplicity nah, its not api

cedar stream
slate swan
#

Look the second comment. It exactly shows you're wrong. Don't look at the first comment only...

#

Yeah im leaving

velvet tinsel
cedar stream
slate swan
#

Your operating system has an API

jade jolt
#

?? can i get some help please

cedar stream
#

Ty

slate swan
#

But the key thing that makes something an API

#

Whatever, I give up. Stubborn people will stay stubborn.

cedar stream
slate swan
#

Is an application interacts with it

velvet tinsel
cedar stream
velvet tinsel
#

Are we arguing over what an API is now?

cedar stream
#

Like api is just a contract

slate swan
#

A graphics driver API, as example, has nothing similar with disnake.

#

Im going to call mods if you guys keep with this bs

cedar stream
sick talon
twilit dragon
#

how to compile a python code

jade jolt
slate swan
#

Join disnake's server and you will get another confirmation that you're wrong.

slate swan
velvet tinsel
#

"API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you're using an API."

sullen shoal
#

why whenever blocked messages appear theres an argument going on

#

i wonder who that person is

slate swan
velvet tinsel
slate swan
#

Now staying stubborn is your problem not mine anymore CS_pepeclown

jade jolt
slate swan
#

I will come back later, y'all have a great time

slate swan
velvet tinsel
slate swan
cedar stream
velvet tinsel
slate swan
#

Bruh u cant argue disnake is an api and then bot is not software lmao

cedar stream
slate swan
cedar stream
#

Do we agree?

cedar stream
#

Is disnake a library?

slate swan
#

Like i said im done wiv u

cedar stream
cedar stream
final iron
velvet tinsel
#

It is an API

jade jolt
#

wrapper ^

slate swan
#

[...] wrapper

velvet tinsel
#

@slate swan you’re correct

#

Wait I forgor

cedar stream
velvet tinsel
#

I don’t even know what’s happening 😂

#

I’m gonna send random links and hope people shut up

slate swan
rain apex
#

!silence

unkempt canyonBOT
#

✅ silenced current channel for 10 minute(s).

rain apex
#

while teaching the difference between an API, a wrapper and an application is rather important, there are ways to do it and ways to not do it

rain apex
#

Let's keep this chat friendly, please

#

!unsilence

unkempt canyonBOT
#

✅ unsilenced current channel.

jade jolt
#

hey

tardy glacier
#

lolwtf

jade jolt
#

still needing help with my question

slate swan
#

Just let us speak we wanna do it or way

velvet tinsel
#

Over the past three days

cedar stream
velvet tinsel
slate swan
#

Im done with this server, we having conversation and jannies get involved and adds nothing of value

velvet tinsel
#

Ok bye

rain apex
cedar stream
#

Cya

velvet tinsel
cedar stream
sick talon
#

How to get guild id inside a discord task ? pithink

velvet tinsel
#

I honestly don’t know sarcasm intended

slate swan
rain apex
#

disnake has an api, yes

#

any library has an api

cedar stream
rain apex
cedar stream
velvet tinsel
rain apex
#

gosh

#

!silence

unkempt canyonBOT
#

✅ silenced current channel for 10 minute(s).

rain apex
#

!ban 788098387354452060 You are right, you should indeed leave the server. Your conduct has been flagged many many times as being one of the main reason this channel is toxic, and when asked to drop a heated argument you menace to leave the server and just start pseudo-insulting everyone? I don't think you are a good fit for this server, and its mentality

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @normal viper permanently.

rain apex
#

!mute 562359123086409729 4d Is it too hard to drop an argument, especially just after a mod tells you to? Perhaps the original statement was different, but it isn't a reason to react so aggressively. If an argument gets heated, just take a small break from Discord. There is no need to reply with bold messages just to say that there is a difference between being and having an API. Explaining slowly and calmy is the key of teaching. Please re-read our #code-of-conduct.

unkempt canyonBOT
#

failmail :ok_hand: applied mute to @slate swan until <t:1638282085:f> (3 days and 23 hours).

rain apex
#

!unsilence

unkempt canyonBOT
#

✅ unsilenced current channel.

tawdry perch
#

is this 4th time this channel was silenced in 24h?

tardy glacier
#

yes

brave vessel
#

.topic

lament depotBOT
#
**Do you think there's a way in which Discord could handle bots better?**

Suggest more topics here!

velvet tinsel
#

Damn

restive jolt
#

fine grained slash commands permissions

boreal ravine
brave vessel
restive jolt
#

both.

tawdry perch
#

any ideas to discord bot commands, I'm again running out of them, mainly moderation

velvet tinsel
#

That’s what I’m working on 🤷‍♂️

boreal ravine
velvet tinsel
#

616 lines of code I’m not even finished

minor totem
restive jolt
velvet tinsel
#

I’m very stupid at anime so I had to join a anime discord server to ask for characters to add to my discord bot

boreal ravine
velvet tinsel
tawdry perch
# velvet tinsel Economy bot?

well.. I don't find them useful at all, especially not for my bot. That feature is semi nice but takes a lot of work, like a lot

boreal ravine
#

^^

slate swan
velvet tinsel
tawdry perch
#

my original idea was to find some moderation commands

slate swan
boreal ravine
minor totem
velvet tinsel
boreal ravine
sullen shoal
sullen shoal
#

simple and useful sometimes

minor totem
tawdry perch
velvet tinsel
#

Add users to a list and ping a mod whenever one of them comes in

tawdry perch
#

what?

cedar stream
marble cradle
slate swan
boreal ravine
#
bot.run()
``` ^^ you did something like this
bitter depot
#

@slate swan you probably did bot.run(os.getenv('token')) but the env value wasn't found. Make sure you do load_dotenv() before the os.getenv()

boreal ravine
bitter depot
# boreal ravine O
>>> def bot(token):
    pass

>>> bot()
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    bot()
TypeError: bot() missing 1 required positional argument: 'token'```this would be the error for not passing it
tawdry perch
#

I made a some sort of filter for invite links but it sometimes deletes attachments as well ```py
@commands.Cog.listener()
async def on_message(self, message):
invite_is_https = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', message.content.lower())
invite_is_discord_gg = re.findall('discord.gg/(?:[a-zA-Z]|[0-9]|[$-
@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', message.content.lower())
if message.author.bot:
return
if invite_is_https or invite_is_discord_gg:
log.warning(f"Invite sent in {message.channel} by {message.author}")
await message.delete()
await message.channel.send("Please don't send random invites")

boreal ravine
bitter depot
tawdry perch
#

oh ...

boreal ravine
#

every image uploaded

#

is uploaded onto cdn i think whatever discord's database is

tawdry perch
#

damn

bitter depot
boreal ravine
#

^^

bitter depot
#

Wait yeah, it's just because of invite_is_https I think

tawdry perch
#
INVITE_RE = re.compile(
    r"(discord([\.,]|dot)gg|"                     # Could be discord.gg/
    r"discord([\.,]|dot)com(\/|slash)invite|"     # or discord.com/invite/
    r"discordapp([\.,]|dot)com(\/|slash)invite|"  # or discordapp.com/invite/
``` seems like @unkempt canyon has this
boreal ravine
tawdry perch
boreal ravine
#

o

tawdry perch
#

there was some sort of converter online that worked

boreal ravine
#

what is it

tawdry perch
#

not sure, it's somewhere in my code or in my search history

sick talon
#

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

boreal ravine
tawdry perch
#

how am I supposed to find it if I don't remember the name

#

I might know 1 but it's not the one i used

#

nope can't find it

boreal ravine
#

bruh

slate swan
#

my bot cant play music

tawdry perch
#

!ytdl

unkempt canyonBOT
#

Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:

The following restrictions apply to your use of the Service. You are not allowed to:

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
tawdry perch
#

we won't help you on that

boreal ravine
#

😌

slate swan
#

do you have problem with that ?

#

no, but we won't help you cuz rule 5 music bots are against the yt tos

slate swan
boreal ravine
sullen shoal
#

usually used to say "i dont give a fuck"

boreal ravine
boreal ravine
sullen shoal
#

im not the one who said that, they asked what it meant so i answered

sick talon
#

why doesn't my bot's setup commands work in other servers pithink

#

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

twilit dragon
#

how to compile file

#

code*

sullen shoal
sick talon
twilit dragon
sullen shoal
#

a discord guild cant compile code

twilit dragon
#

!run n = 0

for n in range(100):
n += 1
print("numbers", (n))

sick talon
cedar stream
sick talon
cedar stream
#

Can u paste the whole code

sick talon
#

ok

cedar stream
#

Ok so first of all, creating a connection to database is an expensive operation, you shouldnt be doing it every time you want to interact with db, rather use connection pooling

#

Does it work if you just do setup?

sick talon
cedar stream
#

Also try putting bot = commands.Bot(command_prefix=“mo”)

cedar stream
sick talon
#

ok i am dumb af, so i have a test bot where i test the new features and all the things and apparently both the bots have same pfp and username so i got confused
i am sorry @cedar stream

twilit dragon
maiden fable
twilit dragon
#

ok thx

cedar stream
#

U will install it in an isolated environment

dusk dust
#

how can i remove user's reaction after he clicks?

gloomy coral
#

guys i fucking hate my life

#

^

#

the bot isnt running 2 instances but idk abt the cog.....

maiden fable
unkempt canyonBOT
#

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

Remove a reaction by the member from the message.

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

If the reaction is not your own (i.e. `member` parameter is not you) then the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission is needed.

The `member` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
gloomy coral
#

help me pls

sullen shoal
twin moon
#

how do I search a json files list inside of an object

maiden fable
twin moon
sullen shoal
#

what list

twin moon
#

without going through all of them

sullen shoal
#

show me the list show me the object

twin moon
#
"POR_G1": {
    "username": "POR_G1",
    "password": "OTTERS",
    "creator": "770210759359070209",
    "level": {
      "experience": 0,
      "level": 0
    },
    "economy": {
      "money": 0,
      "bank": 0,
      "inventory": {}
    },
    "login": [          HERE
      770210759359070209
    ]
  }```
sullen shoal
#

what do you need from here

twin moon
#

see it

#

if there are lots of these

#

how do I see that list

sullen shoal
#

the login list?

slate swan
sullen shoal
#

!e

d = dict(foo=None, login=[1,2,3,4])
print(type(d.get("login")))```
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

<class 'list'>
sullen shoal
#

it will return the object that is set as the value of the key

gloomy coral
slate swan
#
line 74, in check_if_member_blacklisted
    if any([role for role in member.roles if await DBmanager.check_is_blacklisted(role)]):
AttributeError: 'User' object has no attribute 'roles'```
any idea why i get this error , i already typehinted the member variable as disnake.Member ```py
async def check_if_member_blacklisted(message , member : Member):```
gloomy coral
maiden fable
sullen shoal
#

a key value pair

gloomy coral
gloomy coral
#

just check the src code

sullen shoal
#

so 2 minutes

gloomy coral
twin moon
gloomy coral
#

no its 2 seconds right?

maiden fable
sullen shoal
#

oh

tawdry perch
#

What's snowflake?

sullen shoal
#

the loop is 60 seconds tho

gloomy coral
#

yeah

sullen shoal
maiden fable
tawdry perch
#

So nothing useful or.?

maiden fable
#

It can be a string also iirc

tawdry perch
#

Where's it used at

sullen shoal
twin moon
twin moon
#

and commonly

sullen shoal
maiden fable
#

If I remember correct @gloomy coral

sullen shoal
#

you may ask anyone present here to verify that, what i said is English

maiden fable
#

;-; VSCode doesn't open up console even when I press F5

gloomy coral
maiden fable
#

kk

sullen shoal
gloomy coral
twin moon
tawdry perch
gloomy coral
maiden fable
gloomy coral
tawdry perch
#

It could be used to create identification?

sullen shoal
maiden fable
gloomy coral
gloomy coral
tawdry perch
sullen shoal
maiden fable
gloomy coral
tawdry perch
#

Hmm

gloomy coral
#

@tawdry perch

tawdry perch
#

?

twin moon
tawdry perch
#

Ohh I see

gloomy coral
#

enable dev mode

tawdry perch
#

I have it enabled

sullen shoal
gloomy coral
#

then copy it of this msg

gloomy coral
tawdry perch
#

Ye I now understood what that is, thx!

sullen shoal
gloomy coral
#

well i dont want tht

sullen shoal
#

for testing

twin moon
gloomy coral
#

i just want it to send msg every 12 hours at a time

twin moon
#
d = dict(foo=None, login=[1,2,3,4])
print(type(d.get("login")))```
gloomy coral
gloomy coral
#

but ok.....

twin moon
#

I put it in a disc bot

sullen shoal
#

the d variable

sullen shoal
velvet tinsel
#

I nearly died

#

That was so close

sullen shoal
#

nice

#

@gloomy coral if nextcord uses 2.0, you could just use the tasks.Loop.time param

#

!d discord.ext.tasks.Loop.time

unkempt canyonBOT
#

property time: Optional[List[datetime.time]]```
Read-only list for the exact times this loop runs at. `None` if relative times were passed instead.

New in version 2.0.
velvet tinsel
#

Oh yes I need to read the !d code for @unkempt canyon

tawdry perch
#

good idea

#

!src d

unkempt canyonBOT
#
Command: docs

Look up documentation for Python symbols.

Source Code
velvet tinsel
#

Ty

sullen shoal
#

easy to do

flint cosmos
#

Can somebody help me here ?

velvet tinsel
#

Something is None

flint cosmos
velvet tinsel
#

I suck at explaining

boreal ravine
#

isnt this betterdiscord?

velvet tinsel
#

Kayle my fingers are cold relieve me

minor panther
#

Guys how to make load_extention is cogs

#

after bot.run

somber tree
#

Guys i need help making commands for my discord bot

#

because I want to make a bot linked to my geometry dash private server

velvet tinsel
#

I think

minor panther
#

and after load this

velvet tinsel
minor panther
boreal ravine
velvet tinsel
minor panther
#

yes

somber tree
minor panther
#

i have some problems with cache

velvet tinsel
#

@boreal ravine will it work to run code after bot.run?

boreal ravine
velvet tinsel
#

Or whatever run()

minor panther
#

and i have to use cogs only after the cache will be filled

velvet tinsel
boreal ravine
minor panther
#

no

#

run is freeze func

patent surge
#

How do I get invite link of a server ?

velvet tinsel
#

No run is looping everything with the lack of a better word

velvet tinsel
somber tree
patent surge
velvet tinsel
patent surge
#

when it joins a server

flint cosmos
boreal ravine
patent surge
somber tree
boreal ravine
#

ah do you have a database?

somber tree
#

yes

somber tree
boreal ravine
somber tree
#

GMD Private server

#

database.sql

#

I think it's better to talk about the database is the database text channel

boreal ravine
#

hm yes, but i have no experience with sql lmfao

flint cosmos
# patent surge through the bot

To get the bot invite, go to your Discord developer portal,
Go to OAuth2 tab,
Copy the Client ID,
Go here https://discordapi.com/permissions.html#0
Paste the Client ID into the box towards the bottom of your screen that is labeled "Insert Client ID here"
Check off all of the permissions you want the bot to have on the server
Copy the link at the very bottom

tawdry perch
#

is this something that exists in dpy? ```py
self.bot.http_session

tawdry perch
#

that is smth that would take me for ever

gloomy coral
#

welp

boreal ravine
gloomy coral
#
import nextcord
import asyncio
import csv
from nextcord.ext import commands, tasks
from datetime import datetime
import os
from pytz import timezone

indian_tz=timezone('Asia/Kolkata')
class Loops(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        self.checkVoteTime.start()
        self.csv_update.start()
        self.statusandfiles.start()
    

    @tasks.loop(minutes=2,time=[indian_tz.localize(datetime.strftime("08 30", "%H, %M")),indian_tz.localize(datetime.strftime("20 30", "%H, %M"))])  
    async def checkVoteTime(self):
        await self.bot.wait_until_ready()
        channel = self.bot.get_channel(880639248292798465)
        vote = nextcord.Embed(title="This is your reminder", description="You better vote for me, here and now", color=nextcord.Color.random())
        vote.add_field(name="1", value=f"[top.gg](https://top.gg/bot/864010316424806451/vote)")
        vote.add_field(name="2", value=f"[discordbotlist.com](https://discordbotlist.com/bots/chad-6621/upvote)")
        vote.set_thumbnail(url="https://i.imgur.com/QICgRpf.png")
        await channel.send(embed=vote, content="<@&881209363077943326>")```
#

will this work @sullen shoal

tawdry perch
#

aight, but do you mind to link me the src?

boreal ravine
tawdry perch
#

let me try to find the github repo

unkempt canyonBOT
tawdry perch
opal skiff
#

how do i send an embed?

boreal ravine
#

!d discord.Embed

unkempt canyonBOT
#

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

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

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

New in version 2.0.

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

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

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

Sends a message to the destination with the content given.

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

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

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

ok

gloomy coral
opal skiff
boreal ravine
flint cosmos
#

Can somebody help me? I am trying to create a variable that represents a role but it seems im getting errors
My error/python file: https://paste.ee/p/x1xQ6

somber tree
#

What is the coding for making commands?

opal skiff
#
client = discord.Client()
@client.event
async def on_ready():
    print(f'{client.user} has connected to Discord!')

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    if message.content == "T!help":
        await message.channel.send(embed = Embed)
        
client.run(TOKEN)``` There is something wrong
flint cosmos
# somber tree What is the coding for making commands?
import discord
from discord.ext import commands

client = commands.Bot(command_prefix="!") # you can customize your prefix here

@client.command()
async def commandName(ctx): # whatever this function is named is the name of your command
  await ctx.channel.send("Test command") # everything inside of the function gets ran when you execute the command on your discord server
sullen shoal
velvet tinsel
#

Lmao 😂

opal skiff
#

ik

#

i fixed it now

velvet tinsel
#

And why did you call it Embed call it anything BUT Embed

#

It’s bad kinda 😐

slate swan
#

is on_disconnect triggered even if we manually stop the bot's script file?

sullen shoal
#

wdym by manuallly stopping

opal skiff
#

how do i get the channel name?

#

of a message

velvet tinsel
sullen shoal
velvet tinsel
#

He wants the code

sullen shoal
unkempt canyonBOT
velvet tinsel
opal skiff
#

ok

twin moon
velvet tinsel
#

@twin moon

sullen shoal
#

!e

d = {"foo":None, "login":[1,2,3,4]}
print(d["login"])```
twin moon
unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

[1, 2, 3, 4]
velvet tinsel
sullen shoal
#

@twin moon now?

velvet tinsel
#

!e print(“like this?”)

unkempt canyonBOT
#

@velvet tinsel :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     print(“like this?”)
003 |           ^
004 | SyntaxError: invalid character '“' (U+201C)
velvet tinsel
#

I’m on a phone

#

!e import hello

unkempt canyonBOT
#

@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.

Hello world!
zenith basin
flint cosmos
velvet tinsel
#

Default role seems to be None

flint cosmos
velvet tinsel
#

Something seems to be None in your code

late wigeon
#

does anyone know how to get discord slash commands working with cogs? I've imported using
from discord_slash import cog_ext
then I added it to my help command and I've invited the bot with the commands permission but it won't run my command when I call it

slate swan
velvet tinsel
#

😭

velvet tinsel
somber tree
#

how do i change the style of the text for my bot?

late wigeon
flint cosmos
somber tree
#

I have no idea how to do any of this stuff

late wigeon
flint cosmos
slate swan
#

What version u r using?

flint cosmos
slate swan
#

yes

minor panther
#

hello

flint cosmos
minor panther
#

guys can you tell me, how to load all cogs only after the cache will be filled

slate swan
twin moon
#

How do I find a list in a json object without manually searching for every file

late wigeon
slate swan
#

Try converting your guild_id into integer

late wigeon
sullen shoal
vale wing
#

Client is not recommended to use

sullen shoal
#

or the id is invalid

late wigeon
#

@flint cosmos

@client.event
async def on_ready():
  guild = client.get_guild(serverID)
cobalt jacinth
#

how can i arrange my commands in catergories. on google stuff is old and confusing

slate swan
#

Oh yes, your bot isn't started completely when you're fetching the guild

flint cosmos
somber tree
#

How do i change the style of the text for the bot?

sullen shoal
#

as an attribute

#

use tasks to do the stuff

late wigeon
flint cosmos
twin moon
boreal ravine
sullen shoal
somber tree
# vale wing Wdym

Like when i type in s!help It shows all of the commands in a different text style instead of

This
twin moon
late wigeon
vale wing
#

Is discord really going to force us to implement slash command

vale wing
somber tree
#

ok

late wigeon
sullen shoal
vale wing
boreal ravine
sullen shoal
#

!botvar

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

sullen shoal
#

tbh im confused with what you exactly meant by redefining Role or whatever

late wigeon
#

it's the same function I showed before

sullen shoal
boreal ravine
flint cosmos
velvet tinsel
twin moon
#

NOW I UNDERSTAND EVERYTHING

boreal ravine
velvet tinsel
boreal ravine
sullen shoal
late wigeon
velvet tinsel
#

It has an index 🤷‍♂️

late wigeon
#

it's a list with strings

velvet tinsel
#

Apparently that’s not what the problem is, I’m gonna go

late wigeon
#

the command works fine without the slash stuff

minor panther
#

guys, do you know how to once get roles, and save them somehow and after use them from different cogs

cobalt jacinth
#

can i hide commands(some) from appearing in help command

velvet tinsel
#

Bye kayle 😂

boreal ravine
velvet tinsel
#

Oh it would return an indexerror

late wigeon
velvet tinsel
#

If the list wasn’t there

sullen shoal
final iron
#

Hard coding a help command is a bad idea

boreal ravine
#

it requires a certain context, not commands.Context

velvet tinsel
boreal ravine
cobalt jacinth
flint cosmos
boreal ravine
sullen shoal
late wigeon
final iron
boreal ravine
flint cosmos
boreal ravine
#

!d discord.ext.commands.Cog <= read this

unkempt canyonBOT
#

class discord.ext.commands.Cog(*args, **kwargs)```
The base class that all cogs must inherit from.

A cog is a collection of commands, listeners, and optional state to help group commands together. More information on them can be found on the [Cogs](https://discordpy.readthedocs.io/en/master/ext/commands/cogs.html#ext-commands-cogs) page.

When inheriting from this class, the options shown in [`CogMeta`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CogMeta "discord.ext.commands.CogMeta") are equally valid here.
cobalt jacinth
#

how does website help ?

final iron
sullen shoal
cobalt jacinth
twin moon
#

@sullen shoal No seriuosly what is foo

sullen shoal
twin moon
cloud dawn
sullen shoal
boreal ravine
sullen shoal
somber tree
#

I'm so confused right now

unkempt canyonBOT
#

@sullen shoal :white_check_mark: Your eval job has completed with return code 0.

can be any object
cloud dawn
boreal ravine
slate swan
#

🤔

somber tree
#
class MyHelpCommand(commands.HelpCommand):
    async def command_callback(self, ctx, *,command=None):
        if command:
           await ctx.send(f"This the help page for the command {command} ")
        else:
            await ctx.send("This is the front pagea for the bots help command")
bot.help_command=MyHelpCommand()```
I don't get this code
sullen shoal
#

read the documentation

somber tree
sick birch
#

Don’t copy code

somber tree
#

ok

sullen shoal
#

!d discord.ext.commands.HelpCommand

unkempt canyonBOT
#

class discord.ext.commands.HelpCommand(*args, **kwargs)```
The base implementation for help command formatting.

Note

Internally instances of this class are deep copied every time the command itself is invoked to prevent a race condition mentioned in [GH-2123](https://github.com/Rapptz/discord.py/issues/2123).

This means that relying on the state of this class to be the same between command invocations would not work as expected.
sick birch
#

You don’t learn like you might writing it yourself

sullen shoal
#

be sure to have to basic knowledge of OOP and python classes

cloud dawn
sick birch
#

Yep HelpCommand has a lot of OOP going on

cloud dawn
#

Stella's git helps covering it.

minor panther
#

do you know how to once get roles, like on_ready, and save them somewhere to use from different cogs