#discord-bots
1 messages · Page 880 of 1
Idk much about all this stuff, anyways this all is ot
1000mb is a gb but in windows 1024mb is a gb
probably kilobits
posted a screenshot in #ot2-never-nester’s-nightmare
Still ot
its a kb lol
okimii you just dont know when to stop do you
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
he got it
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Ayo yea
bruh
y
oh its fine
full error?
ok cool
why are you trying to send a message to a message?
just do await channel.send?
when you're programming always think of the logic
how to send messages to channel
you send messages to a channel; channel.send.
you dont send messages to a message
i got it last time
well you must've done something different
name cant be one, either use the value
How to ping @ here?
It's possible for Dank memer tho
In a ctx
LMAO
bruh @cosmic agate
?
uh
nothing xd
!d discord.Member.mention ?
property mention: str```
Returns a string that allows you to mention the member.
!d discord.TextChannel.mention ?
property mention: str```
The string that allows you to mention the channel.
I love the consistency
wait
The string
and
Returns a
for basically the same thing...
consistency:
ok
maybe this isnt a field
huh, then try
.add_field(name="[text](url/link)", value="")
i tried
whats the problem here?
you cant have no value for value 
he wants something like in that pic
the like curly
its not possible for me to make the name a hyperlink
thingy
nah
oh ok
print the embed json
!d discord.Embed.to_dict
to_dict()```
Converts this embed object into a dict.
How to mention users from reactions?
sorry for the inconvenience
i swear I feel like hugging and slapping you at the same time
ill take a hug
youll have to take both if you want one XD
How to mention users from reactions?
Just use 200b or whatever the unicode was
!d discord.Reaction.users
async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.
The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
Examples
Usage
```py
# I do not actually recommend doing this.
async for user in reaction.users():
await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
oh ok thanks
jesus, that was an example, stop pinpointing stuff thats common sense
Not everyone knows about the unicode, just saying dude
why did my message look so aggressive
i apologize
Hey, why does this loop only print 3 times? despite number_of_winners equalling 6?
@tasks.loop(seconds=5.0)
async def giveawaytime(self):
for i in range (0, len(Giveaway_Items)):
if Giveaway_Items[i]['Expired'] == True:
pass
else:
expire_date = Giveaway_Items[i]['Time']
formatted_time = datetime.datetime.fromisoformat(expire_date)
if formatted_time < datetime.datetime.now():
number_of_winners = Giveaway_Items[i]['Winners']
for x in (0, number_of_winners):
winner = random.choice(Giveaway_Items[i]['Members'])
print(winner)
Giveaway_Items[i]['Expired'] = True
json.dump(Giveaway_Items, open("./Cosmic overground/giveaways.json", "w"), indent=1)
print(winner)
```
you forgot range
for x in range(0, number_of_winners):
async def test(ctx):
name= discord.User.display_name
await ctx.send (f'Hello {name}') ```
why it's not returning my display name?
is there a way to fix the width of an embed?
No
f
yes but it returns my name and #
It renders differently on different screens
what yes
oh yea, alr
i want it to return "recon expert" for example
then use discord.Member
bro
!d discord.Member.display_name
property display_name: str```
Returns the user’s display name.
For regular users this is just their username, but if they have a guild specific nickname then that is returned instead.
LMAOOOO @cold sonnet best of luck then
Yea
ctx.author.display_name
ty
memberconverter 😍
Does not work. Only 222 is output to the console, why doesn't it work further?
@commands.command(aliases = ["information", "info", "информация"])
async def инфо(self, ctx):
print(222)
guilds_count = len(client.guilds))
emb=discord.Embed(title=f"**Информация о боте**", color=discord.Color.from_rgb(128, 0, 255), timestamp=ctx.message.created_at)
print(1)
emb.add_field(name="**__Основное:__**", value=f"**Версия:** 1.0.0\n**Серверов:** {guilds_count}\n**Всего участников:** скоро ", inline=False)
print(2)
emb.add_field(name="**__Второстепенное:__**", value=f"**Задержка:** Скоро\n**Запущен:** Скоро", inline=False)
emb.set_footer(text=f"Запросил: {ctx.author.name}", icon_url=ctx.author.avatar_url)
await ctx.send(embed=emb)
how can i make it so that something is only on the server the command was published
ex: $newprefix dog
and it only changes on the server he did the command on
guilds_count = len(client.guilds))
whatchu think
when will people stop making on_command_error events which eats all of their errors
guilds_count = len( #one bracket
client.guilds
)) #two brackets
is there a way to make a button continue working after bot restart?
remove 2nd bracket on cient uilds line
persistent views
ill research that, thanks
much appreciated
do u write in ide
how do i create a command that only changes someting about the bot like its prefix in the server the user was in when he posted it
I removed it, still doesn't work
make a database
hw
sql
how do i fetch the last sent message in a guild?
a json file
would a json file work
yo, how would I get the message from this? like the content. ```py
def check(message):
return message.author == ctx.author and message.channel == ctx.channel
try:
em = discord.Embed(title="Cosmic Overground Giveaways 🎉", description="Please enter your giveaway message.", color= discord.Color.gold())
await ctx.send(embed=em)
await bot.wait_for('message', check=check, timeout=60)```
I'm not answering
message.content
where do I put this tho, in the check or?
first, that isn't the right syntax for bot.wait_for
it's not?
it is
@feral jacinth I removed it, still doesn't work
then хз
it isn't?
lmao he getting rammed
it's ```py
try:
await bot.wait_for('event_here', timeout=60, check=check_here)
except asyncio.exception.TimeoutError:
Do stuff when the timeout runs out
else:
do stuff here when the check is true and timeout is not over```
literally what he did
i didn't see any elses
...
if you're talking about the timeout, that's not required?

or excepts
its there just later on
he has the timeout too
yeah
...
except asyncio.TimeoutError:
em = discord.Embed(title="Cosmic Overground Giveaways 🎉", description="You have run out of time to add a giveaway message. Please run the command again.", color= discord.Color.red())
await ctx.send(embed=em)
```
Where is the else?
I want to get the users message content, I know I can check it in the check statement
but how do I bind it
yeah so in the check do -
message.content
if the timeout runs out you need to return or use an else if it didn't timeout
where's the code for if it doesn't timeout?
it's after the except, outside of it
the code won't stop if the try statement is successful
@commands.command(aliases = ["information", "info", "информация"])
async def инфо(self, ctx):
print(222)
guilds_count = len(client.guilds)
emb=discord.Embed(title=f"**Информация о боте**", color=discord.Color.from_rgb(128, 0, 255), timestamp=ctx.message.created_at)
print(1)
emb.add_field(name="**__Основное:__**", value=f"**Версия:** 1.0.0\n**Серверов:** {guilds_count}\n**Всего участников:** скоро ", inline=False)
print(2)
emb.add_field(name="**__Второстепенное:__**", value=f"**Задержка:** Скоро\n**Запущен:** Скоро", inline=False)
emb.set_footer(text=f"Запросил: {ctx.author.name}", icon_url=ctx.author.avatar_url)
await ctx.send(embed=emb)
Does not work. Only 222 is output to the console, why doesn't it work further?
...
except Error:
print('sorry you ran out')
# This code ran when the error ocurred
print('alr we logged your message')
# this code ran anyway after the except
idk
use an else after the except, or return after the except
def check(message):
return message.author == ctx.author and message.channel == ctx.channel
message = message.content?
or use return await ctx.send()
that would set the message object to the string of the message, is that what you want?
or do you just want to check the content of the message
ah,
message = message.content will never be reached
!d disnake.Message.content
The actual contents of the message.
why buttons interaction failed
code?
I want the content of the message
content = message.content
it will never be reached
so then do it before the return
return msg.author == ctx.author and msg.channel == ctx.channel
msg = await bot.wait_for("message", check=check, timeout=30)
print(msg.content)```
@kindred drum
doesn't work or what?
thanks 🙂
they were helping-
yea saw that
reaction, user = await bot.wait_for("reaction_add", check=check, timeout=60)
do I have to save the user too?
I mean, if user has to be the member who invoked the command anyways
what for another variable
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
!d discord.Member.send
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**.
hunter
i ain't here
yesh you a:
and yea u have to
damn it
else reaction becomes a tuple
Sure
there was something like get_members
ah its fetch_members, nvm
no it returns an async iterator
then there's not even a need for the id
await member.send("hello")```
how many members are we talking about?
not that you wouldn't get ratelimited with this
if it's many
Lmao true
bro you cant mass dm people🗿
What if they just use time.sleep()
Probably won't get rate limited then, right?
why are u even replying to me? 
no
time.sleep will disconnect your bot and ratelimits are dynamic and mass dming users is against tos
Hmm... You're right.

