#discord-bots

1 messages · Page 803 of 1

pine crown
#

when i change it to member it changes to youruser

#

then when i change it to youruser it changes to member

#

then when i put youruser again it says command is outdated

quick gust
#

you can do stuff you already know, but faster with it. time saved

#

you don't need to retype the whole shit

slate swan
#

if you have no errors and you get spoonfeeded everything im not sure if thats a good idea

quick gust
#

there's a reason andy wants to make docs with copilot

slate swan
pine crown
#

why do we have to learn python when the bot can write the code for us

slate swan
#

how would you learn if you get no errors?

pine crown
#

just saying lol

slate swan
#

seems like the same thing

pine crown
#

i cant

slate swan
pine crown
#

why

#

this bot bully me

#

:<

#

i cri

slate swan
#

slashcommands go brrrrrrrrrrrr

pine crown
quick gust
slate swan
quick gust
#

that's their problem...?

dry kelp
#

why when i delete a webhook it deletes a entire channel?
instead of deleting just the webhook

quick gust
#

In no sense is this bad, except it watches you code and learns

pine crown
#

yes

slate swan
#

thats just creepy

pine crown
#

not really

slate swan
#

getting watched by an ai lol

pine crown
#

go and try it for urself

#

go try for it urself

quick gust
pine crown
#

go to waitlist

slate swan
#

nah ill stick with idle and myself

pine crown
#

ok

quick gust
#

it doesn't watch you, it watches your code

slate swan
slate swan
pine crown
#

how to make a code that checks if there is a txt file with a name

#

that we entered

#

is it just

#
if with open(f"{member.guild.name}.txt", mode="r"):
  ...
slate swan
#

it would probably give a missing expression error

pine crown
#

how do i do it

slate swan
#

use listdir

pine crown
#

os.listdir?

slate swan
#

yeah

pine crown
#

ok

slate swan
#

and just check the file names

pine crown
#

\🍦

pine crown
#

ok

pine crown
slate swan
pine crown
#

?

#

the / means the current directory

slate swan
#

how do i check how much reactions i have in a message?

quick gust
pine crown
#

halp

pine crown
slate swan
#

and also how can i know what reaction has the most reacts?

dry kelp
#

How can i get a channel webhook name?

slate swan
#

how can i like detect that the author in a voice channel or not and join that voice channel if yes

#

you should make a loop

#

which checks that

slate swan
#

yes

slate swan
#

its a help channel

#

not a channel for free scripts

#

we can give you an idea but not do the work for you

#

🥴 ok

quick gust
#

if it is then join the channel

slate swan
#
  voice_state = member.voice
  if voice_state is not None:
    # do stuff
  else:
    print("user is not in a voice")
#

it will look something like that

#

ok

#

thanks

#

np

#

the documentation is very confusing

quick gust
#

actually, discord.py has one of the best docs I've seen

#

!d discord.Member.voice

unkempt canyonBOT
#

property voice: Optional[discord.member.VoiceState]```
Returns the member’s current voice state.
quick gust
#

u can use this

slate swan
#

0ok

slate swan
slate swan
#

thanks

quick gust
#

why not just if member.voice?

#

unnecessary variable

slate swan
#

ikr

slate swan
weary gale
quick gust
#

ofc, message.author returns a different object than member.voice, u cant compare them

weary gale
# weary gale

i just started using this so can somebody please help me

#

i've installed the python extension

#

i've downloaded python twice

slate swan
quick gust
#

try pip install discord without the 3 or what okimii said

chilly panther
weary gale
#

neither worked

quick gust
chilly panther
#

it should be still on pypi tho

slate swan
quick gust
#

it is, maybe they dont have pip installed

chilly panther
#

mid

weary gale
slate swan
chilly panther
weary gale
#

is pip an extension?

slate swan
#

its probably not in there env vars

weary gale
#

or something

quick gust
#

have u ever installed pip?

weary gale
#

nope

quick gust
#

there we go

weary gale
#

how would i do that

chilly panther
#

pip is the python page manager

#

package downloader

slate swan
#
@client.command()
async def play (ctx, song_name):
    if member.voice:
        ctx.send("First please join a Voice Channel")

    else:
        ctx.send("Working")

This one is still giving me error

Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\GUDDU\Desktop\Program\Projects with my friends\music_bot.py", line 13, in play
    if member.voice:
NameError: name 'member' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'member' is not defined
#

why not

chilly panther
slate swan
#

you probably didnt installed pip with python

slate swan
#

where?

chilly panther
#

when I downloaded python it had a choice to install it

slate swan
#

yeah it does

slate swan
#

guess not

weary gale
#

do i just open command prompt and run python get-pip.py

#

? or is there more to it

quick gust
#

is it not print([i async for i in rct.users()])

slate swan
#

oh yeah good catch

#

i should go to sleep

quick gust
#

kekw yes

#

async for not for async

weary gale
chilly panther
#

there is more then one way ,

1 : download bootstrap from python website and run it
2 : reinstalling python and clicking install pip

slate swan
quick gust
weary gale
#

i thought once i pressed download on the python site it'd be done

slate swan
weary gale
#

is it a python installer

quick gust
#

send the error

slate swan
slate swan
# quick gust send the error
Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\GUDDU\Desktop\Program\Projects with my friends\music_bot.py", line 13, in play
    if ctx.author.voice != member.voice:
NameError: name 'member' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'member' is not defined
quick gust
#

...

weary gale
#

ohhhhh

quick gust
#

did u restart your bot

#

show your code again

slate swan
#

the tb says it all tho?

quick gust
#

if ctx.author.voice != member.voice:

#

what even

slate swan
#

line 13

if ctx.author.voice != member.voice:
NameError: name 'member' is not defined
slate swan
# quick gust show your code again
import discord
from discord.ext import commands
from yt_dlp import YoutubeDL

client = commands.Bot(command_prefix='$')

@client.event
async def on_ready():
    print("Music Bot is Online")

@client.command()
async def play (ctx, song_name):
    if ctx.author.voice != member.voice:
        ctx.send("First please join a Voice Channel")

    else:
        ctx.send("Working")```
