#discord-bots

1 messages · Page 856 of 1

slate swan
#

You could use discord timestamps too

honest vessel
#

from datetime import datetime, timezone

datetime.now(timezone(timedelta(hours=-5), 'EST'))

regal pulsar
#

now that i think about it

#

i cant use and at all

#

wait nvm

heavy belfry
#

hi again , im making a discord game that has multiple people with different accounts, im unsuure on how to set up a data base which basically gets rid of the whole games idea, is there anyone that could help with setting up a data base? Thanks

cold sonnet
heavy belfry
#

o, ty srrry

merry charm
#

2 seperate errors, it works tho

cold sonnet
#

not a discord issue either PeepoCry

merry charm
#

wfym

#

wdym?

cold sonnet
#

that's a

#

gaierror

#

whatever that means

honest vessel
#

socket error

merry charm
#

i have a command that looks up minecraft servers i just a random word as the hostname so the error came

#

its nothing bad lmao

regal pulsar
#

idk 😔

merry charm
honest vessel
#

prob down yes

merry charm
#

my bot gets 0.08 pin

#

when im sharding at 19 servers 🤤

honest vessel
#

look at this error again

merry charm
#

its for a minecraft server dude

tardy atlas
#

..

honest vessel
#

it sais basicly unknown host, and u passing in a discordid

merry charm
#

its nothing bad

honest vessel
#

its not even a hostname

merry charm
cold sonnet
#

!ot

unkempt canyonBOT
merry charm
#

bro ur overcomplicaing this

honest vessel
#

show ur code ?

merry charm
#

i made the error ON PURPOSE so i can test it

#

bro literally nothing is wrong

honest vessel
#

oh ok

merry charm
#

holy hell

honest vessel
#

then why u post it?

merry charm
#

because

#

im making an error logger

#

that logs the error message and the user who caused the error

#

and the command used to cause it

honest vessel
#

i mean what is it for anyone else here ?

torn sail
honest vessel
#

@merry charmthanks for clearing up tho, i thought u needed help 😛

cold sonnet
#

please round those numbers

merry charm
merry charm
#

it changes between commands

#

different commands cause more or less ping

cold sonnet
#

my commands usually cause more

merry charm
#

might round it when i find a better way

manic wing
#

!rule 5

unkempt canyonBOT
#

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

manic wing
#

🤦

#

!rule 7

unkempt canyonBOT
#

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

manic wing
#

crap

#

!rule 8

unkempt canyonBOT
#

8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.

manic wing
#

whelp

#

!rule 9

unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

manic wing
#

this

honest vessel
#

post all rules while ur on it 😄

#

hi btw @manic wing

slate swan
#

Sorry : /

manic wing
cloud dawn
honest vessel
#

🙃

maiden fable
#

Sometimes this channel is a mess and sometimes its dead asf

merry charm
#

i still cant find a way to get datetime in est

#

i hate my life

maiden fable
#

Same

merry charm
#

why does UTC have to exist

#

damn you datetime

#

damn youuuu

manic wing
#

im reformed

slate swan
#

you made too many requests to the API and now you are temp-banned from using it

#

what name should I use to make an error handler for my API i am using pycord

#

on_error/on_command_error events ofc

#

or try/except everywhere

slate swan
#

why would that be a thing, you api is nothing related to the discord.py module

slate swan
#

yes i tried using on_error and on_command_error doesnt works so i thought for api error handlers it has something else which pycord has cuz @bot.event is handled by pycord

slate swan
# slate swan pycord

yea whatever the fork is, its still not related to an errror cause by your API so there would be no event for that

slate swan
#

ahh shit, thanks for the warn though, I really needed to get in line with my texts but wasnt able to 😭

daring olive
maiden fable
#

👀

#

resisting my urge to ask what happened here

slate swan
daring olive
#

lol, ty ty, and np

slate swan
gentle rover
#

How I can fetch all users id in server/guild

maiden fable
maiden fable
#

he ain't asking that...

#

he knows the event name

merry charm
maiden fable
#

He wanna ask something else but cannot explain

merry charm
#

i just hate having to explain something with so little detail

maiden fable
#

everyone hates that

merry charm
#

it sucks

#

here comes the code airplane!

#

nyoooom

tawdry perch
maiden fable
#

Lmao

tawdry perch
#

They spoon fed wrong code..?

#

big sigh

slate swan
# merry charm on_command_error

i am trying this i tried printing 'error' as well as error to see if the event is getting triggered

@bot.event
async def on_command_error(error):
    print(error)
    print('error')
    if isinstance(error, saucenao_api.UnknownClientError):
     print('yes')
merry charm
slate swan
#

not working its printing the entire error

merry charm
slate swan
merry charm
#

errors use unicodes

slate swan
#

and the event isnt trigger as well cuz its not printing error in string as well

merry charm
#

so its visible than normally printing something

#

use ctx

#

and send it in a message

slate swan
#

i am using slash command

merry charm
#

thats why

slate swan
#

does it makes difference or anything?

slate swan
merry charm
#

slash commands have different error handlers

pliant gulch
#

Another cool way you could do this, idk if it's faster/slower though maybe the map pulls through with some performance same with attrgetter ```py
import operator; *ids, _ = map(operator.attrgetter("id"), Guild.members)