But...
If you ignore the TOS thing, there could be a workaround the rate limit problem simply by using await asyncio.sleep() instead of time.sleep()
yup but you have to await it, its a coroutine


That is the "naive" solution, ratelimits are dynamic; at one moment it could be 5/1s and at another one be 1/5s
hey, its possible to ctx a list of random choice ? if yes, how can i do that please ?
excuse me?
Could you elaborate please?
theyre dynamic they change depending on how many request you make iirc, basically they just change depending
i give you a exemple ok ? ```python
@bot.command()
async def hello(ctx):
await ctx.send({random.choice(list)}
[list] = [f"Hello world {ctx.author.mention}"]
list = [...]```
What is to elaborate? That is as simple as I can get, they can change
yes i know that i just forgot in my exemple
ok so ctx is the Context of the command which is a positional argument which it has a .send method which you can send anything .choice is a method of the module which takes a list?
@bot.command()
async def hello(ctx):
await ctx.send(random.choice([
f"Hello world {ctx.author.mention}",
]))```
variable naming
I got it now, I got confused by the 5/1s and 1/5s
👍
thanks i try this
5/1s means a max of 5 request a second 1/5s means a max of 1 request every 5 seconds
👍
its work thank you and have a good evening 👍
Why ```py
if str(reaction.emoji) ==
hey is it possible to see if a bot has been timed out
What do you mean "timed out"
there is a feature
Oh
where if u have admin
Timeout
you can time people out aka just makethem not talk
yess
i got this 'friend' that has some issues and had admin and may have timeouted the bot but idk
bc the bot isnt saying anything anymore
!d disnake.Member.current_timeout
property current_timeout```
Returns the datetime when the timeout expires, if any.
New in version 2.3.
Hey, how do I delete a message when someone responds to the message with an emoji?
Oh wait
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
disnake is not nextcord. Nextcord uses discord.Member.timeout I believe
*nextcord
mb but yh
!nextcord.Member.timeout
!d nextcord.Member.timeout
property timeout: Optional[datetime.datetime]```
A datetime object that represents the time in which the member will be able to interact again.
Note
This is `None` if the user has no timeout.
New in version 2.0.
Code?
You need to use an instance of nextcord.Member btw
print(nextcord.Member.timeout) isn't gonna actually give you a timeout
There are examples in the docs
wait a minute
You need a Member object. This is simple OOP
my bot isnt even working in my own personal server
Idk how to explain this besides you need to have a member object
where nobody else have admin
Idk how to simplify it sorry
You're missing brackets
nothing is showing up when i do !test
full code?
I got like…200 lines
doesn't matter
Alr
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
Yeh but i want to delete the message on reaction in a commant
anyone here knows what hydra bot uses to play audio now?
i wanna move from youtube to another source
!yt-dl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
Hey, how do I delete a message when someone react to the message with an emoji in a command?
i literally asked about a different source, this has nothing to do with ytdl since i dont even use it
I doubt the source you're going to use allows bots to stream music
I was asking what source hydra bot uses, if they are allowed to use it im sure other bots would be able to
can i edit an already sent message in the on_message event?
If you have the message object, yes
do you know how i would go about getting it?
discord.Messageable.send() returns the sent message
i will try it, thank you
msg = await ctx.send(...)
await msg.edit(...)
and if you dont have the message obj, you can fetch it by using the message id and then edit it
of what class do you think the first param is on your command function?
yeah i tried fetch_message but theres nowhere to get the message from/message.fetch_message and bot.fetch_message
?
you're using msg as first param for every command function, of what class do you think this is?
(this is not the error, I want you to learn something first)
the actual error is in your on_message, because, if you didn't notice yet, not a single command will be working in your case
https://discordpy.readthedocs.io/en/stable/ext/commands/commands.html This will help you
why dont they work because of that
on_message consumes every message, so it doesn't get to the command handlers
hmmmm
It overrides the default on_message
just add
await bot.process_commands(message)
at the end of your on_message and you should be good
Alternatively, use @bot.listen() instead (w/o needing await bot.process_commands(message)
Hey, how do I delete a message when someone react to the message with an emoji in a command?
also, msg as parameter name for a CONTEXT object is just terrible imo
The on_reaction_add event would be what you're looking for
^ I'm assuming commands will provide you with the message, but they provide you with an instance of commands.Context
If you change msg to ctx your code would stop making sense
*start
how does bot.listen work i cant find it
it's a decorator
which takes an event as arg
so in your case
@bot.listen("on_message")
@bot.listen()
async def on_message(message: discord.Message):
...
But i want to do it in a command
you have some options
"Do it in a comment"?
a command he means
A command, I see
ok thx @sick birch and @potent spear
I mean command
Why do you want to do it in a command?
Is it like an interactive set up sort of thing?
being " wait_for" most likely
or a db which stores the msg id, if you want this to work for a very long period
probably some "bin" emoji like this
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
I want to do a reminder and if the reminder was sended i want that the bot react an emoji and if the user react with the emoji too the message will be deleted
Yeah then you'll probably want to use wait_for
asyncio.wait_for()
``` so?
!d discord.Client.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
that should work, remove pass_context and try again
I believe you can only have one argument after the * due to ambiguities
^ this also
you should "consume rest" as last parameter, your make command has no idea what rolenames are and what permissions are
It has to be the second to last one
and maybe rename your command to something like make_role instead of just make
It says that the last argument would consume everything else
I agree, with an alias maybe
also, you dont need pass_context since you are already passing it in the args area
and cuz its outdated
this is very user unfriendly imo, not a single sole that doesn't code knows the permissions by heart
same issue tho
you seriously want to type out all the role permissions?
best would be maybe some kind of selection imo
commands.is_owner()
try that
I'm sharing my opinion, you'll notice later
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
basically for me sometimes the bot.commands are underlined
lol, just do ctrl+alt+L (that's formatting for pycharm)
oh lol
those are "suggestions" not actual errors
share your code, I'll find your error handler
I'll prove you wrong
just use a botvar
bot.count_number = ...
you don't want to use global stinky stuff
just share your code
print something before and after the role creation
you'll see that it'll only print before the role was created and not after
Points even more to an error handler
Because you made it a global...
do you even have a decorator or an on_message? xd
did i do smth wrong at the top
I have to see your code, I don't want to ask for every single possible error tbh
It's not that someone would ever copy your code, let me tell you
@bot.listen("on_message")
async def shit_function(msg):
print("nice message")
Why do you care so much about keeping it private?
more code = more overview = faster solution
???
that's your new on_message
there is your error handler lol
in plain sight
but y the shit_function
You literally have an error handler lmao
that's the whole point
just do
else:
print(error)```
in your error handler and it'll smile back at you
It will eat up every error
@potent spear
How can i ignore the reaction of the bot ```py
reaction, user = await bot.wait_for('reaction_add')
if str(reaction.emoji) == "🗑️":
that's just to not name it on_message again, which could overwrite the main function
there's a check kwarg in wait_for
there, you can check if the user isn't a bot
the docs have a great example
the str(reaction.emoji) stuff can even be in the check too
error handlers are dangerous in a way
or raise error
I suppose your first if statement would be
if msg.channel.name == "count-to-999":
which is of course better, because it tells you the line
mhm, I like making a private channel / make the bot send me a DM with a formatted error (in an Embed) whenever some error occurs
makes sense
k i did that but nothing is happening and i am typing numbers in like this 444 or 123
that way, I never have to look in the terminal to find out what the error was
this time there is no error
how much time is it for y'all to make a tictactoe bot
what is that at the bottom half
what in the world do you think this if statement checks?
bro you seem like a whole ass hacker there
what linux distro is that
to see if there r three numbers
to make sure they are saying like
of course it's arch
cringe
123 or 124
I love it
better option would be the following:
convert string to number
check if number is between 0 and 1000
ive used arch, just not a fan
you spend more time fucking with the os than being productive
"Fucking with the os" is productive though
You get to learn how your system actually works but that's just me
How cam i delete the two recent messages in the channel?
channel.history(limit=2)
wouldn't say its that productive if it hinders stuff like programming
!d discord.TextChannel.purge
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
Eh knowing your system and its inner workings can help you program more efficiently
this is what your sexy check would look like
stripped_message = msg.content.strip()
if len(stripped_message) <= 3:
try:
sexy_number = int(stripped_message)
except ValueError:
return
if 0 >= sexy_number or sexy_number <= 1000:
await message.delete()
```
a very sexy thing you could do:
remove the message if it's not 1 higher than the previous OR if the author is the same as the previous message

I agree yet still rely very hard on other devs which wrap those things in python libs for me
formatting in python > formatting in linux
Now i use this but if i run the command 2 times it didnt work ```py
reaction, user = await bot.wait_for('reaction_add')
if str(reaction.emoji) == "🗑️":
if not user.bot:
async for message in ctx.channel.history(limit=2):
await message.delete()
return
you still haven't put the if statement in the check kwarg, c'mon mate
welcome back ig
How do you mean it?
alright, just remove the *,
‘’’py
@bot.command()
async def buy(ctx,**,item: str, quantity: int):
global iron_sword
global iron_armor
global gold
global iron_mace
global iron_spear
purchase = discord.Embed(title="Successfully Purchased")
if item.lower() == "iron sword":
if gold >= 50quantity:
iron_sword += quantity
gold -= 50quantity
purchase.add_field(name="Iron Sword",value=f"You purchase {quantity}x Iron Sword")
await ctx.reply(embed=purchase)
elif gold < 50*quantity:
await ctx.reply("Bro, come back when you are less broke")’’’
(! Is my prefix)
When I type
!buy iron sword 2, it says missing required argument, can anyone help?
check the wait_for docs
yes, unless you want to make it sexy and add multiple roles at once
how are you invoking the command?
never use global
alright, I'll tell you something, why are you overwriting the member argument in the first line by the author? xd
So? ```py
reaction, user = await bot.wait_for('reaction_add', str(reaction.emoji) == "🗑️", not user.bot)
I know, but I’m too lazy to change it, but is that why?
close
def check(reaction, user):
return not user.bot and str(reaction.emoji) == shitty_bin
reaction, user = await bot.wait_for('reaction_add', check=check)```
who knows just never use global
!global
When adding functions or classes to a program, it can be tempting to reference inaccessible variables by declaring them as global. Doing this can result in code that is harder to read, debug and test. Instead of using globals, pass variables or objects as parameters and receive return values.
Instead of writing
def update_score():
global score, roll
score = score + roll
update_score()
do this instead
def update_score(score, roll):
return score + roll
score = update_score(score, roll)
For in-depth explanations on why global variables are bad news in a variety of situations, see this Stack Overflow answer.
let's first face the first problem
def poop(shit):
shit = "yes pls"
return shit
print(shit("hell no"))```
will always print "yes pls"
you have a similar problem, get that?
you're overwriting your member argument instantly (they have the same name
depends
do you want the member to be you when no member is specified?
alright, pretty simple
member: discord.Member = None
you first of all have to make it default None
then, first line in your function would be
member = member or ctx.author
this basically means
if member is None:
member = ctx.author```
alright, next step, to make sure you can add multiple roles
alright, that makes it easier
then you're all set normally
show the code
pls no screenshots lol
remove the role = line
afterwards, you're all set
actually not really
optional arguments should be the last ones
so it should be role: ..., member: ... = None
so ?addrole @stinkyrole
would give you the stinkyrole
nope
can be the ID, the name or a mention
you have to use role first THEN member ofc
how?
the bot can only give roles lower than him, note that
No it doesnt work
it's also not a selfbot, right?
amount of nerves lmfao
not what I wrote ofc
edited, I did some typo
have you seen Zuckerberg tho?
hes an alien
a Lizard
alien infused with lizard
Boutta hit you guys with the !ot
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
🗿
ruining the fun
L
and ppl like you addicted with being ot
makes a lot of sense
it is
try adding to another stinky guy, and see if that makes a difference
thats the first time ive said something ot in like days
damn, you must be constipated
can you get the role manually and print member.roles?
then also try to get the role via ID right underneath
Were?
omg, Imagine he's using that line tho :/
if should've been return
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.
the error is simple in this line tho:
role names are lowercase
thats the error
and him passing the member object as add_role is his exact issue
thats the reason its not finding the role
anyone got an open source bot they need help with?
you just passed a member object as a role, that was the issue
can you help me pls uwu
hmmm if you dm me a checklist ill just do it
lmao, you must be bored
whats the best way of me making a reminder command
its 11pm and i have 4 hours to kill 😳
this takes a few steps, for sure, a db being one
you would have to make a task to check and compare utc datetimes
sounds very useful
i said dm me things to do
loop how many times?
you don't, you just sleep until
no/
you have to loop it so its constantly checking for matching datetimes
ofc you do, you don't want to check every 5 mins
RDanny (the bot in dpy server) has an opensource reminder command
thats what ive been using
sasuke
you need to think about a lot when making a reminder command
want me to make a reminder system for you?
like make it persistent when the bot restarts etc
yes pls
txt
postgres
for what
everything
Anyone here good with pytesseract and pyautogui dm me im tryna create a bot for something
uhh
if it's automation, try scraping first
I feel like it's a scraping issue
@potent spear
i sent in d.py a ss #381965515721146390 message
why is this happening bruh
shots fired
@fringe harness bro why did you sent the same msg in #data-science-and-ml #esoteric-python #game-development its not even on topic to the topical channels?
very unnecessary imo
that's a desperate man in need of some help
Ight, so I am trying to make a bot answer these questions rlly fast, so I am trying to use ocr to get the questions and answer it, and then I will try to correspond the answer to one of the choices and press 1,2,3,4 to get the correct answer
jeez
*2
#software-architecture are better channels
seems like fun
i hate to say it
then why said it
but noones going to help you write in c++ and rust making a realistic blackhole simulator from scratch
then why do it if you dont have the coding ability?
ever used requests?
although just some scraping is a fun way too
super advanced to the point where you cant even make it
Nah I havent
alright, you need a screenshotting tool, an OCR tool (image recogn) and some sexy calculations
lmfai
🗿
Doesnt pyautogui have an ss tool
yup, great option
the great news is: your text fields are very recognizable because they are in different coloured boxes
How will I do the calculations and correspond it with an answer tho everything I can do
does anyone have an open source bot
that's like the last step to worry about, after you did image recognition on the screenshots
RDanny does
Alr well I’ll start and ill see if I have any issues
i mean someone here
should be a fun project, ngl
what's the website?
If you want, we can code it together, but we'll make a decent task management, so we're not overwriting each others code etc
Ye
aight time to fix it all
you clearly know where you're going with it tho xd
Ight
wtf is this set_event_loop_policy(WindowsSelectorEventLoopPolicy())
I can see it since you have lots of empty folders
Dm me about it
i see
if os.name == "nt":
set_event_loop_policy(WindowsSelectorEventLoopPolicy())
``` im dong this so you can use it on linux as well
from config import TOKEN, DB_USER, DB_PASS, DB_HOST, DB_PORT whats config
up to you
im doing a lot of code refactoring btw
like bot.py is going in core/
license = "MIT"
no licence in the repo:
ill add it for you
is it possible to subclass a button inside of a button?
from disnake.utils import search_directory
whats this
doesnt exist
let me go look at soure code
NEGATORY
disnake/utils.py line 1209
def search_directory(path: str) -> Iterator[str]:```
mm i had a fucked disnake version
time for my own bot to be broken
anywayy
is config a python file
!d edit
async def start(self, token, reconnect) -> None:
where do you even call this
how do i edit a message?
!d disnake.Message.edit
await edit(**fields)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
Note
If the original message has embeds with images that were created from local files (using the `file` parameter with [`Embed.set_image()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_image "disnake.Embed.set_image") or [`Embed.set_thumbnail()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_thumbnail "disnake.Embed.set_thumbnail")), those images will be removed if the message’s attachments are edited in any way (i.e. by setting `file`/`files`/`attachments`, or adding an embed with local files).
is it the same in discord.py?
yes
!d discord.Message.edit
await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the message.
The content must be able to be transformed into a string via `str(content)`.
Changed in version 1.3: The `suppress` keyword-only parameter was added.
The bot calls it internally when running Bot.run(...)
ok
https://paste.pythondiscord.com/aqutuzadot Ignoring exception in view <Mychoice timeout=180.0 children=2> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='Robot' emoji=None row=None>: Traceback (most recent call last): File "C:\Users\nikit\PycharmProjects\discord.py\discord\ui\view.py", line 359, in _scheduled_task await item.callback(interaction) TypeError: Mychoice.robot_callback() takes 2 positional arguments but 3 were given
Application command synchronization:
GLOBAL COMMANDS
===============
| NOTE: global commands can take up to 1 hour to show up after registration.
|
| Update is required: False
| To upsert:
| -
| To edit:
| -
| To delete:
| -
| No changes:
| -
Command synchronization task has finished
``` why tf is this getting printed
async def robot_callback(self, interaction):
it takes button, interaction
i see...seems annoying af but whatever
¯_(ツ)_/¯
you've got no commands as of right now correct/
mm okay
welll ive done a bit but considering theres not much ill just submit this pr unless you want me to add something
want me to add this to my pr?
ok
this
if isinstance(message.author, Member):
could've just been
if message.guild is None
linter?
you're also checking some same stuff multiple times
~line 17 & 29
pr'd
what next, ive got 3 more hours
im not a creative dude
@potent spear need help with anything?
is the precommit generated?
wdym? i wrote it out
cough defo didnt copy and paste it
realistically noone writes them
LICENSE and precommits are always copy and pasted
yaml is a pain in the ass for me
bad_words = await connection.fetchval(sql_queries.SELECT_BAD_WORDS_FROM_COLLECTIONS, user_id)
if not bad_words:
bad_words = 0```
```py
bad_words = await connection.fetchval(sql_queries.SELECT_BAD_WORDS_FROM_COLLECTIONS, user_id) or 0```
what?
i didnt write that
it might look like i wrote that because black goes in and formats everything
thats his
lmao
yes black likes crediting itself for doing nothing
damn I should defo start using precommit hooks
y e s
instead of reformatting right before committing lol
i reformat before anyway because i dont trust automatic shit 😳
How do you make discord bot online 24/7
by not turning it off
Genius
‘@bot.command()
async def buy(ctx,**,item: str, quantity: int):
global iron_sword
global gold
global iron_mace
global iron_spear
global iron_halberd
purchase = discord.Embed(title="Successfully Purchased")
if item.lower() == "iron sword":
if gold >= 50quantity:
iron_sword += quantity
gold -= 50quantity
purchase.add_field(name="Iron Sword",value=f"You purchase {quantity}x Iron Sword")
await ctx.reply(embed=purchase)
elif gold < 50*quantity:
await ctx.reply("Bro, come back when you are less broke")’
(! Is my prefix)
When I do !buy iron sword 2, it says required element ‘quantity’ is missing
How do I fix this?
you made quantity a kwarg
But I’m not using button
how not do that?
@discord.ui.button(label="Robot", style=discord.ButtonStyle.green)
?
Oh
think about the logic; you did , *, item meaning you want everything to be captured as item, yet also want quantity? how does that work ??
Ye ur right
It works now thanks
i did nothing except tell you to think about the logic, maybe this foreshadows your entire programming experience
slowing down and thinking about logic is always a good way to go
Yo guys what can I use instead of global
!code
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.
!bot-vars
Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"
@bot.command()
async def get(ctx: commands.Context):
"""A command to get the current value of `test`."""
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
"""A command to set a new value of `test`."""
# Here we change the attribute to what was specified in new_text
bot.test = new_text
This all applies to cogs as well! You can set attributes to self as you wish.
Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!
how can i get the button author?
the author of the person who clicked the button? interaction.author
oh thanks
AttributeError: 'Interaction' object has no attribute 'author'
!d disnake.MessageInteraction.author
The user or member that sent the interaction.
How do I make it so that each person has a separate variable
async def dev(ctx):
global iron_sword
iron_sword += 100
(This gives everyone 100 iron swords)
you use a dictionary
!d discord.Interaction.user
The user or member that sent the interaction.
Ok I used a dictionary, but it doesn’t define the variables
You don't use it to create the variables. You make key/value pairs with the data you want
how do I create separate variables for each user?
I have been procrastinating learning SQLite but I will have to now 😭
how to make a simple inventory system?
anyone know how to add a command handler
@bot.event
async def on_command_error(...)```
!d discord.ext.commands.Bot.on_command_error
await on_command_error(context, exception)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
The default command error handler provided by the bot.
By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.9)") however it could be overridden to have a different implementation.
This only fires if you do not specify any listeners for command error.
tysm
also
i got a error for cogs avatar url
Yo guys just making sure,
Databases can create variables for individual people right?
found error
sort of
Wdym
if you specify a variable that pulls a record from a database, I guess
do i have to get the channel id or smth
but, why have tons of variables pertaining to the DB for each user, if you have the fucking db right there
cuz i got an error about str and no attribute of send
You need to get a channel object
A string object has no send method
wdym by str object
string literal a.k.a "count-to-999"
!e
print(type(""))
@final iron :white_check_mark: Your eval job has completed with return code 0.
<class 'str'>
@mellow gulch ^
!e print(type("count-to-999"))
@slim ibex :white_check_mark: Your eval job has completed with return code 0.
<class 'str'>
turn what into a str object?
anything that is wrapped with "" or '' is a string literal/obj
a random string like count-to-999 doesn't have a send method
you can use get_channel to get a channel by id as the id will have a send method
You don't have to do `` for the markdown
You should prefer to use `
Because on mobile it doesn't show
true
so i get the id then
You need to get a channel object
what would I put before the get_channel
whatever your bot var is
bot.get_channel
If you're in a cog it would be self.bot.get_channel
wouldn't ctx.guild.get_channel also word?
Never said it wouldn't
how can i defend against a spammer, like if they spam 5 messages in 3 seconds it kicks
use bot.wait_for() in on_message
you want wait for a certain amount of time, if a user sends a message try it again 5 times, in total 3 seconds and if they all run because the user sent 5 messages in 3 seconds await member_obj.kick()
what arg would i use?
for bot.wait_for?
the syntax for bot.wait_for is -
try:
await bot.wait_for('event_here', timeout=seconds_for_timeout, check=check)
except asyncio.exceptions.TimeoutError:
# code if the timeout ends
else:
# code if check=True and timeout is not over
btw can any moderator lurking the chat pin this?
because new ppl can just read pins when using bot.wait_for
asyncio.TimeoutError works fine
check=check works?
eh, either way
The docs exist
if your check function is called check
and how would I check?
if they read them they wouldn't be here
No
def check(m):
anything built in or would i haft to use txt files
You can't do everything with just the docs
well bot.wait_for is explained there
for certain things it would save a trip here
yes, im guilty of not reading the docs
That's my point...? Why would moderators pin it if there are a ton of examples in the docs
oh, alr
ill peek in the docs as well, ty for the info
if you event is 'message' it would be ```py
def check(m: discord.Message):
return m.author.id == message.author.id
Would run code under the else if the same user sent a message before the timeout ended```
would this only apply if the user is spammed consecutively
yes
so if someone chats in between they're cleared
isn't that would your trying to check
yes
hm..
you can run it multiple times under the else to check if lets say, 5 messages are spammed by the same user under 5 seconds
just use a bit of logic
and would I keep track with like a json file?
No
Don't use json as a database. It simply isn't one
Check the pins of #databases for some resources
oh alr
arl, stop fucking up IDEs
nO i refuse
cough cough before this goes OT
I'mma just go away
don't worry i won't !ot you
👁️ 👁️
What's this
i made it worse
so in short my editor is on fire rn
folks, this is why you don't work on discord api wrappers
😂
wait a sec ALL discord bots will now have to use slash cmds? i thought it was just for unvertified bots
Yea it's for verified bots only
Message Content is gonna become a privileged intent
so why are big bots like dishboard switching to slash commands because it says discord requires to be slash cmds
Because they have to have a valid use case to get access to message content
i have the id of a user i want to add a role to. How do i, with the user's id, add the role to the user?
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
ty
!d discord.Member.add_roles
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.
await bot.get_member()?
k
member = message.guild.get_member(member_id) is returning none help
!d discord.User.send
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**.
You need a user object
This is basic dpy my guy
You need a user object
A string object will not have a send method
You can get a user object with
!d discord.Client.fetch_user
await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.
Note
This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.get_user "discord.Client.get_user") instead.
This timed mute command is not working. Please help me! (It uses asyncpg)
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
The ID is wrong
yea i fixed it
Sure?
Adding on, async for row in conn.cursor("SELECT * FROM mutes WHERE unmuteTime < now()"): seems to be the problem, since GOT HERE isn't going through
Imagine not using timeout 
But if you use that, if your bot goes down, wouldn't all mutes be indefinite?
no?
no, timeout is inbuilt with discord, you just send a request to the api with a period argument
wait wait whats timeout?
if youre using a db and your bot goes down it will go on until the bot gets online the built in no it gets tracked by discord
though there already is an inbuilt slash command for that purpose
!d disnake.Member.timeout
await timeout(*, duration=..., until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Times out the member from the guild; until then, the member will not be able to interact with the guild.
Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.
You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.
New in version 2.3.
dpy doesnt support
but there is an inbuilt slash command within discord for timing members out
so, mute commands are rendered useless really
unless you want a few channels open for the muted members
Discord updates be like

Discord ruins my life

but I still would like to know what the problem is
anyways, kill it, dont spam emojis
huh
so I have a problem in my code, my code is not working on this event
for fn in os.listdir("./cogs"):
if fn.endswith(".py"):
client.load_extension(f"cogs.{fn[:-3]}")
@client.event
async def on_ready(*, extension):
client.load_extension(extension)
@client.command()
async def load(ctx, *, extension):
client.load_extension(f"cogs.{extension}")
await ctx.send("Loaded cog!")
@client.command()
async def unload(ctx, *, extension):
client.unload_extension(extension)
await ctx.send("Unloaded cog!")
@client.command()
async def reload(ctx, *, extension):
client.reload_extension(extension)
await ctx.send("Reloaded cog!")
on ready doesnt take any arguments
!d discord.on_ready
discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
Oh
its an event that gets triggered when the cache gets populated
which can happen many times
Ok thank you
Youre very welcome
Someone ask something 😩

Dead channel
And?
starting an argument to make the channel alive is not a good thing to do btw
im not typing?
Here I'll ask a question for something imma eventually get around to fixing, so On_disconnect happens multiple times in a row when it actually disconnects and i only want it running once until it reconnects, so i currently have a global variable storing the state and it gets set to false when on_disconnect runs and it gets set to True when on_connect runs, is this an okay solution? Or is there a better way of doing it
You were
Mainly for logging disconnect times btw
well ofc on_disconnect fires many times
I mean in succession, im aware it runs multiple times lol
probably insert it to a json file or something idk
It'll run 9-10 times within a minute of it disconnecting. I imagine its because on_disconnect is triggered when a connection fails including when it fails to reconnect.
yes it fires when the bot gets disconnected from the gateway
So is running a global variable check a good solution to this?
probably on each event just insert a datetime obj in a json file so you know it disconnected and when
helo okimi
hi
why if item != "brewing stand" or item != "sword" or item != "armor": is always true :vv
Okay that's exactly what I've done, I'll just leave it alone then
Do multiple not checks work like that?
probably because theres no matches you could check if you want with an else statement
checks for?
theres no matches
🗿 ??
sorry sorry it will return true if item is not the same
yes?
print whats item
if item != "brewing stand" or item != "sword" or item != "armor":
print(item)
print("item_list")```
me test `item = "brewing stand"` and it friggin print `item_list` and `brewing stand`
show your params
function?
yup
async def check_item(user, item):
user = str(user)
async with aiosqlite.connect('database.db') as db:
if item != "brewing stand" or item != "sword" or item != "armor":
print(item)
print("item_list")
item = item.upper().replace(" ", "_") if " " in item else item.upper()
cur = await db.execute(f"SELECT {item} from item_list where NAME = ?", (user,))
it = await cur.fetchone()
item = it[0]
elif item == "brewing stand":
cur = await db.execute("SELECT BREWING_STAND from users_data where NAME = ?", (user,))
it = await cur.fetchone()
item = it[10]
elif item == "sword":
cur = await db.execute("SELECT SWORD from users_data where NAME = ?", (user,))
it = await cur.fetchone()
item = it[11]
elif item == "armor":
cur = await db.execute("SELECT ARMOR from users_data where NAME = ?", (user,))
it = await cur.fetchone()
item = it[12]
return item
``` tbh that's [#databases](/guild/267624335836053506/channel/342318764227821568/)
Is it because your using ors instead of and?
no no your commands params
🗿 wut
your commands parameters
i'll try this first
nah then the argument needs to be the same as the first string and the second
Oooh yeah your right
!e
print(True if (a:=1) == 1 and a == 2 else False)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
False
since the if statement isnt correct False was returned
I'm just getting lost in, and or logic im fine lmao
ok ok i got you with an example 🙂