quick gust
#

why != member.voice?

quick gust
#

use if not ctx.author.voice

slate swan
#

its a coro

#

ok

#

should be

await ctx.send()
slate swan
#

lol

#

sorry😐

#

for

slate swan
slate swan
#

lol

slate swan
#

4 at am

#

im hungry

chilly panther
#

oop

slate swan
slate swan
slate swan
#

yeah i will now

#

lol gn

#

gn

weary gale
#

what

quick gust
#

you pip install'd discord and keepalive?

#

and restarted vsc afterwards?

weary gale
#

oh i have to restart it?

quick gust
#

yes

weary gale
#

uhok

quick gust
#

its just a visual "bug"

#

code should still work

chilly panther
#

ye vscode does not update stuff like that til u restart

weary gale
#

ah

gusty ibex
#

how would i go about pulling the game someone is playing from discords api for a bot

unkempt canyonBOT
#
Nope.

No documentation found for the requested symbol.

slate swan
#

!d discord.Member.activities

unkempt canyonBOT
#

The activities that the user is currently doing.

Note

Due to a Discord API limitation, a user’s Spotify activity may not appear if they are listening to a song with a title longer than 128 characters. See GH-1738 for more information.

slate swan
#

This

#

Basically, using .activities on a discord.Member object would get you their activities as a list

pine crown
#

how to send code in a specific channel?

pine crown
weary gale
#

how would i send normal messages in a channel with my bot

#

not embedded or anything

neat tartan
#

Ctx.send(message)

weary gale
#

is there a way for me to do that without having to restart my bot every time?

#

like could i make a command where i do
for example (!send (message))

slate swan
#

@weary galeare you an actual arab?

slate swan
#

oufe

#

kayfa halak?

#

man ayna ant?

weary gale
#

inshallah

slate swan
#

Wrong answer

weary gale
slate swan
#

Show me what you learnt thus far

neat tartan
slate swan
#

The code is easy but we don't want to spoonfeed

#

So ye. Have you written anything thus far?

weary gale
slate swan
#

Well, do you know how to write a script?

#

As in, what should be imported for the script to work?

weary gale
#

im new to dpy

#

so not exactly

slate swan
#

Hopefully you're not new to py

#

cuz you'd need to know py if you want dpy

weary gale
#

new to both

fervent shard
#

code:```py
@bot.command()
async def verify (ctx):
unverifiedRole = discord.utils.get(ctx.guild.roles, name="unverified")
await member.remove_roles(unverifiedRole)

verifiedRole = discord.utils.get(ctx.guild.roles, name="member")
await member.remove_roles(verifiedRole)
embed=discord.Embed(description=f"{member.mention}, you're now verified", colour=0)
await ctx.send(embed=embed)error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'member' is not defined```i don't know how to define member.

slate swan
#

hmm. well, i'd suggest you learn py first but i started learning py two days ag as well

weary gale
#

member = discord.Member? or something

#

idk

neat tartan
weary gale
#

wait so can somebody please help me with the !send command or give me an example

fervent shard
slate swan
#

try this instead

slate swan
#

it might be wrong but worth a shot

neat tartan
#

Tutorial resource to start with. Begin with something basic like getting the user to input a command and get the bot to send the message hello world. It will get you working with the bare basics of dpy and give you groundwork to work off of for what your wantibg to do

slate swan
weary gale
slate swan
weary gale
slate swan
#

!e variable = str

fervent shard
slate swan
#

typehints are done with : , not =

slate swan
weary gale
#

@slate swan could you please give me an example on how i could make

#

a command where i could type !send (message)
and the bot would send it

slate swan
weary gale
#

python is a coding language

slate swan
#

python is basically
(you set conditions)
print(based on conditions you set what you want)

weary gale
#

yes

slate swan
#

So say,

x=5
y=10
print(x+y)```
slate swan
#

The code will print 15

#

Say if you did not assign any variables

gusty ibex
#

anyone have any idea why this isnt returning the game?

slate swan
#

here x and y are variables, variables can have any value

weary gale
#

ah

slate swan
#

now you can also write a code withour variable

#

it'd just be print(print anything)

slate swan
slate swan
slate swan
#

but if you tried doing

print(x)

#

the send command

#

It would return an error

#

oh okay

weary gale
slate swan
#

Because you did not give any value to X

#

Variables are supposed to have values

#

Since x is variable, you should assign a value

#

or else it will return error

gusty ibex
weary gale
#

oh i thought u meant x=5
print(x)
that this wouldnt print anything

neat tartan
unkempt canyonBOT
#

@neat tartan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | NameError: name 'x' is not defined
weary gale
#

i was confused

slate swan
weary gale
#

yup ok

slate swan
weary gale
#

makes sense

slate swan
#

But like, you'd not be using print() when you're coding a discord bot

neat tartan
slate swan
#

thats kind of redundant

slate swan
weary gale
slate swan
#

send a message there quick

#

do it

quick gust
weary gale
slate swan
#

its taken

#

what the cmd to join the voice channel same as the author

#

cn = MemberCacheFlags.voice()

#

this way we will get the channel id?

gusty ibex
#

not even with user = message.author

visual island
#

Member is the Member object, in your case the author

fervent shard
#

@visual island any help?

visual island
fervent shard
# visual island show your code
@bot.command()
async def verify (ctx, member=discord.Member):
  unverifiedRole = discord.utils.get(ctx.guild.roles, name="unverified")
  await member.remove_roles(unverifiedRole)

  verifiedRole = discord.utils.get(ctx.guild.roles, name="member")
  await member.remove_roles(verifiedRole)
  embed=discord.Embed(description=f"{member.mention}, you're now `verified`", colour=0)
  await ctx.send(embed=embed)```