slate swan
#

:)

gentle rover
#

How we can message someone from bot through id

merry charm
slate swan
slate swan
pliant gulch
#

Could've use a lambda instead of operator.attrgetter but I'm pretty sure the lambda would be slower than operator.attrgetter

slate swan
unkempt canyonBOT
pliant gulch
#

Still not even sure if what I did was faster than a regular list comp

#

Probably micro-optimisation

merry charm
pliant gulch
#

no

slate swan
#

hey! just woke up went to run my bot! and realized it doesnt print when i run it but it works? pithink anyone know why

#

i had it working before then i went to make a music command and now it doesnt

slate swan
slate swan
#

i got more code but thats for print

#

nope no errors!

#

just did

slate swan
merry charm
#

just check what they use for slash commands

slate swan
#

ohh alright

slate swan
coarse anvil
#

my ban doesnt work

manic wing
#

I wonder why...

coarse anvil
#

im a starter

#

my friend told me to paste that there.

#

yes

manic wing
#

lol

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

cold sonnet
#

you're trying to catch a shark with a stick and a spider web

manic wing
coarse anvil
#

what is this supposed to be about im so confusedpithink

#

nvm forget it, ill just stop trying to code 😭

cold sonnet
#

worst option

merry charm
cold sonnet
#

HUH

merry charm
#

can someone help me with a json problem on my bot

maiden fable
#

sure

merry charm
#
@commands.command()
  async def dict(self, ctx, value, item):
    file = {
  str(ctx.author.id):[
    {
      str(value):str(item)
    }
  ]
}
    with open('json/out.json', 'w') as f:
      json.dump(file, f, indent=2)
``` how can i make a new dict and then add stuff to it
slate swan
#

json != db

merry charm
merry charm
#

this will only hold like 5 dicts max with about 10 - 20 values each

slate swan
slate swan
coarse anvil
#

someone pls help me with my ban command 😿 im so confused

slate swan
coarse anvil
slate swan
slate swan
coarse anvil
#

..

slate swan
#

!indents

coarse anvil
#

oh

slate swan
coarse anvil
#

how do i fix them then

slate swan
#

ill recommend learning basic python

#

not sure if making bots and not knowing pasic python is a good idea

#

!resources to get you started

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

coarse anvil
slate swan
slate swan
hardy yoke
#

You're going to struggle basically every step of the way and not understand why if you don't know any python

slate swan
#

youll just learn syntax and not actual python or oop

maiden fable
#

👀

slate swan
#

Yerlikaya has a pointpithink

maiden fable
#

Can u please refer to people as their nicks? Lmao it feels weird opening their profiles only to read their user names

#

You do know that people tend to ignore things like these, right? pithink

#

Eh, I can understand them. I also started coding with discord.py when I didn't know what is asyncio, module or something like classes even exist

gloomy sandal
#

Mmhm can you share a roadmap from basics to programming a bot?

buoyant quail
#

a lot of people even don't know how to code but start making bot

maiden fable
cold sonnet
#

does programmers

cold sonnet
#

sorry, if it will be pinned, it has to look professional

cold sonnet
#

yeah

slate swan
maiden fable
#

O 👀

slate swan
upbeat otter
#

what.....

maiden fable
#

No thanks

#

Roblox API Wrapper

upbeat otter
#

Smh

maiden fable
#

I didn't

#

I myself came to know about it a few days ago

upbeat otter
#

@final iron background screams

maiden fable
#

I most probably searched it off the net

#

ahem ahem 👀

upbeat otter
maiden fable
#

Nah

#

No one wants u to leave, just pulling your leg and tryna make u fall

upbeat otter
#

You are not even doing anything in the command, it'll always error out, user isnt defined either

maiden fable
#

Lmao

upbeat otter
slate swan
manic wing
#

not sure what you've trying to do here

#

looks like we're missing a bit of infomation

cold sonnet
#

just make him set a default value to username

manic wing
#

its also embed=userfail

upbeat otter
#

Welp

slate swan
#

eevee is backpithink

maiden fable
#

🤣

cold sonnet
#

oh then I'm gone

slate swan
#

anyone got command ideas? added the weird.. ones last night but i need some more

spring verge
#

I was wondering if you learn to develop discord bots etc then will you be considered a good dev? Or a bot project counts as just a small project 🤔 .. Idk if my question makes any sense tho but I think u do learn to use APIs and SQL etc so will you be actually able to survive in the world with that skillset? Or it makes it easier?

merry charm
#

username=None in your async def

pliant gulch
pliant gulch
#

And things such as time-complexity which is crucial in real life, you don't really learn that via discord bots

#

discord.py might as well cause some misconceptions with typehinting

grim oar
#

low level stuff too like cpu and os

spring verge
#

I mean DSA and time complexity etc

pliant gulch
#

Perhaps codewars, leetcode etc

#

Time complexity could probably be covered with some articles or the alike

#

Algorithms will have their own wiki pages most often

spring verge
#

Hmm

grim oar
#

They teach time complexity in data structures, do some course or whatever on them

pliant gulch
spring verge
#

Thx

spring fjord
#

is it possible that a bot can write a command on its own in discord?

daring knot
#

sb can help me real quick?

left crater
#

how can i make it so bots can't use commands

#

ik

#

how would i do that

spring fjord
#

for ex if command for a bot is !play.....so is it possible for me to make a bot which can write !play on its own without calling it like ...its done automatically

grim oar
#

a global check

slate swan
grim oar
#

!d discord.ext.commands.check oopsie wrong one

left crater
#

ok thanks

unkempt canyonBOT
spring fjord
#

i dont know much about discord bots i just want to know if its possible

left crater
#

so like if ctx.author == bot: return

grim oar
#

!d discord.ext.commands.Bot.check

unkempt canyonBOT
#

@check```
A decorator that adds a global check to the bot.