quick gust
#

u need to typehint

visual island
quick gust
#

not set the default value

#

member: discord.Member

fervent shard
visual island
fervent shard
prisma spoke
#

Read the error

prisma spoke
visual island
fervent shard
# prisma spoke Ok?

look, i dont understand much errors and theyre meanings. i understand them once theyre explained to me. please do not expect me to know everything.

prisma spoke
#

It clearly states MissingRequiredArgument

fervent shard
slate swan
# fervent shard

Is this command meant to work like +verify and the user who used the command will get the role?

prisma spoke
#

Simple english

fervent shard
prisma spoke
#

Google the meaning of argument please

fervent shard
slate swan
prisma spoke
#

Oh shoot it pinged

slate swan
# fervent shard yep!

remove the member argument from the function, and replace member with ctx.author inside the function

slate swan
# fervent shard oh alr tysm

you're welcome, also if you don't understand what an error means you can always reference to the docs
They will make things clear

slate swan
visual island
slate swan
#

They just use await Member.voice.channel.connect directly, bet

slate swan
# visual island show code
@client.command()
async def play (ctx, song_name):
    if not ctx.author.voice:
        await ctx.send("First please join a Voice Channel")

    else:
        await ctx.author.voiceChannel.connect()
        
gilded gull
#

how to do help

slate swan
oblique adder
#

does having lesser line of code improve performance / decrease ram usage by a lot of just a little bit ?
My bot have 28 k lines of code and in 200 servers and it eating a lot of ram. If I make my code better / delete unnessary line will it gain more performance ?

slate swan
#

btw i forgot

gilded gull
visual island
slate swan
#

isn't bot.event and client.event the same thing?

slate swan
slate swan
slate swan
oblique adder
visual island
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.

gilded gull
slate swan
# slate swan .voice.channel.connect
Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\GUDDU\Desktop\Program\Projects with my friends\music_bot.py", line 17, in play
    await ctx.author.voicechannel.connect()
AttributeError: 'Member' object has no attribute 'voicechannel'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'voicechannel'

error

neat tartan
visual island
#

voice<dot>channel

slate swan
visual island
#

voice.channel

slate swan
#

as in, the main noticeable difference?

slate swan
slate swan
slate swan
oblique adder
slate swan
#

the number lines won't affect

slate swan
# visual island `voice.channel`
Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:\Users\GUDDU\Desktop\Program\Projects with my friends\music_bot.py", line 17, in play
    await ctx.author.voice.channel.connect()
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1277, in connect
    voice = cls(client, self)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\voice_client.py", line 199, in __init__
    raise RuntimeError("PyNaCl library needed in order to use voice")
RuntimeError: PyNaCl library needed in order to use voice

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\GUDDU\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice

``` error again
unkempt canyonBOT
#

Python binding to the Networking and Cryptography (NaCl) library

slate swan
#

Install this

#

ok

neat tartan
# slate swan as in, the main noticeable difference?

I dont know the specifics but i think client refers to a specific user/id (the bots) and bot refers to the bot as a whole. Please someone correct me if this is wrong but this is my understanding. They are very similar to each other

slate swan
slate swan
neat tartan
fervent shard
slate swan
unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
gilded gull
#

CODE:

import discord
import os
from PIL import Image

client = discord.Client()

@client.event
async def on_ready():
  print('bot is radi')

@client.event
async def on_message(message):
  user = message.author
  img2 = user.avatar_url
  img1 = Image.open("adamay.gif")

  
  img1.paste(img2, (0,0), mask = img2)

  if message.content.startswith('$twerk'):
    await message.channel.send(img1)

client.run('')

ERROR:

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\prana\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "c:\Users\prana\Downloads\main.py", line 19, in on_message
    img1.paste(img2, (0,0), mask = img2)
  File "C:\Users\prana\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\Image.py", line 1537, in paste
    raise ValueError("cannot determine region size; use 4-item box")
ValueError: cannot determine region size; use 4-item box
idle radish
#

I would like to sent a message to discord by calling a function without typing a command into discord. Any turorials how to do this?

slate swan
#
@client.event
async def on_message(message):
  channel=message.channel
  message=message.content
  if message == "edit deez texts":
    reply=await channel.send("Edit this")
    reply="This has been edited"
    await message.edit(content=reply)```
#

not workie

slate swan
slate swan
#

the bot sends a message

#

yes

#

and after a few seconds it edits the message that it sent to something else

#

oh

slate swan
#

kind of like

bot: Loading loading
5seconds later
bot: Process complete

west juniper
#

pls help

slate swan
slate swan
west juniper
slate swan
#

like, delay by a few seconds

unkempt canyonBOT
#

coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.

If *result* is provided, it is returned to the caller when the coroutine completes.

`sleep()` always suspends the current task, allowing other tasks to run.

Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.

Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.

Example of coroutine displaying the current date every second for 5 seconds:
slate swan
#

this will make the function sleep for the mentioned time

slate swan
#

okay thanks

slate swan
#

but why is member set to None?

#

help

slate swan
idle radish
#

What function should i use to just sent a message by calling the function

slate swan
#

help

slate swan
west juniper
slate swan
unkempt canyonBOT
#

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

slate swan
#

o sorry

#

not working @slate swan

#

rule 4

slate swan
#

meaning error

#

is there

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

slate swan
#

well youuse self inside the check function ¯_(ツ)_/¯

#

so ? tell me wha should i do

#

now ?

slate swan
#

k

#

remove self from ???

#

self.bot.wait_for

#

the check function

#

NO

#

k

#

then??

slate swan
slate swan
slate swan
#

@slate swan

slate swan
#

i want to execute whatever im getting from the user

slate swan
#

your check does not return True

#

its saying i cant execute a string

slate swan
slate swan
slate swan
slate swan
#

and could you elaborate wym by 'execute'

#

oh, an eval command?

slate swan
unkempt canyonBOT
slate swan
#

my bot's status is not changin to idle can anyone help

#

and by your code ill assume you're using disnake, so use disnake-jishaku

slate swan
#

await it

#

yes done

#

forgot to type await

#

hm

slate swan
#

but its not changing

slate swan
slate swan
slate swan
#

also, make sure you have only 1 instance of the bot running

slate swan
# slate swan yes

you should not, make some command , or use await bot.wait_until_ready() before changing the presence

#

ohh thx

#

btw u r indian ?

#

yep

#

i saw your bio

meager creek
#
    @slash_command(name = 'balance', description = 'Посмотреть баланс', guild_ids = [939170043667828766])
    async def balance(self, inter):
        emb = discord.Embed(description = f'Баланс пользователя {inter.author.mention} - **{self.collection.find_one({"_id": inter.author.id})["coin"]}**')
        row = ActionRow(

        Button(style = ButtonStyle.gray, emoji = '![coin](https://cdn.discordapp.com/emojis/939461577604730960.webp?size=128 "coin")', custom_id = 'coin')
        )

        message = await inter.send(embed = emb, components = [row])

    @commands.Cog.listener()
    async def on_button_click(self, inter):
        if inter.component.id == 'coin':
            await message.edit('coin_test')
``` pls help, code not work edit
slate swan
#

How do I add emoji in a bot reply?

#

can i store them into the dictionary using the guild_id as a key ?

outer parcel
#

hi everyone i need some help

#

Command raised an exception: OAuthException: unauthorized_client error processing request (Only script apps may use password auth)

#

im trying to make a meme command

#

but it keeps on putting thi

warm forum
#

@client.event
async def on_member_update(before,after):
print(after.nick,before.nick)

#

hey why its not showing anything in the terminal when i change nick?

slate swan
#

do you have member intents?

distant pendant
#

My bot wont join my voice channel. I imported everything I needed

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice

slate swan
#

pip install pynacl

warm forum
#

hey can i call on_message method from on_member_update method?

maiden fable
manic wing
#

where would you get that message object

simple cypress
#

How to fix this?

brisk brook
#
    @commands.command()
    @cooldown(1,15,BucketType.user)
    async def scout(self,ctx):
        names = ["bed","air","UFO","sink"]
        opt = []
        index = 0
        scout = []
        for n in names:
            num = random.randrange(1,100)
            scout.append({f"{index}": {"name": n, "amount": num}})
            index += 1

        for i in range(3):
            while True:
                add = random.randrange(0,len(names))
                if add not in opt:
                    opt.append(add)
                    break

        for s in scout:
            print(s["0"])
``` it says keyerror "0"
#

can someone help me?

rustic onyx
#

wdym

slate swan
brisk brook
#

so scout is an empty list

#

but I append to it yk

slate swan
#

well I think you meant to do s[0]

brisk brook
#

[{'0': {'name': 'bed', 'amount': 96}}, {'1': {'name': 'air', 'amount': 33}}, {'2': {'name': 'UFO', 'amount': 51}}, {'3': {'name': 'sink', 'amount': 6}}]

#

I made it a string tho

#

did I do something wrong?

slate swan
#

print s

#

and show me the output

slate swan
#

so, when it gets to the next dict (the one with 1), it can't find 0, hence the error

brisk brook
# slate swan and show me the output

{'0': {'name': 'bed', 'amount': 12}}
{'1': {'name': 'air', 'amount': 69}}
{'2': {'name': 'UFO', 'amount': 1}}
{'3': {'name': 'sink', 'amount': 99}}

brisk brook
#

do I use break?

slate swan
#
it = "0"
for s in scout:
  print(s[it])
  it = str(int(it) + 1)
brisk brook
#

what I'm trying to do is do opt[0]

#

for item1 and etc

#

@slate swan so do you know any way to fix it?

slate swan
#

what's opt?

slate swan
brisk brook
#

in the old code there's a list that's called opt

#

3 random numbers would append to the list