A global check is similar to a [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is applied on a per command basis except it is run before any command checks have been verified and applies to every command the bot has.

Note

This function can either be a regular function or a coroutine.

Similar to a command [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check"), this takes a single parameter of type [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context") and can only raise exceptions inherited from [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError").

Example...
left crater
#

oh ok

spring fjord
#

there is this bot which does something when called and the thing is you can call the bot every 1 hour so i would like to know if its possible that I can make a bot that does that job for me

slate swan
#

Call?

#

You cant call bots....

#

Oh nvm

spring fjord
#

yes something like that.......OK my real problem is this ....there is this bot soccer guru so everytime you write the command sclaim you get a football player and you can call this bot every 1 hour that is 24 times a day so i would like to know if it is possible that i make a bot which calls this other bot every hour.....

vocal plover
#

tl;dr no

#

Any well-programmed bot won't respond to other bots, unless they have a good very specific reason to

spring fjord
#

okkk thank you

maiden fable
#

Tried it, doesn't work

#

Lmaoo

#

Imagine running one on replit 👀

#

Rip, I regret seeing yr pfp and banner now ;-;

#

I got ophidiophobia

#

totally didn't copy that word off internet

slate swan
#

they scary ash

vocal plover
maiden fable
#

Yea yea sure sure

#

Lmaoo

slate swan
#
@client.command()
async def setup(ctx):
  guild=client.guilds[0]
  await guild.create_text_channel('cool-channel')
  channel=client.get_channel("cool-channel")
  await channel.send("Testing")
#

What's wrong here

maiden fable
#

nothing

manic wing
#

well

#

channel=client.get_channel("cool-channel")

slate swan
#

It doesn't work. It says Command raised an exception: AttributeError: 'NoneType' object has no attribute 'send'

unkempt canyonBOT
manic wing
#

just do channel = await guild.create_text_channel('cool-channel')

maiden fable
#

Ah wait

#

Yea lol... I'm sleepy, sorry

slate swan
#

hmm

#

wait

#

i want to create a channel and make the bot send a message in the newly created channel

#

oooh thanks

#

wait

maiden fable
#

still waiting even tho am sleepy

cold sonnet
#

stop waiting then

#

do something

#

(join me in lost ark)

buoyant quail
slate swan
#

if you were to make it so there was a button on a message and you were to click it could you add another button on that message you clicked

manic wing
#

you would have a view, and when the button is clicked you would use view.add_item(your_button)

#

depending on your fork

#

what library are you using?

slate swan
manic wing
#

okay

#

a discord.py example: ```py
import discord
from discord.ui import View, Button, button

class MyButton(Button):
def init(self):
super().init(
label="...",
...
)
async def callback(self):
"""this gets called when the button is pressed"""

class MyView(View):
@button(...)
async def add_button(self, button: Button, interaction: discord.MessageInteraction):
self.add_item(MyButton())
# edit your message

async def command(ctx):
await ctx.send(view=MyView())

#

hopefully this helps

#

you pair add_item with editing your message

#

!d discord.ui.View.add_item

unkempt canyonBOT
slate swan
#

whats wrong with this? trying to get it to play with spotify url

slim ibex
#

so much wrong with this

slate swan
#

yes

#

i have messed it up 💀

#

i fixed the indents though

proven dome
#

does anyone here use discord-interactions

wheat lance
#

what is that?

proven dome
#

if u dont know dont worry

#

Does dpy have select/Dropdown?

slim ibex
#

use a fork

#

Has that stuff built in without having to install shit

#

!pip disnake

unkempt canyonBOT
slate swan
#

When the warnas reach 3/3, it is necessary that the variable be reset, and on a new

proven dome
#

whats disnake

slim ibex
#

Fork of dpy that has more builtin features

proven dome
#

Is it valid?

#

better than nextcord or pycord?

slim ibex
#

yes

#

Probably the best one

slate swan
#

what abt pycharm?

#

oh wait

proven dome
#

pycharm

#

is a ide

#

😂 code editor

slate swan
proven dome
#

@slim ibex

median spoke
slate swan
#

just started usng pycharm and everything is wrong but in visual code it isnt

#

why is this

#

is it cuz nothings imported?

#

oh

#

i see

slim ibex
#

it picks up all things that violate pep8

slate swan
#

oh

slate swan
slate swan
proven dome
#

getting

#

no module named disnake

#

smh

slate swan
#

Restart editor

proven dome
#

Using

proven dome
slate swan
# proven dome heroku

You need a requirements.txt file also, this is not the appropriate channel, claim a help channel and ping me there

#

Just get the Member object and use the ban method on it

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

Is that sarcastic or-

#

Both

merry charm
#
await member.ban(reason="cuz")
slate swan
#

Thats really not helpful

merry charm
slate swan
merry charm
#
@bot.command()
async def ban(ctx, member: discord.Member, *, reason=None):
  if reason == None:
    await member.ban(reason="No reason given")
    await ctx.send(f"Banned {member.name!}")
    return
  await member.ban(reason=reason)
  await ctx.send(f"Banned {member.name} from this server!")
slim ibex
#

spoon feed much?

merry charm
#

bruh

cold sonnet
#

that's not how we help peepocry

merry charm
#

BRUH

#

discord packer

#

i noticed that

#

why r u repping randoms

#

LMAOOOOOo

proven dome
#

💀

final iron
#

It helps no one

final iron
#

Also calm down, no need to use that language

cold sonnet
#

spoonfed people will come back later anyways

#

with another problem

merry charm
#

i dont know how to help without spoonfeeding

#

idk what the "limit" is

cold sonnet
#
    await ctx.send(f"Banned {member.name!}")
    return
```no one-liner sad ![sadcat](https://cdn.discordapp.com/emojis/714964881266311171.webp?size=128 "sadcat")
slate swan
#

Also, you can put the no reason given as the default value of reason, shorten your code by 4 lines

cold sonnet
#

oh well

merry charm
cold sonnet
#

well member is kinda a required arg there

merry charm
cold sonnet
#

wth

slate swan
merry charm
#

has been banned by ctx.author.name

#

np

#

remember brackets

slate swan
#

this was working earlier now isnt

merry charm
#

im stupid

slate swan
#

why?

merry charm
slate swan
#

Braces not brackets

#

😅

cold sonnet
slate swan
#

fuck

#

how do i revert i was using pycharm

merry charm
#

thats why its yellow

cold sonnet
#

just on the wrong version

slate swan
#

yea

merry charm
#

that would result in needing to import the new files

slate swan
#

I literally told you 2 times to not ask about such things in this channel, can you please not? @slate swan please read that politely

cold sonnet
merry charm
#

yes

slate swan
#

i will

cold sonnet
#

as in general python

merry charm
#
embed = discord.Embed(
  title = "my title",
  description = "description",
  color = discord.Color.random()
)
slate swan
#

i did nothing wrong??

slate swan
slate swan
#

!rule 7

unkempt canyonBOT
#

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

slate swan
#

sorry

merry charm
#

they probably do tbh

cold sonnet
#

Ashley is the main off-topic person

slate swan
#

No

slate swan
merry charm
#

they recite the rules in their sleep

cold sonnet
#

so if Ashley says go away, you probably aren't talking bout dpy

slate swan
#

you have to follow rules in here if you guys dont like to follow them leave lol

merry charm
cold sonnet
neat pagoda
#

wtf is wrong, help

def get_prefix(client, message):

    prefixes = ['-', '~']
    if not message.guild:
        prefixes = ['?']  # Only allow '==' as a prefix when in DMs, this is optional
    return commands.when_mentioned_or(*prefixes)(client, message)


intents = discord.Intents.all()




Streams=("https://www.youtube.com/watch?v=DWcJFNfaw9c")

StreamName=("Lofi Girl - lofi hip hop radio - beats to sleep/chill to")

bot = commands.Bot(command_prefix=get_prefix,
                   description='A Music Bot',
                   case_insensitive=True,intents=intents,status=discord.Status.online, activity=discord.Streaming(name=StreamName, url=Streams))

bot.add_cog(Music(bot))

client = bot

It won't respond to the prefix, whereas it did before, but i didn't change anything AHHHH

cold sonnet
#

and your warning was because of rude speech, I saw the whole thing

slate swan
slate swan
neat pagoda
slate swan
unkempt canyonBOT
merry charm
cold sonnet
merry charm
#

where is the bots run function

slate swan
#

no need for that question

#

client = bot, i'll just bye now

merry charm
cold sonnet
merry charm
slate swan
#

op wrong reply

cold sonnet
#

oh it was in his code

#

thought you were saying they're the same thing

slate swan
merry charm
#

@slate swan they never set the cog as a class IF it is

slate swan
merry charm
neat pagoda
# merry charm where is the bots run function

I just run it manually, but I do have this:

@client.event
async def on_ready():
    client.togetherControl = await DiscordTogether("------------ Redacted :)")
    print('Bot is online!')
    alive_status.start()


connections: ['(aiohttp.client_proto.ResponseHandler)']


@tasks.loop(seconds=10)
async def alive_status():
  session = aiohttp.ClientSession()
  
  await session.get('oof')
  Session1 = await session.get('------------ Redacted :)')
  await session.get('------------ Redacted :)')
  Sesiop = await session.get('------------ Redacted :)')
  await session.get('------------ Redacted :)')
  print(Sesiop)
  print(Session1)
  print(session)
  await session.close()
slate swan
cold sonnet
#

but it was a required arg...

#

but I don't like converting an arg to member 😠

cold sonnet
#

the error handling after it looks bad

slate swan
merry charm
neat pagoda
#

it's so it http requests it's self and another bot so that other bot can do the same thing so it alsmost never has downtime

merry charm
neat pagoda
#

oof 💀

#

lmao, i thought it was the same for every bot

#

that uses replit, 💀

slate swan
neat pagoda
#

no, 1 second

#

lol

merry charm
neat pagoda
#

I get things like "nosniff lmao

merry charm
#

nekoapi

slate swan
#

quick question

jade tartan
#

Hi am trying to have user enter their name under name section?

#

How?

#

This is my code here

slate swan
#

the owner_id for @commands.is_owner() right?

merry charm
slate swan
merry charm
merry charm
#

im literally using them right now and they work

neat pagoda
jade tartan
#

This is my code here

neat pagoda
merry charm
slate swan
jade tartan
#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
    embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
    embed.add_field(name=str(name), value=str(name),  inline=False)

    await ctx.send(embed=embed)
    print(f"The embed has been send")
neat pagoda
#

but, seriously, how, I even tried just plain prefix, still, didn't work

merry charm
slate swan
merry charm
#

to the owner_ids array

#

it works for me idk what to tell u lmfao

slate swan
#

no need for it if youre one

#

im not sure why the conversation started

bitter depot
merry charm
#

i have side developers to help me

#

and i work with friends

jade tartan
#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
    embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
    embed.add_field(name={name}, value={ctx.author},  inline=False)

    await ctx.send(embed=embed)
    print(f"The embed has been send")

    ```
merry charm
#

so owner_ids is rlly handy for me

slate swan
#
  async def callback(self, interaction):
      response = requests.get(f'https://discord.com/api/v9/users/{userId}/profile', headers=headers, params=params)```
anyone know how i can get the userId of the person that clicked the button using discord.py
slate swan
slate swan
jade tartan
#

Ok i am trying to have a user enter his/her name in as a embed question if that make sense

merry charm
slate swan
merry charm
neat pagoda
#

I know it's not my code, because I use this on a verified bot, so

slate swan
neat pagoda
#

idk why it's not working

slate swan
merry charm
slate swan
merry charm
neat pagoda
#

I use the prefix and requests on another bot and it works perfectly

merry charm
#

check ur intents

neat pagoda
slate swan
#

command_prefix = commands.when_mentioned_or(["b!","B!"]) or command_prefix = commands.when_mentioned_or["b!","B!"]

#
  async def callback(self, interaction):
      response = requests.get(f'https://discord.com/api/v9/users/{userId}/profile', headers=headers, params=params)```
anyone know how i can get the userId of the person that clicked the button using discord.py

i am nub so i need help
neat pagoda
merry charm
merry charm
#

is anything password protected or hwid protected?

neat pagoda
slate swan
slate swan
#

(list) and the other without ()

slate swan
merry charm
slate swan
#

member should be a Member obj tho

slate swan
jade tartan
slate swan
#

its basic oop

neat pagoda
#

still doesn't work 💀

cold sonnet
slate swan
jade tartan
#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
    embed.add_field(name= f"User: {ctx.author.mention}", value=":white_check_mark:Verified 18+:white_check_mark:", inline=False)
    embed.add_field(name=f"{ctx.author.name}", value=f"{ctx.author.name}",  inline=False)

    await ctx.send(embed=embed)
    print(f"The embed has been send")

    ```
i just want it to the user can enter his/her name
#

thats all

merry charm
neat pagoda
#

idk

cold sonnet
#

you don't have to know no oop to define a variable

neat pagoda
#

this sucks, wtf do I do

jade tartan
#

So?

neat pagoda
#

ima try my other bot, musecord 1

#

see if there's any difference

slate swan
# jade tartan So?

i would recommend using the name on discord than the user inputting a name

tough lance
#

Hi

slate swan
slate swan
#

its not your bot

#

how do i get the id of the person that clicked the button

slate swan
neat pagoda
slate swan
tough lance
#

I came to this channel after literal 3 months

jade tartan
#

wait so name=f"member.name", value="inputting a name"?

jade tartan
slate swan
#

sure ig

jade tartan
#

idk

jade tartan
#

Please help me

cold sonnet
#

just

slate swan
jade tartan
tough lance
cold sonnet
neat pagoda
jade tartan
#

Does that mean anything? the built in function thing

slate swan
tough lance
#

I think

cold sonnet
#

indeed

jade tartan
#

@cold sonnet

cold sonnet
#

I don't know how those got there

cold sonnet
slate swan
#

im not gonna even say anything

jade tartan
#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
    embed.add_field(name= f"User: {ctx.author.name}", value="✅Verified 18+✅", inline=False)
    embed.add_field(name=f"{ctx.author.name}", value="{ctx.author.name}",  inline=False)

    await ctx.send(embed=embed)
    print(f"The embed has been send")```
cold sonnet
#

forgot the f

#

!f-strings bro

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

cold sonnet
#

and you don't even need it

jade tartan
#
async def start(ctx):
    embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
    embed.add_field(name= f"User: f{ctx.author.name}", value="✅Verified 18+✅", inline=False)
    embed.add_field(name=f"{ctx.author.name}", value="{ctx.author.name}",  inline=False)

    await ctx.send(embed=embed)
    print(f"The embed has been send")
cold sonnet
slate swan
#

useless f string

tough lance
#

Bruh just use str() if you want to be like that

cold sonnet
#

f"User: f{ctx.author.name}"

slate swan
jade tartan
#

So str{ctx.author.name}?

cold sonnet
#

!resources please

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

slate swan
#

ugh gosh

#

it would be nice if i were heard

tough lance
slate swan
#
  async def callback(self, interaction):
      print(interaction.user.id)
      response = requests.get(f'https://discord.com/api/v9/users/{interaction.user.id}/profile', headers=headers, params=params)
      

So I did this but now I want to get a string from the button command

async def create(ctx, numTime, serverInvite, prize):
    inviteCode = serverInvite.split("/")[3]
    serverId = requests.get(f"https://discord.com/api/v9/invites/{inviteCode}").json()['guild']['id']```

like i would want to get the serverId
jade tartan
#

omg

cold sonnet
#

how much times peepocry

#

you gotta work on this message to be pinned

#

WHAT

slate swan
#
  async def callback(self, interaction):
      print(interaction.user.id)
      response = requests.get(f'https://discord.com/api/v9/users/{interaction.user.id}/profile', headers=headers, params=params)
      

So I did this but now I want to get a string from the button command

async def create(ctx, numTime, serverInvite, prize):
    inviteCode = serverInvite.split("/")[3]
    serverId = requests.get(f"https://discord.com/api/v9/invites/{inviteCode}").json()['guild']['id']```

like i would want to get the serverId
cold sonnet
#

oh so we can't just use resources for someone

#

thinking anyone will read it

#

nah

#

I'm just gonna try helping those who have a day of python experience without saying anything

slate swan
#

could anyone help me my question is up top

tough lance
#

the silence tho

cold sonnet
#

what lib is this?

slate swan
cold sonnet
#

"like i would want to get the serverId"
you only want the serverid?

#

nah I'm honestly dumb

#

save serverId (camelCase is against pep8) to a bot variable

#

like bot.serverId = serverId

#

then you'll be able to access it from your button... Ig that's what you want?
I'm really just guessing, so if I didn't get it yet, provide more detail

slate swan
# cold sonnet like ``bot.serverId = serverId``

i'm trying to get a serverid of the server I put in the $create command
what i'm trying to do now is the the serverid var in my

  async def callback(self, interaction):
      print(interaction.user.id)
      response = requests.get(f'https://discord.com/api/v9/users/{interaction.user.id}/profile', headers=headers, params=params)```
final iron
kind cargo
#

hello i need som help somone help me?

coarse anvil
#

how do i put like more stuff on the embed?

slate swan
#

When the warnas reach 3/3, it is necessary that the variable be reset, and on a new (sql)

slate swan
unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style chaining.
slate swan
#

Help pls

#

Yes

#

well, the value was reset, and again

coarse anvil
slate swan
#

🤔

cold sonnet
#

;

slate swan
#

Okay

final iron
kindred epoch
#

a ; is not used when using sql in a bot

slate swan
#

final iron
kindred epoch
#

dud how is it a better practice when you cant use a ; in a bot? You only use a ; when you're using the cmd prompt

cold sonnet
#

yeah, I remember using ; in asyncpg

final iron
cold sonnet
#

asyncpg is just SS tier

kindred epoch
#

ok, so you're saying that im supposed to do this?

await bot.pg_db.execute("DELETE FROM something");
kindred epoch
#

im talking about asnycpg and python and postgres

manic wing
#

yes it does

#

!e py print(3); print(2); print(1); print(0)

unkempt canyonBOT
#

@manic wing :white_check_mark: Your eval job has completed with return code 0.

001 | 3
002 | 2
003 | 1
004 | 0
kindred epoch
#

ive used sql and postgres

manic wing
#

it can mean whatever you want it to

#

you can write your code with ; after every line

#

theres no problem with it

kindred epoch
final iron
#

We're talking about sql, not python

cold sonnet
#

without ;

#

at the end of the line

kindred epoch
peak loom
#

I keep getting this error. The code for unreact is attached.

cold sonnet
#

you can make a one-line bot with ; tho

#

but why would u

final iron
slim ibex
#

🗿

kindred epoch
cold sonnet
#

why he laughing

kindred epoch
#

never said he was wrong tho

slim ibex
#

but that laugh is kinda sarcastic

#

It doesn’t matter where sql is used

#

you use ; at the end of sql queries

cold sonnet
#

and not at the end of a python line

slim ibex
final iron
#

I don't see why you would ever use a ; at the end of a python line

#

It's unpythonic

slim ibex
#

yeah

slate swan
#

; is to end a query

final iron
#

I know...

slate swan
#

sqlite doesnt use it iirc

final iron
#

Sqlite does

vast gale
#

!e print('h') ; print('i')

unkempt canyonBOT
#

@vast gale :white_check_mark: Your eval job has completed with return code 0.

001 | h
002 | i
final iron
vast gale
#

ah, true that

cold sonnet
#

at the end of the day, all python sql wrappers put stuff in a sql query

slate swan
slate swan
unkempt canyonBOT
#

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

001 | h
002 | i
peak loom
#

I got this error the code is attached. How would I fix it I've been trying.

cold sonnet
vast gale
#

^

final iron
peak loom
slate swan
vast gale
slate swan
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | AttributeError: 'NoneType' object has no attribute 'strip'
peak loom
slate swan
final iron
vast gale
#

!d discord.on_reaction_remove

unkempt canyonBOT
#

discord.on_reaction_remove(reaction, user)```
Called when a message has a reaction removed from it. Similar to on\_message\_edit, if the message is not found in the internal message cache, then this event will not be called.

Note

To get the message being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

This requires both [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") and [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.

Note

Consider using [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") if you need this and do not want to enable the members intent.
peak loom
final iron
#

🗿

unkempt canyonBOT
#
Not likely.

No documentation found for the requested symbol.

peak loom
final iron
slim ibex
#

!d discord.on_raw_reaction_remove

unkempt canyonBOT
#

discord.on_raw_reaction_remove(payload)```
Called when a message has a reaction removed. Unlike [`on_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_reaction_remove "discord.on_reaction_remove"), this is called regardless of the state of the internal message cache.

This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
peak loom
final iron
#

It doesn't return member

peak loom
cold sonnet
#

it does

final iron
cold sonnet
#

on_raw_reaction_add returns a member

#

remove doesn't

final iron
cold sonnet
#

that's why the line
await bot.get_guild(payload.guild_id).get_member(payload.user_id).remove_roles(role)
exists

#

nah, the discord api just sucks

final iron
#

No

cold sonnet
#

remove actually doesn't return a member like add

final iron
#

on_raw_reaction_remove doesn't return a member

cold sonnet
#

check in the docs

final iron
cold sonnet
#

Imma link it here

#

!d discord.RawReactionActionEvent

unkempt canyonBOT
#

class discord.RawReactionActionEvent```
Represents the payload for a [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") or [`on_raw_reaction_remove()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_remove "discord.on_raw_reaction_remove") event.
final iron
cold sonnet
#

click and see

final iron
#

It doesn't return a member object

cold sonnet
peak loom
final iron
cold sonnet
#

Only available if event_type is REACTION_ADD

final iron
#

Never said you couldn't?

cold sonnet
#

that there's no member attribute...

vast gale
#

...which is entirely a discord limitation

final iron
#

Trying to make this person understand it doesn't return a member object

peak loom
#

I don't understand what y'all trying to tell me to do to fix this problem of mine, everytime I ask here I get a bull crap answer I have no way of understanding.

final iron
#

I don't know what you want me to say

cold sonnet
#

we chillin

peak loom
#

Yes.

rotund frigate
#

hey i want it so when i say a command the bot responds to it in the channel, (example, i say $hi and it says hello but only i can do that)

async def waa(ctx, author):
  while True:
    if author.id == 940652261141516370:
      if ctx.content.startswith('$hi'):
        ctx.channel.send('hello')```
peak loom
#

On the on_raw_reaction_remove?

slim ibex
#

infinite loop? What’s the purpose

rotund frigate
#

so its always ready to respond when i say something

peak loom
#

Okay, by any chance you know how to use ursina.py?

cold sonnet
slim ibex
#

that just means that it will keep sending hello if the conditions are true iirc. And the indentation in that ctx channel send looks weird

cold sonnet
final iron
peak loom
#

Yes.

kindred epoch
final iron
#

Because it only searches through the members in the guild

slim ibex
#

!e

while True:
    print("hello")
unkempt canyonBOT
#

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

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

Full output: too long to upload

final iron
#

No all the members the bot can see

cold sonnet
rotund frigate
#

i also want to do it for some users that arnt the owner

peak loom
#

I'm trying to fix a glitch in it lol. You fall through the map lol.

slim ibex
#

You see how while True will just keep looping

final iron
rotund frigate
#

i dont want it in a list i want it like this ```
if user.id == 21342542354235:
ctx.send('blah blah')

if user.id == 43543543534:
ctx.send('blah blah')

#

two

slim ibex
#

I hate when people check for user id with a single id

rotund frigate
#

why

slim ibex
#

^

rotund frigate
#

how?

#

so like this?

slim ibex
#

if user.id in (id, …)

rotund frigate
#
if user.id(435465642563, 54832578432)
ctx.send('blah')
slim ibex
#

^

slate swan
#

.send is a coroutine

slim ibex
#

needs to be awaited

slate swan
#

and you forgot a colon

slim ibex
#

shit another person that doesn’t know Python and is making a discord bot

#

🗿👍

cold sonnet
#

ctx.send enoguh

kindred epoch
#

done that all the time, output? ignored 😂

#

or just say "just help me"

#

ye

slate swan
unkempt canyonBOT
slate swan
#

yw

shrewd inlet
#
@bot.command()
async def addimg(ctx,link):
  ('gracieims.txt').append(link)
  if link in ('gracieimgs.txt'):
    await ctx.reply("**Your image has been added, thanks for submitting!**")

@bot.command()
async def removeimg(ctx,link):
  ('gracieims.txt').remove(link)
  if link in ('gracieimgs.txt'):
    await ctx.reply("**Your image has been removed from the database.**")
#

did i do this correctly? i don't think so since the command isn't working.

slate swan
#

not so

#

link is a str and use a db

shrewd inlet
#

database?

slate swan
#

yes

shrewd inlet
#

im using a txt file tho

slate swan
#

you shouldnt store data in a txt file

shrewd inlet
#

ion got a database

slim ibex
#

Not hard to make one

slate swan
#

^

shrewd inlet
slim ibex
#

You really don’t even have to make it

shrewd inlet
slate swan
slim ibex
#

(‘file.txt’)🗿

shrewd inlet
slim ibex
#

^

slate swan
#

link is a str as said

shrewd inlet
#

i was testing something but it didnt work 💀

slim ibex
#

it’s just going to append the link to that tuple iirc

#

does tuple even have an append method?

slate swan
#

ofc it wont

#

tuples are immutable

slim ibex
#

They are immutable

slate swan
#

you cant add or remove to a tuple

#

you cant mutate them

shrewd inlet
#

ohh

slate swan
#

basic python

shrewd inlet
#

hm alright so what database should i use?

slate swan
shrewd inlet
#

so basically i have a txt file full of discord media links and i have a command ;img where users can get a random image. the ;addimg let’s users add images to this txt file , and the ;removeimg is self-explanatory.

shrewd inlet
slim ibex
#

but you are attempting to append to this tuple that contains the text file name

slate swan
slim ibex
#

and you can’t append to tuples

shrewd inlet
shrewd inlet
#

i learned that just now 😭

slate swan
slim ibex
#

probably should learn more Python before continuing your project

slate swan
#

its basic python

shrewd inlet
#

yeah i never did coding, i started coding my bot in decemeber

slate swan
#

everyone should know that

shrewd inlet
#

not really into coding, just wanted to make a bot, but i should probably learn to code.

coarse anvil
#

why yall so mean to people who just started python and wanna create a bot

placid skiff
#
def is_blacklisted()->Callable[[T], T]:
    def predicate(ctx: AnyContext)->bool:
        result = db.field("SELECT BlackListRoleID FROM Guild WHERE GuildID IS ?", ctx.guild.id)
        return True if result is None or result not in any(role.id == result for role in ctx.author.roles) else raise CheckFailure()

why the interpreter is saying that raise CheckFailure() is unreachable in this code?

coarse anvil
#

😭

slim ibex
shrewd inlet
#

😭

coarse anvil
slate swan
slate swan
#

🗿

#

makes it worst for us

final iron
#

🗿

slim ibex
slate swan
#

you always need to return the function in a deco

slim ibex
#

^

slate swan
#
def deco():
    def method():
        ...
    return method
placid skiff
slim ibex
#
def deco():
    def method():
        ...
    return method
coarse anvil
#

help?? it shouldve worked

slim ibex
#

member: discord.Member = …

placid skiff
coarse anvil
slim ibex
coarse anvil
shrewd inlet
#

honestly half of my code (if not all) is from yt videos and people helping me on this server 😭

#

i do want to learn to code but it’ll take time

slate swan
#

yt tutorials are all bad

slim ibex
#

Don’t copy off YT if you don’t listen to what they say

shrewd inlet
#

and that’s what i don’t have

slate swan
#
  1. you only learn syntax
  2. most things are deprecated and outdated
  3. not clear
slim ibex
slate swan
shrewd inlet
#

i could pay someone to code a bot, but i don’t have money. so what do you have? a combination of no time or money? you code your own bot without knowing any code

slate swan
#

Corey is the goat no cap

shrewd inlet
#

it’s easy for you guys to say i should learn this or that, but it’s really hard to understand for me

coarse anvil
#

someone just give me a ban code bruh

final iron
slate swan
coarse anvil
shrewd inlet
slate swan
shrewd inlet
#

will look into it! :D thanks!

cloud dawn
slim ibex
slate swan
shrewd inlet
shrewd inlet
slate swan
coarse anvil
#

who here isnt rude nd shit and can help me with my bot

slate swan
shrewd inlet
slate swan
#

you want everything given to you which we do not do here

coarse anvil
#

very very nice support

shrewd inlet
slate swan
#

you asked if you can get spoonfeed which no we do not do here

coarse anvil
#

u didnt even help me with my code bruh

slate swan
#

true i didnt but panda did

shrewd inlet
#

also someone pin this pls !

coarse anvil
#

he did?

alpine furnace
slim ibex
#

okimii just trolling at this point 💀

shrewd inlet
#

LMFAIQJHS

slate swan
coarse anvil
#

i was trying to make a kick and ban code

shrewd inlet
#

yeah i am just gonna ask my coder friend to spoon feed me 😭 i’ll learn on my own time, and later on i can adjust it

slim ibex
shrewd inlet
slate swan
slate swan
coarse anvil
shrewd inlet
slim ibex
#

Getting spoon fed gets you no where

slate swan
#

^

coarse anvil
slim ibex
slate swan
#

guys we help everyone if you cant help yourself thats not really our problem

slim ibex
#

^

slate swan
#

you ask we give

shrewd inlet
cloud dawn
shrewd inlet
#

also i have school and etc

slate swan
#

no no

slim ibex
cloud dawn
slate swan
#

"=" means assigned to "==" means equal to

slate swan
shrewd inlet
slate swan
#

or literal to, its ok

slate swan