brisk brook
#
    @commands.command()
    @cooldown(1,10,BucketType.user)
    async def beg(self, ctx):
        user = ctx.author
        await self.open_account(ctx,user)
        num = random.randrange(0,101)
        quote = [f"A stranger gives you {self.num(num)}.", f"A mysteriously man knows that you have money, but he still gives you {self.num(num)}", f"I'm poor, but I still give you {self.num(num)}", f"Stop being a beggar!! {self.num(num)}"]
        await ctx.send(random.choice(quote))
        await self.update_wallet(ctx,user,"+",num)

    @commands.command()
    @cooldown(1,15,BucketType.user)
    async def scout(self,ctx):
        names = ["bed","air","UFO","sink"]
        opt = []
        index = 0
        scout = []
        for n in names:
            num = random.randrange(1,100)
            scout.append({f"{index}": {"name": n, "amount": num}})
            index += 1

        for i in range(3):
            while True:
                add = random.randrange(0,len(names))
                if add not in opt:
                    opt.append(add)
                    break

        for s in scout:
            item1 = s[str(opt[0])]["name"]
            item2 = s[str(opt[1])]["name"]
            item3 = s[str(opt[2])]["name"]
#

this is what I'm trying to do

#

@slate swan

dreamy sluice
#

Is there a way I can make the bot recieve input from a button/dropdown if there's only 1?

#

For example, there's a single message in a channel with a button/dropdown

#

Is there a way I can make the bot continuouly receive the inputs from it?

#

(Nextcord)

maiden fable
slate swan
#

ah sorry to interrupt, but can we make Discord Bots using Python, because idk Java but I am good at python, so if yes, how?

dreamy sluice
unkempt canyonBOT
slate swan
#

ohh thank you

unkempt canyonBOT
dreamy sluice
slate swan
#

kk

brisk brook
#

but it is discontinued

#

so I don't suggest you use it.

slate swan
#

ok thanks (:

dreamy sluice
#

Is there an event for button clicks?

nimble plume
#

hi can anyone suggest me for help commands

maiden fable
timid wagon
timid wagon
dreamy sluice
slate swan
maiden fable
timid wagon
#

I can't find an on_button_click event in nextcord's docs

#

Is on_interaction the only way?

slate swan
#

on_button_click is only in disnake.

timid wagon
dreamy sluice
#

How do I specify which certain button?

slate swan
#

how are you implementing it?

#

a view class?

dreamy sluice
timid wagon
#

If you're subclassing it, you can specify a custom ID to the button and check for it in the event

slate swan
# dreamy sluice Yea
class MyView(View):
   @discord.ui.button(label='label')
   async def the_callback(self, button , interaction):
      # this is triggered when the button is clicked 
      ...```
#

Is there a function that can be called to sent a message?

#

!d discord.abc.Messageable.send

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**.
slate swan
#

on_message need a command to sent i would like to just sent message when call the function

timid wagon
#

F I misundertood the question

slate swan
slate swan
slate swan
slate swan
nimble plume
#

how to get a role

#

by name

slate swan
#

!d discord.utils.get

unkempt canyonBOT
#

discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").

When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.

To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.

If nothing is found that matches the attributes passed, then `None` is returned.

Examples

Basic usage...
slate swan
#

use this, with name as the attribute

nimble plume
slate swan
#

show code

nimble plume
#

ok

#

wait

#

role = discord.utils.get(ctx.guild.roles, name="Muted")

#

else :

#
perms = discord.Permissions(send_messages=False, speak=False)
                     await ctx.guild.create_role(name="Muted", permissions=perms)
                     role = discord.utils.get(ctx.guild.roles, name="Muted")
slate swan
#

there's no role named muted in that server

nimble plume
nimble plume
#

this is not working as well

slate swan
#
role = utils.get(...
if not role :
   role = Guild.create_role(*args)
white zealot
#

fig.write_image("images/fig1.png",format='png',engine='kaleido')
this hangs the vscode terminal and the program stops then and there...i wish to save the plots

#

as pngs

#

to send it as embeds

#

in my discord bot

nimble plume
maiden fable
slate swan
quick gust
#

yep!

slate swan
#

h

#

im trying to call a function from somcommands.py and getting discord.ext.commands.errors.ExtensionNotFound: Extension 'somecommands' could not be loaded.

maiden fable
#

Seems like the path is wrong

wide moon
#

Which library should I use, to make a bot?

slim ibex
#

!pypi nextcord

unkempt canyonBOT
slim ibex
#

!pypi disnake

unkempt canyonBOT
slim ibex
#

i would use disnake

wide moon
#

ooh, its that the one most are using now a days? or your personal preference?

slim ibex
#

there are also non-forks like pincer and hikari, but they are much more complicated

#

i don't really make bots or do python dev much anymore, but I used nextcord

wide moon
#

oooh

#

i want some library which has good support, nice docs and the new features, do you think it suits me?

slim ibex
#

disnake prolly

#

but def watch out for pincer and hikari since they have things like customizable middleware

wide moon
#

oooh, thanks ill note that

slate swan
#
@client.command(pass_context=True)
async def verify(ctx, user: discord.Member, role: discord.Role):
  await user.add_roles(user, role)
  await ctx.send(f"{user} has been given {role}")```
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10011): Unknown Role

slim ibex
#

the role you are trying to add prolly doesn't exist

slate swan
#

^^

#

hmm

#

weird

slate swan
# slim ibex show the coide
from discord.ext import commands
from dotenv import load_dotenv
from os import getenv
import discord

load_dotenv() # You can pass the location of the .env file if it's not in a standard location

token = getenv("DISCORD_TOKEN")

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

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

bot.load_extension("somecommands") # Note, we don't need the .py file extension

bot.run(token)
slim ibex
#

the load_extension has to be in a setup function

#

andw where is this extension somecommands evben coming from

manic wing
#

just replace somecommands with disnake-debug 😳

grim oar
#

and pass_context is not needed anymore

slate swan
#

Member is not defined

#

also i fixed it

grim oar
#

user in your case

slate swan
slate swan
grim oar
#

ok

slate swan
#

yeah found the script on stackoverflow

#

so some stuffs are outdated

heavy folio
#

...

#

dont copy code please

slim ibex
#

^

grim oar
#

BanEntry is a namedtuple, use BanEntry.user

#

a User object

#

that is its repr

#

just User.id

#

sure

slate swan
unkempt canyonBOT
#

property id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.id "discord.User.id")
slate swan
#

wdym

grim oar
#

user_found = banned_user.user.id in your first if

slate swan
grim oar
slate swan
grim oar
#

screams what.. idk if Member implements an int so maybe thats a problem

#

calm down son.

strong vessel
#

is it too outdated?

slim ibex
#

use disnake

grim oar
#

so you see a BanEntry is a namedtuple, its returned by bans method. It has an attribute called .user, this returns an User object.

maiden fable
#

It's just not updated anymore

grim oar
#

nice

#

relax

distant pendant
#

What kind of bots are you programming?

maiden fable
#

I want to program a kind of bot

shadow wraith
#

we all should probably just make a bot that's fucking easy to use

slim ibex
#

🗿

maiden fable
#

I want to make a bot which can give command ideas

prisma spoke
#

Wdym

pliant gulch
#

Make a bot that uses rin

shadow wraith
quick gust
maiden fable
slim ibex
shadow wraith
#

make a bot that is easy af to use

pliant gulch
maiden fable
#

makes sure to suggest rin to everyone 👀

pliant gulch
#

rin is just too cool 😩

slate swan
#

any help with this?

pliant gulch
#

I'm gonna refactor components today! so it will be a lot cooler as well

maiden fable
#

BTW andy

#

A suggestion... Write some parts of it in cython 👀

pliant gulch
#

The wrapper is already compatible with uvloop so that gives a lot of speed, I might later write c++ bindings for some parsers

maiden fable
#

Like the http and the gateaway part 👀

pliant gulch
#

The wrapper uses asyncio but can also use uvloop

#

Well, up to the user to decide for now

#

But it's still compatible

grim oar
#

"can also use uvloop"

#

🤡

maiden fable
#

Ah okay. Never really used uvloop so idrk too much about it

pliant gulch
#

Basically asyncio's loop but with cython

#
with ActionRowBuilder() as builder:
    @builder.button(...)
    async def button1(...) -> None:
        ...

    @builder.button(...)
    async def button2(...) -> None:
        ...
```components refactor sneak peek! 👁️ 👁️
grim oar
#

looks shit

maiden fable
#

Tbh...

#

I expected better, andy

grim oar
#

unusable in classes

pliant gulch
maiden fable
#

😂

pliant gulch
maiden fable
grim oar
pliant gulch
grim oar
#

why it even needs a context ma-

#

ok

slate swan
#

bot.py

from discord.ext import commands
from dotenv import load_dotenv
from os import getenv
import discord

load_dotenv() # You can pass the location of the .env file if it's not in a standard location

token = getenv("DISCORD_TOKEN")

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

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

bot.load_extension("somecommands") # Note, we don't need the .py file extension

bot.run(token)

somecommands.py

from discord.ext import commands # Again, we need this imported
import discord
import time
from datetime import datetime

class SomeCommands(commands.Cog):
    """A couple of simple commands."""

    def __init__(self, bot: commands.Bot):
        self.bot = bot
        self.last_msg = None

    
    # Embded message command shows the embded info
    @commands.command()
    @commands.has_role("Admin")
    async def hello(self, ctx: commands.Context, productname):
        
        embed = discord.Embed(title=test, url="https://test.com", colour=0x87CEEB, timestamp=datetime.utcnow())
        embed.set_author(name="something", icon_url="https://avatars.githubusercontent.com/u/16879430")
        embed.add_field(name="Field 3", value="Look I'm inline with field 2!", inline=True)
        embed.set_footer(text="Powered by United Digital Company!", icon_url="https://cdn.discordapp.com/emojis/754736642761424986.png")

        await ctx.send(embed=embed)

def setup(bot: commands.Bot):
    bot.add_cog(SomeCommands(bot))

call.py

import bot

sent = hello(productname)
sent()
slate swan
#

forgot to paste 😛

maiden fable
grim oar
slate swan
#

also

slate swan
#

same folder

strong vessel
#

is bot token the application id or the public key?

scarlet aurora
#
AttributeError: 'Command' object has no attribute 'has_permissi
ons'``` why do i keep getting this error?
slate swan
#

call.py is file where i can would like to pass trough some variable to sent an embeded message to a channel

grim oar
#

can you show entire traceback @slate swan

scarlet aurora
#

ok

shadow wraith
#

im legit so bored i want to make a bot that is simple to use with some1 but i use disnake and everyone still using discord.py 😔

scarlet aurora
#
n <module>
    @commands.has_permissions(manage_messages=True)
AttributeError: 'Command' object has no attribute 'has_permissions'```
shadow wraith
scarlet aurora
#
import os
import requests
import json
import random
import sys
import colorama
from discord.ext import commands
from discord.ext.commands import has_permissions, MiissingPermissions
tight mica
#

hmm

#

should work

strong vessel
#

what permissions does a bot need to get and send messages

#

does it need to 'read message history'?

tight mica
slate swan
shadow wraith
#

i dont use dpy 💀

slate swan
#

same here

scarlet aurora
#
@commands.has_permissions(ban_members=True)
@bot.command()
async def ban(ctx, user: discord.Member, *, reason="Ueason unspecified"):
        await user.ban(reason=reason)
        ban = discord.Embed(title=f"Ban: {user.name}!", description=f"Reason: {reason}\nBy: {ctx.author.mention}")
        await ctx.message.delete()
        await ctx.channel.send(embed=ban)
        await user.send(embed=ban)
        colour=0x3D9AF2```
shadow wraith
#

okimii do you use disnake

strong vessel
#

3072

slate swan
shadow wraith
# slate swan yes

i kinda wanted to code a simple to use bot with some1 that uses disnake but i think you're too advanced with discord bots 😔

scarlet aurora
#

the indents are not like that in the code

slate swan
#

and your kwargs arent in the constructor and iirc .command() should always be on top idk

shadow wraith
shadow wraith
#

🚶

#

!e

def func():
          print("???")
func()
unkempt canyonBOT
#

@shadow wraith :white_check_mark: Your eval job has completed with return code 0.

???
slate swan
#

pep8 is screaming

scarlet aurora
#

!e

unkempt canyonBOT
#
Command Help

!eval [code]
Can also use: e

*Run Python code and get the results.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*

scarlet aurora
#

!e py @commands.has_permissions(ban_members=True) @bot.command() async def ban(ctx, user: discord.Member, *, reason="Ueason unspecified"): await user.ban(reason=reason) ban = discord.Embed(title=f"Ban: {user.name}!", description=f"Reason: {reason}\nBy: {ctx.author.mention}") await ctx.message.delete() await ctx.channel.send(embed=ban) await user.send(embed=ban) colour=0x3D9AF2

unkempt canyonBOT
#

@scarlet aurora :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 5
002 |     ban = discord.Embed(title=f"Ban: {user.name}!", description=f"Reason:
003 |                                                                 ^
004 | SyntaxError: unterminated string literal (detected at line 5)
shadow wraith
#

uh who uses disnake and wants to code a bot with eachother that does something

slate swan
#

you cant eval dpy lol

scarlet aurora
#

oh

slate swan
#

#bot-commands guys please use this

scarlet aurora
#

so why wont my stuff work

slate swan
#

how to see logs in heroku cli

shadow wraith
scarlet aurora
#

i did that

warm frost
#

Does someone have a Solution to this ?
I added the cooldown and it is working, but the problem is I get the cooldown message on my Console instead of the Discord server. I tryed many different ways to add a the Cooldown text into discord but didnt worked.
When i select the Command twice in the discord it says the application is not responding

shadow wraith
#

you didn't

strong vessel
#

how to get the invite link of the bot

jagged root
#
async def embed(ctx, *, query):

    em = disnake.Embed(
        color=0x4e5ece,
        description=
        f"{' '.join(ctx.message.content.split(' ')[1:])}"
    )
    
    await ctx.send(embed=em)
    await ctx.delete()```
why doesnt the command delete
scarlet aurora
#

wait what

shadow wraith
slate swan
shadow wraith
#

use await ctx.message.delete()

jagged root
#

thanks

shadow wraith
#

np

slate swan
#

why delete the msg after sending it just use delete_after lol

shadow wraith
#

@slate swan hes talking about the msg that is like !embed <query>

slate swan
#

well should it be the first thing after the function

strong vessel
slate swan
shadow wraith
#

i dont know why but im eating carrots

slate swan
shadow wraith
#

not whole carrots

#

at one shot

#

like slices of em

scarlet aurora
#
@bot.command()
@commands.has_permissions(manage_messages=True)
async def codex(ctx):
    embed = discord.Embed(
```what's wrong with this
#

just the top 2 lines

slate swan
#

nothing

scarlet aurora
#

then why is it erroring

#
AttributeError: 'Command' object has no attribute 'has_permissi
ons'```
slate swan
#

not sure why its giving an error

#

because it does have that attr

#

!d discord.ext.commands.has_permissions

unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingPermissions "discord.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
slate swan
#

yep

shadow wraith
#

im so bored that i want to make a bot with someone but nobody wants to 😭

scarlet aurora
#

with commands

slate swan
#

yeah mini

shadow wraith
#

uh idk how to help with the error your having

#

commands does have that attr tho 💀

warm frost
#

Is there a way to add a Costume reply when the command is on cooldown ?
I get a message in the console that the command is on cooldown, i tryed many ways to add it in the discord chat. But instead of sending it the bot in the discord says "application is not responding"
Do you have any Idea what i need to add that the bot will send the remaining time and text while it is still on cooldown ?

grim oar
shadow wraith
scarlet aurora
#

OH SHIT

scarlet aurora
shadow wraith
#

lmfaoaoaoaoaoaao

#

don't roll your r's liket hat

grim oar
slate swan
scarlet aurora
warm frost
#

Its @median bridge.slash

scarlet aurora
#

it works now, thanks so much

#

@grim oar you smart man

#

i can't believe i forgot about that

slate swan
#

what do you guys recommend for slash commands

shadow wraith
slate swan
#

i want to make a slash commands only bot

#

any fork is good

slate swan
grim oar
slate swan
shadow wraith
#

disnake has the best slash command support in my opinion

#

better than discord_slash 🥶

slate swan
#

how can i create an event in a cog?

slate swan
#

!d discord.ext.commands.Cog.listener

unkempt canyonBOT
#

classmethod listener(name=...)```
A decorator that marks a function as a listener.

This is the cog equivalent of [`Bot.listen()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.listen "discord.ext.commands.Bot.listen").
slate swan
#

lol

slate swan
#

listeners and events do the same thing

#

:/

#

and cogs only have listeners

#

oh

#

i just used listeners for on_message events

#

yes

#

thanks

#

listeners to events

shadow wraith
#

the fuck events rambling about

slate swan
#

huh

shadow wraith
#

no i just thought listeners to events sounds weird

slate swan
unkempt canyonBOT
shadow wraith
slate swan
#

its for docs

#

41 packages lol

shadow wraith
#

!d

unkempt canyonBOT
slate swan
tender estuary
#

Python bot written probably using python for helping others do the same using python

slate swan
#

they should make the python bot case insensitive

warm frost
#

I added !d but it writes me that its invalid syntax

unkempt canyonBOT
#
Bad argument

Unable to convert 'yeah it uses python' to valid command, tag, or Cog.

tender estuary
unkempt canyonBOT
#
Huh? No.

No documentation found for the requested symbol.

slate swan
#

oops

ruby prairie
#

hi

tender estuary
slate swan
#

not really

ruby prairie
#

however, can anyone come to dms??

tender estuary
slate swan
#

B() and b() aren't the same```py
class A:
def B(self):
pass
def b(self):
pass

tender estuary
#

why use Class here bruh

slate swan
#

there to different functions?

tender estuary
#

Oh ok

slate swan
#

if you are searching for 2 different docs

tender estuary
#

I understood his reference

slate swan
#

and they have the same name

#

bro.

#

nvm

tender estuary
slate swan
#

case insensitive is a kwarg in the bot constructor

#

its a bad idea.

#

oh wait

#

i misunderstood

tender estuary
#

case_insensitive=True || False

slate swan
#

i thought like !d discord.ext and !d discord.EXT

slate swan
tender estuary
slate swan
slate swan
tender estuary
#

Print "hello" in the most complex way you can think

slate swan
#

make it esoteric

ruby prairie
#

print("Hello")

tender estuary
#

I said the most complex way -_-

#

!e

x = "hello"
lst = []
for i in x:
  lst.append(i)
print(str(lst).strip("()[],"))
#

naah

distant pendant
#

How can I make that my bot writes every morning at 9 AM a message

slate swan
#

i wonder if i can make a dict inside a dict in pymongo like

#
cluster.insert_one(
    {"_id" : guild.id,
    "role" : "None",
    "channel" : "None",
    "users" : {45 : "None"}}
  )```
distant pendant
slate swan
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

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

use the called_once_a_day method

slate swan
tender estuary
slate swan
#

yeah

#

you can nest dicts

slate swan
tender estuary
#

extend them

#

append them

distant pendant
tender estuary
#

dictionaries are mutable now it seems

sage otter
tender estuary
slate swan
slate swan
tender estuary
sage otter
tender estuary
#

!e
print("".join([i for i in "hello"]))

slate swan
#

you cant append to a tuple

tender estuary
#

why use tuple

#

just create variables for everything

sage otter
#

Those exists yeah.

tender estuary
#

create a thousand variables who cares

slate swan
#

the heck is a frozenset

pliant gulch
#

Basically an immutable version of a set

sage otter
#

a set+tuple in bland terms

slate swan
#

ah ic

sage otter
tender estuary
#

FROZEN set

pliant gulch
#

Sets are cool! I don't see why people forget about them 😔

slate swan
#

in what way

#
@client.event
async def on_guild_join(guild):
  cluster.insert_one(
    {"_id" : guild.id,
    "role" : "None",
    "channel" : "None",
    "users" : {45 : "None"}}
  )```
sage otter
#

the only time I’ve used a set in any of my stuff Is when I cast to a set so I can remove duplicates and shit.

slate swan
#

i legit dont know how

tender estuary
slate swan
tender estuary
#

I am dumb but can unpack set?

pliant gulch
# slate swan in what way
roles1 = set(list_of_roles)
roles2 = set(message.author.roles)

if roles2.intersection(roles1):
    return
``` Here the intersection is `O(n)` where N is the LOWEST set amount. If you were to iterate the two lists it would be O(n * m)
pliant gulch
#

no

slate swan
sage otter
#

Idk what any of that shit is tbh. Computer science nerds man.

slate swan
#

the heck is O(n)

pliant gulch
#

basically sets make checking if a author has a role from a list of roles faster!

sage otter
#

It’s a measurement of time?

slate swan
pliant gulch
slate swan
#

time complexity or something

pliant gulch
#

O(n) is linear time, time goes up with amount of elements

tender estuary
slate swan
slate swan
tender estuary
sage otter
#

But should you tho?

slate swan
tender estuary
#

I use it for my items in shop for my economy bot

sage otter
#

Is the real question.

tender estuary
sage otter
#

no.

tender estuary
#

just try something different

#

bored with sql

slate swan
#

bro.

sage otter
#

Yeah I got bored of sql as well. I store all of my data in punch tape.

slate swan
#

i got bored of sql so i stored all my data in a .txt file

fluid spindle
#

Why is everyone suddenly bored of SQL?

slim ibex
#

bruv

uneven apex
#

i have this code

@bot.command()
async def testing(ctx, tag):
    row = reps_sheet.find(tag).row  #getting row no
    await ctx.send(row)```