#discord-bots
1 messages · Page 1033 of 1
member_data = load_member_data(ctx.author.id)
if i plug in a different thing like wallet instead of shovel it works too
show the json file
the data.pickle file?
return Data(0, 0, 0)
yep
if u mean that i have that rn doesnt work
oh
Hi
yes
its just weird characters why
r u saying i have to delete it and make a new one
oh
the file is encrypted
Hi im havingnindent errorv
show ur current code
i didnt change anything
where do you use save_member_data?
besides
@client.command(aliases=['item', 'items'])
async def shop(ctx, item=None):
member_data = load_member_data(ctx.author.id)
if item == None:
member_data.shovel += 1
em=discord.Embed(title="Shop",description=(f" **Shovel** ({member_data.shovel}) - 10,000\n╰ A shovel neccessary for the dig command, very useful!") , color = discord.Color.teal())
await ctx.reply(embed=em)
save_member_data(ctx.author.id, member_data)
return
elif item.endswith('shovel'):
await ctx.reply("shovel is a shovel that digs the ground that the shovel is bought from the shop")
save_member_data(ctx.author.id, member_data)
return```
indent prints
Why
unindent else
What
because of the spacing
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
can you try printing member_data
What
the else is spaced out too much
No
if 1:
print(1)
else:
print(none)
Well it is, idk why you are countering the answer.
U noob
also the else is capitalized
This should work. Also, this isn't related to Discord bots, you can ask in #python-discussion next time :)
None as well
Yes he's noob
Nvm too many typos
but None is capitalized
Indeed, this would still error.
can you try deleting the pickle file and inserting Data(0, 0, 0)
It doesn't hurt to be a bit nicer.
i copied your code i didn't noticed that the "none" is not None
It's hard to help those unfamiliar with Python, the best you can do is help or stay back and let others help. Calling someone a noob is kind of discouraging, you can definitely be nicer by just not saying anything.
!e
print(None)
@nimble plume :white_check_mark: Your eval job has completed with return code 0.
None
See it works dont argue
yeah although that will delete everyones coins and items
if you are too smart then get the hell out of here then
try updating the data then save_member_data(id, Data(0, 0, 0))
Nobody asked
idc
wdym (also it worked but i rlly wanted to avoid deleting all the data)
Bru- ok
Lmao just because you knwo more than people doesn't mean you have to rub it in their face
@slate swan @nimble plume, You guys are both being very defensive. I suggest just ignoring each other.
he is being rude
yeah i was talking about newbie
oh
hi
is there any way i could avoid erasing all data
Some of us do yes, best is to just ask the question, rather than asking if there is someone who knows.
Yeah, do what I said earlier (insert the correct data) save_member_data(id, Data(0, 0, 0))
where would i put that code
at the return Data(0, 0, 0)?
Very good question, I solved this by making a Client and subclassing CommandTree of discord.app_commands
Hiiiiiiii
There are many ways, through error handlers. You can create error handlers local to the command, the cog/tree in question, or the entire bot.
Right
you can use @my_app_command.error for an individual command or @tree.error for the command tree. you also can subclass CommandTree and make an async function on_error
I have overridden the default on_error and made it a custom one.
!d discord.app_commands.CommandTree.on_error
await on_error(interaction, error)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
A callback that is called when any command raises an [`AppCommandError`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.AppCommandError "discord.app_commands.AppCommandError").
The default implementation prints the traceback to stderr if the command does not have any error handlers attached to it.
To get the command that failed, [`discord.Interaction.command`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.Interaction.command "discord.Interaction.command") should be used.
There we go
!d discord.app_commands.CommandTree.error
error(coro)```
A decorator that registers a coroutine as a local error handler.
This must match the signature of the [`on_error()`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.CommandTree.on_error "discord.app_commands.CommandTree.on_error") callback.
The error passed will be derived from [`AppCommandError`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.AppCommandError "discord.app_commands.AppCommandError").
how can I print(1)
!d discord.app_commands.Command.error
error(coro)```
A decorator that registers a coroutine as a local error handler.
The local error handler is called whenever an exception is raised in the body of the command or during handling of the command. The error handler must take 2 parameters, the interaction and the error.
The error passed will be derived from [`AppCommandError`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.app_commands.AppCommandError "discord.app_commands.AppCommandError").
Sure, this is my code of a custom handler. Not a lot now but easily expandable. ```py
from discord import Interaction
from discord.app_commands import CommandTree, AppCommandError, Command
from discord.errors import NotFound, HTTPException, Forbidden
from log import log
class CmdTree(CommandTree):
"""A subclass of CommandTree to override on_error"""
async def on_error(self, interaction: Interaction, command: Command, error: AppCommandError) -> None:
# Per usual, getting the original error
error = getattr(error, 'original', error)
log.debug("Reached error_handler")
if isinstance(error, (NotFound, HTTPException, Forbidden)):
log.warn(f"'{interaction.command.name}' command raised {error.status} {error.__class__}")
raise error
else:
raise error
How do I do a masked link
If it's in a webhook or certain fields in an embed : (text)[url]
In an embed its [name](https://www.google.com "hover text!")
where would i put that code
im trying to do in a embed add field
Is it working?
got an unexpected keyword argument 'url'
Up to you
embed.add_field(name=str(field[0]), value="![test]!({})".format(variable))
what
Could you show the code?
Really it is
He already did gave you the solution.
wherever i am putting it it doesnt work
Put it where you save the user in the file
embed.add_field(name="> **Artist**", value=artist + "\n", inline=False)
its like giving someone a book on how to read
idk if thats a good example but yeah
maybe its when you try to load the data from the file you the else return a dictionary
This isnt the part where it gives that error. You are putting url=... somewhere where it doesnt belong.
yes, I tried adding url=''
am not understanding
True and while giving the book sifte gave you the explenation in images as well.
def load_data():
if os.path.isfile(data_filename):
with open(data_filename, "rb") as file:
return pickle.load(file)
else:
return dict()
yep i have that
i add to that?
the else return a dict
@cloud dawn
embed.add_field(name="> **Track**", value=f'{track}' + "\n", url=f'{songurl}', inline=False)
!d dict
class dict(**kwargs)``````py
class dict(mapping, **kwargs)``````py
class dict(iterable, **kwargs)```
Return a new dictionary initialized from an optional positional argument and a possibly empty set of keyword arguments.
Dictionaries can be created by several means:
• Use a comma-separated list of `key: value` pairs within braces: `{'jack': 4098, 'sjoerd': 4127}` or `{4098: 'jack', 4127: 'sjoerd'}`
• Use a dict comprehension: `{}`, `{x: x ** 2 for x in range(10)}`
• Use the type constructor: `dict()`, `dict([('foo', 100), ('bar', 200)])`, `dict(foo=100, bar=200)`
yes so what do i do about that
save_member_data(id, Data(0, 0, 0, 0))
in the else statement?
Yeah add field doesnt take url there
You put in the value string
can I see an example of what you mean?
@sick birch could you show an example im on phone rn
ok
Sure I could. IIRC they work in descriptions, and what else?
url = 'https://www.google.com'
emb = discord.Embed(
title='Cool embed with a link'
description=f'[Click me!]({url})',
...
)
await ctx.send(..., embed=emb)
# CURRENCY ATTEMPT!
import pickle
data_filename = "data.pickle"
class Data():
def __init__(self, wallet, bank, shovel):
self.wallet = wallet
self.bank = bank
self.shovel = shovel
#Commands
blah blah blah
#Functions
def load_data():
if os.path.isfile(data_filename):
with open(data_filename, "rb") as file:
return pickle.load(file)
else:
return dict()
def load_member_data(member_ID):
data = load_data()
if member_ID not in data:
return Data(0, 0, 0)
return data[member_ID]
def save_member_data(member_ID, member_data):
data = load_data()
data[member_ID] = member_data
with open(data_filename, "wb") as file:
pickle.dump(data, file)
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')```
if i want to add shovel, how would i go about doing that because it isnt working
its saying Data object has no attribute shovel
how would i add shovel without erasing all data
I'm not 100% sure if Discord lets you have links in field values, give this a whirl anyway:
url = 'https://www.google.com'
emb = discord.Embed(...)
emb.add_field(..., value=f'[Click me!]({url})')
await ctx.send(..., embed=emb)
You're pickling to a JSON file?
Probably not the best idea
what would be the better option for keeping data for currency bot
They do
Database
that would be easy to add items like shovel
what if I want a variable in the []
I wouldn't be surprised if you're losing the shovel attribute from pickling
so pickle = bad
url = 'https://www.google.com'
text = 'Click me!'
emb.add_field(..., value=f'[{text}]({url})')
More times than not
so whats the easy alternative
that would make shovel easy to add without losing all data
I'd suggest using a proper database
like what (im a noob)
Sqlite is by far the easiest (serverless, single-file). Disadvantages are that it doesn't scale that well, and is unsecure.
If you decide you want to improve your data storage architecture later on, you'll want to go for something more heavy duty and robust like postgresql
embed.add_field(name="**Track**\n> ", value=f'[{songurl}]({track})', inline=False)
it's just sending the url not as a hyperlink
What do you mean "it's sending the url not as a hyperlink"?
so you think sqlite for rn? how would i implement that instead of pickling
https://sqlbolt.com/ I see this suggested a lot for people diving into databases
If you like the JSON-like key/value format, MongoDB is used for that
You may wanna look into an ORM for mongoDB as I've heard it said that NoSQL queries are a pain in the arse to work with
i dont really know what any of that means
embed.add_field(name="**Track**\n> ", value=f'[{track}]({songurl})', inline=False)
How can I make it send without the > showing
but you would say learning sql for right now would be good?
That's alright. Baby steps. First learn SQL, commands, and how it works. You can go from there
ok
How is sqlite unsecure?
Of course, SQL is an industry-standard and knowing how to use it is an invaluable skill
and with sql i can add stuff like shovel with deleting all data?
It's a single file, if you were to get rootkitted (for the sake of argument), there's not much you can do about it
That's not to say it does have some security of course
Very unlikely
?
It's just not on par with databases like MySQL or postgres
Just remove it
embed.add_field(name="**Track**\n ", value=f'[{track}]({songurl})', inline=False)
I want it show like
example
Sql is like excel but without user interface and more strict towards data types.
honestly this one of the most confusing codes ever
so sql is just making tables
right
so ig thats rlly good for a currency bot
thx for the explanation
Most RDBMS (relational database management systems) use a table mechanism
and thx RB
it want to use a dict then covert somehow to a object and then save it like a dict
Not just that, but for most discord-related data, which just so happens to be relational
lol
i'm trying to wrap my head around this and my mind breaks every time i try to understand
this sounds like an XY problem
You think what you're looking for is the solution (Y) to your real problem (X), but your attempted solution is a problem in and of itself
If we know what your real problem is, we can assist you better
xy-problem
The XY problem can be summarised as asking about your attempted solution, rather than your actual problem.
Often programmers will get distracted with a potential solution they've come up with, and will try asking for help getting it to work. However, it's possible this solution either wouldn't work as they expect, or there's a much better solution instead.
For more information and examples, see http://xyproblem.info/
oh
🧠
Unless...
I refuse to believe this is not an XY problem
You forgor again
oh
spoke too soon
it is more than likely i will forgor again
in which case I hope okimii will be here to remind me to unforgor
Okimii really just came in here to correct a helper
Which as is very satisfying can confirm.
I don't mind being corrected when I say something stupid 😛
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 382, in _run_event
await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 76, in on_raw_reaction_add
await payload.member.add_roles(role)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\member.py", line 975, in add_roles
await req(guild_id, user_id, role.id, reason=reason)
AttributeError: 'NoneType' object has no attribute 'id'
send code ig
async def on_raw_reaction_add(payload):
if payload.member.bot:
pass
else:
with open('JSON/reactrole.json') as react_file:
data = json.load(react_file)
for key, value in data.items():
emoji = payload.emoji
role = discord.utils.get(client.get_guild(payload.guild_id).roles, id=829665222380879912)
await payload.member.add_roles(role)
i think you need to put two variables separent like the ctx(context) and the payload(data)
embed.add_field(name="**Artist**\n ", value=f'> [{artist}]({artistfinalurl})' + "\n", inline=False)
It's sending wrong again @sick birch
What's it sending?
Can you show me an example?
maybe i should be the helper😳
ill always be here to make you remember/unforgor
Could be because of the > at the start
good song ngl
don't think so. I have another field with > aswell and it works as it should
hmm anyone know?
@client.event
async def on_raw_reaction_add(payload):
ctx = await client.fetch_guild(payload.guild_id)
if ctx.member.bot:
pass
else:
with open('JSON/reactrole.json') as react_file:
data = json.load(react_file)
for key, value in data.items():
emoji = payload.emoji
role = discord.utils.get(ctx.roles, id=829665222380879912)
await ctx.member.add_roles(role)
@slate swan do you know?
Can I make 2 bots using 1 event loop?
sifte you probably can help me your a genius
no idea sorry
depends tbh
could it be how im replacing?
nah it looks fine to me
artisturl = toptracks["artist"]["#text"]
artisturl = artisturl.replace(" ", "+")
artistfinalurl = f"https://www.last.fm/music/{artisturl}"
On?
library
artist variable has a newline character
oh yeah it does
strip it
or use .splitlines()[0]
i thought that was just his client lmao
I had a \n I added on accident 🤣
happens \🐢
async def reactrole(ctx, Member):
button = discord.ui.Button(style=4, label="React!")
embed=discord.Embed(title="React to this message", description="Want to see the rest of my server? Click the reaction button to give you the role")
async def button_callback(interaction):
await interaction.response.edit_message(view=None)
button.callback = button_callback
view = discord.ui.View()
view.add_item(button)
await ctx.send(embed=embed, view=view)
return
with open('JSON/reactrole.json') as json_file:
data = json.load(json_file)
new_react_role = {'role_name': role.name,
'role_id': role.id,
'emoji': emoji,
'message_id': msg.id}
data['Member'] = new_react_role
with open('reactrole.json', 'w') as f:
json.dump(data, f, indent=4)
``` How do i make it give the role to the user? when he/she clicks the button
await interaction.response.user.add_roles()
you have a nl or smth, probably. if not that then a non printing character between smth probably
uh, no.
interaction.user.add_roles, probably
yeah I had a \n in there somewhere
ah lol
Ok I’ve got a bit of an issue with a bot
I’m making something that will take a file of images on my computer and upload each one to a channel
Presumably this could be a LOT of images ~ 2k
The bot works with just a for loop iterating through each file and adding it as an attachment but it’s very slow
If I try to use webhooks, I get the same amount of speed
Any way to optimize this?
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
You have to add tags to your bot
Congrats on 76+ servers 
Hey i need a little help with my bot
.py''''
async def on_message(message):
if str(message.channel) == "general" and message.content != "":
await message.channel.purge(limit=1)
.py'''
i want it to delete a specific wors
word like duck
whnever it is said
!codeblock To format Python code, not .py''''
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.
You can simply make a basic if check
!e
string = "I like ducks"
if "duck" in string:
print("Yes")
@slate swan :white_check_mark: Your eval job has completed with return code 0.
Yes
can someone explain the ascii coloring
ASCII coloring?
I meant ANSI
can I see some example code for say, red
Please. Read the guide
There is everything explained if you take the time to get to links we send to help you.
I've read it it's just sort of confusing in a way
There is even an example
And I don't believe you've read it within a few seconds after I've sent it
[0;30mGray[0m
[1;30mGray bold[0m
[4;30mGray underlined[0m
[0;31mRed[0m
[1;31mRed bold[0m
[4;31mRed underlined[0m
[0;32mGreen[0m
[1;32mGreen bold[0m
[4;32mGreen underlines[0m
-- I stopped adding the bold & underlined version --
[0;33mYellow[0m
[0;34mBlue[0m
[0;35mPink[0m
[0;36mCyyan[0m
[0;37mWhite[0m
[0;40mFirefly dark blue background[0m
[0;41mOrange background[0m
[0;42mMarble blue background[0m
[0;43mGreyish turquoise background[0m
[0;44mGray background[0m
[0;45mIndigo background[0m
[0;46mLight gray background[0m
[0;47mWhite background[0m
[0;40m\u001b[1;32mTestomg
Look at these examples
\u001b[0;40m\u001b[1;32mThat's some cool formatted text right?
or
\u001b[1;40;32mThat's some cool formatted text right?
Then replace \u001b with the correct character if you don't use it with a bot.
You can copy it from here http://www.unicode-symbol.com/u/001B.html
Overview of U+001B code point glyphs and encodings
all these are viewable on mobile too?
Nope
what does it look like on mobile?
Like plain text
A square, then the code and text [0;30mGray
Hello, just wanted to share this post here about my first bot as I used the search box from this channel to figure out solutions to several issues I was having. Also thank you to the people who answered my questions, it was very helpful. https://www.reddit.com/r/Discord_Bots/comments/ull3vh/i_made_a_discord_movie_bot/?
Not related to discord bots. In addition to that, it's a personal choice only you can make.
"Awesome" idea I guess, just that I don't believe the quality is anywhere near the quality of getting the movie directly. Not sure about that, but I don't believe advertising is allowed here, even though the bot is private.
Not a reason ask in a topical channel unrelated to IDEs and games.
As I said, stop asking these questions here.
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
That doesn't matter
You need to follow the rules just like anyone.
How about being patient :)
sure
It's part of being a developer
yes
And I don't see any messages sent by you related to whether or not it's good to use VSC and how to install it.
No wonder you didn't get any responses.
huh
i asked again already
hm
you provided a keyword "entity" which help commamd doesn't take
!d discord.ext.commands.HelpCommand
class discord.ext.commands.HelpCommand(*args, **kwargs)```
The base implementation for help command formatting...
await ctx.invoke(self.client.get_command("help"), entity="reactionroles")
just do ctx.send_help("reactionroles")
I mean i want it to look like this
hi
error: failed to push some refs to 'https://git.heroku.comjsdjflkjflkgit'``` anyone ? trying to upload discord bot to heroku
did you do what i said?
so you didn't subclass your HelpCommand class
thats what your issue is, and i believe menudocs( the tutorial) you are using did.
Mmm i assure you i did
so create a embed
am talking about your help command, not your rr command.
i think thats the one but when he tried the cmd before he made his reaction class his looked embeded
so embed urs
he subclassed his help command, unlike you
the invoke/send_help doesn't work magically and creates an embed
it uses your help command class for doing that
ok so embed it in the subclass commands.HelpCommand
uh tbh it is not necessary to subclass HelpCommand class, you can disable the help command when creating the bot instance and then you can create another one after. Of course subclassing is recommended but it's not the only way
commands*
yes
and other help commands that you create can have embeds, webhooks, buttons and wathever you want just like the help commands subclassed
they asked why does ctx.send_help() send the default help instead of the one they made following the tutorial, i was replying to that
Oh it was for that
i'm a little confused looking at the docs.. how can i use bot.wait_for() to detect a certain reaction on a certain message?
wait_for("reaction_add", check=...)```
bot.wait_for("event name") waits for an event to dispatch, so for example if you want to detect a reaction you would use bot.wait_for("reaction_add")
to make sure its on a specific message you would have to use a check function ```py
def check(reaction, user):
if <condition to check message id>: return True
reaction, user = await bot.wait_for("reaction_add", check=check)
i know that much, the check is where i'm getting confused... how do i confirm that it's on a certain message and the reaction is a certain emote?
can the check be put inside a command?
yes
yes
ofcourse
the check can be a lambda, a function or just a statement expressed when you create the wait_for
You need it because otherwise everytime the event is triggered the wait_for will be resolved
but it will keep listening for reactions until the timeout is over, right?
yes
no, it will only listen to the first reaction which matches the predicate
the check will take as arguments the same arguments given for that event
like a check for the message event wait_for will take the message as argument
yep
for that u can use the except timeout error and get all the info u want from the message object and reaction objects
Well it doesnt show on the video that he embedded his help cmc
any ways i think i got it idk
I was adding jishaku in my bot but its shows this error
how do i check what emote it is ;-;
;-;
wow this is unexpected
As the documentation says (https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.wait_for):
@client.event
async def on_message(message):
# Stuff
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '👍'
^^^^^^^^^^^^^^^^^^^
# More stuff
Will you get verified
ty ty ty
congratulations 🎉
You're 13 years old right?
BRUH
im 16
Not yet
gg i need to wait for december
Very big
nola same as ashley
is there an easy way to port a discord.py bot to pycord?
but my skill compared to her 💀
Ashley who?
Why would you do that, pycord is not a good library to switch to
the girl
because discord.py is deprecated?
yesterday
No?
this one
They "revived" it
Outdated information
this one?
And check this message #381965829857738772 message
epic canary
69
ya
but this server is like
pepo rarely answer question
Or in a toxic way
true
I personally don't really like that server
just keep shouting at u
Just there for updates
and nvr tell u the solution
...
I'm shouting
bruh
How do get warn
🤦
There's one guy who doesn't know anything but pretends otherwise
Do we get nitro on 30 warns?
😩
...
Lots of people there have an ego as big as the Mount Everest. There are some really helpful people, but that's not the majority.
def check(reaction, user):
if reaction.message.id == em.id: return True
reaction, user = await bot.wait_for("reaction_add", check=check)
my two braincells got me this far, now, how do i call a function when the correct reaction is added?
.
Can u name the last letter of their namd
You need to add a new check in your check function.
The example on the documentation is what you need, take a look at it.
Second example
You don't need a if statement
You can just return reaction.message.id == em.id
lol
and iq with mariana trench
!e ```py
def foo(bar):
return bar == 1
print(foo(1))
@supple thorn :white_check_mark: Your eval job has completed with return code 0.
True
What?
!e
def foo(bar):
return bar == 1
print(foo(2))
@nimble plume :white_check_mark: Your eval job has completed with return code 0.
False
See
Yeah you just copied what i said
I'm showing you bro
What
-credits : CokeCane / iamskev
[...] and str(reaction.emoji) == your_emoji
Why would you need to show me
I want to show you
Why

File "c:\Users\thoma\OneDrive\Desktop\discord server bot\cogs\reactions.py", line 4, in <module>
import emojis
ModuleNotFoundError: No module named 'emojis'```
What are you trying to import?
Here is the code
!pypi emojis
If you're trying to use that, you've got to install it
I have installed it
emoji==1.7.0
ffmpeg-python==0.2.0
frozenlist==1.3.0
future==0.18.2
handler==1.3.0
idna==3.3
imageio-ffmpeg==0.4.7
import-expression==1.1.4
jishaku==2.5.0
multidict==6.0.2
numpy==1.22.3
six==1.16.0
typing_extensions==4.2.0
yarl==1.7.2
Well, the library is called "emojis"
And the latest version is 0.6.0
Otherwise you'd need to import emoji
lol
And not emojis
You can't use .item on an Item object.
Apparently not
class Item():
def __init__(self, ctx):
self.userid = str(ctx.author.id)
#item
self.pogchop = db[self.userid + 'pogchop']
self.cooked_pogchop = db[self.userid + 'cooked_pogchop']
self.beef = db[self.userid + 'beef']
self.steak = db[self.userid + 'steak']
Yep there
hmm, do i smell dank memer clones
?
hey what are the headers for a webhook?
what headers does a webhook need?
picture of what?
Fits better in #965291516031549500, and see https://discord.com/developers/docs/resources/webhook#webhook-resource
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
hey guys,
im trying to figure how to send the next command only visible for the one who typed the command in the same channel
@Mybot.command()
@commands.has_any_role(x)
async def clear(ctx, number=0):
await ctx.send(f"Are you sure you want to clear {number} messages?", view=View)
its making a two buttons but the buttons are visibly to everyone
Use the hidden=true
ephemeral=True, after your view=...
where should i put the hidden=true ?
after the view
ok
, hidden=true
i'll check that
And not hidden
oh
But ephemeral
hidden works for me
i doesnt even hear ephemeral before
new vocabulary but what does that mean
the word itself
@slate swan can u maybe help? srry
Ephemeral sort of means temporary
Save the message ID of it after the request is complete and look it up later when you need it
i got python nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Messageable.send() got an unexpected keyword argument 'ephemeral'
should i save it in a json file
oo
no, use a real database
You can only send ephemeral messages with interactions
if u are using replit then its ok
i use pycharm
Someone
do u recommend any free ones?
erm
so how can i hide the message for the person who typed the command?
@Mybot.command()
@commands.has_any_role(x)
async def clear(ctx, number=0):
await ctx.send(f"Are you sure you want to clear {number} messages?", view=View)
AttributeError: 'Context' object has no attribute 'client'
Says all
ask other krypton
he can help u
idk about database
DM them
@slate swan do u know any free database's?
PostgreSQL?
Wdym?
If you have a server, most of the databases are free
It's ctx.bot not ctx.client
client is not a attribute of Context
maybe add it or typo?
you can't access the client from context's
!d discord.ext.commands.Context.bot
The bot that contains the command being executed.
im not trying to make it like in dm, i want to make it when person type the command it will appear on the same channel but the person that typed the command will only will see this
ill take a look
Then you've got to use interactions
ephemeral
cuz if i type my command everyone can see my buttons and also can click on them
You can't, you would need slash commands for that
Such as slash commands for example
i mean ive never had a problem with json files but yeah
just add a check for that specific user lol
You can ignore other people clicking them
how to do that?
Add a check to make sure the right person is clicking it, or use slash commands do have ephemeral messages
Your view should be implementing a interaction_check method to stop others from pressing your button
but how can i assign a code to the message ID like 738dz or something
I want them short
Inside of the view you need a check that verifies the author. You can pass ctx into the view (it you modify __init__() and store it on the view, which is later used for the check.
Use a way to store your own generated IDs that will link to the right message ID which contains your embed.
class view(disnake.View):
@disnake.ui.button(style=disnake.Style.green, label="hello")
async def callback(self, button: disnake.ui.Button, interaction: disnake.Interaction):
if interaction.author == ctx.author:
pass
else:
return```
!e ```python
import base64
print(base64.b64encode((973156160897183774).to_bytes(8)))
I'd rather check != and then return
Ah hold on 😅
base64 will make it longer
No it won't
I want them short
what are the negatives with using json files
as db?
it's OTczMTU2MTYwODk3MTgzNzc0
yeah
So not short as they asked
I want them short
it's just not good, and is not meant as a db
Encoding in base64 is not really useful in any way
use SQLite or any others as alternatives
well, if you are using them synchronously, in an async program like a bot, you can run into issues
examples?
two different people, running the same command, both commands open the json file
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\cogs\reactions.py", line 84, in rr_channel
reaction_roles = await self.client.reaction_roles.get_all()
AttributeError: 'Bot' object has no attribute 'reaction_roles'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 27, in on_command_error
raise error
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1348, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'reaction_roles'
``` its showing that neither bot or client work for that
Your bot could stop sending heartbeats as a result form blocking
Which will cause a disconnect
what will happen
You can just to_thread opening the file tbh
Ok ill have to pay for a actual db then
have you ever tried to close a file while it's open somewhere else?
last line says it all.. bot doesn't have an attr reaction_roles
it returns an error
you don't really need to pay for local dbs like sqlite
even mongodb offers free plans..
if ur using SQLite u don't have to.. but if ur planning on using postgresql, it needs to be hosted somewhere and that does cost money
so SQlite is free?
it can block the async func because of the error
Well there is not bot attribute in my code they are all client
yes, it's built-into python
yes i think i saw it everywhere
client = commands.Bot(command_prefix = '!', intents = intents)
cool ill switch to that today
!pip aiosqlite use this
Yes also if you're going to use sqlite3 then use aiosqlite
yeah so client has no attr reaction_roles
No it's DYFYX1FCcB4=
Neither does bot
ur using client, so I mentioned that
!pypi aiofiles
there
Should i change everything to bot attribute?
u don't need to
can users also add data to the database remotely using a cmd?
eg setup a channel
client is usually referred to discord.Client
but I think most tutorials on yt tells u to use client
Well it doesnt seem to work
!d discord.Client
class discord.Client(*, intents, **options)```
Represents a client connection that connects to Discord.
This class is used to interact with the Discord WebSocket and API.
A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
what is the code
Well if you code it that way then yes
wdym?
alright cool
You'd want to make sure to sanitise any data inbound from the user before adding it to the database if you're taking in user input
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\cogs\reactions.py", line 84, in rr_channel
reaction_roles = await self.client.reaction_roles.get_all()
AttributeError: 'Bot' object has no attribute 'reaction_roles'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 27, in on_command_error
raise error
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1348, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'reaction_roles'
@dense swallow
Be sure to check out parametrisation or whatever it was called, #databases <- pins
you want the code i
yes
ok
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.
sry wrong server
not in discord ofc
!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.
it's that long?
what
Yeah
k then
is ur bot obj in a class or just one line
Read this #databases message
and line 5, I don't think it's built in, u have make it or it won't work
elaborate on that please?
wdym "you have make it"
thats what menudocs used
ur using ur bot obj like this or as a class..
How would you decode back to the original int?
no not a class just like that
they made that.. it is not in discord.py or other forks
ctx.bot.config is custom made
and ur also calling bot.reaction_roles which is also not in the library
What line?
!e ```python
import base64
print(int.from_bytes(base64.b64decode(b'DYFYX1FCcB4='), 'big'))
@minor totem :white_check_mark: Your eval job has completed with return code 0.
973156160897183774
43
👌
Yeah what I thought, just not what can help help either way
i dont think i am
and also ur using the same variable name 2 times :/
Dude this is really fkd up nothing is that easy
self.client means ctx.client but in cogs
yes, nothing's easy..
So i guess in that case its self.bot
?
Idk dude
if u use:
client = commands.Bot()
it's self.client
if u use:
bot = commands.Bot()
it's self.bot
it's been a while since I have used normal ones.. I usually sub class my bot
You can define self.client = bot in the init function of your cog
No idea who would do that, but yeah
ok then bot would work.
but as u said, who would do it lol
how do I put animated emoji in the dropdown emoji parameter ?
Some a**hole like me
Keep it to self.client = client , we were talking, not saying what you need to copy
So? i mean i do get the same error either way
look clients dont even have cogs, only bots do. Stick to a good naming convention, commands.commands.Bot -> bot, discord.discord.Client -> client
Because you need to entirely follow the tutorial you're copying from.
The person most likely once did client.reaction_roles = ... or self.client.reaction_roles = ...
i did i event have the github but yeah i guess maybe ill change everything to bot then in my cog
is it the same as putting normal emoji ?
Is it possible to run multiple db executes on 1 on_guild_join event?
if u can run one of them u can run thousands of them
fair enough
elif isinstance(error, commands.CommandNotFound):
await ctx.send(f'**{ctx.author.name}**, this command doesnt exist, check your spellling maybe??')
elif isinstance(error, commands.MissingRequiredArgument):
if commands.name == 'open':
await ctx.send(f'**{ctx.author.name}**, what are you trying to open?')
else:
raise error
commands doesnt have name as attribute so i think commands is the wrong one
I believe in that case it's ctx.command.name
ok thanks
!d discord.ext.commands.Context.command
The command that is being invoked currently.
Yeah
The else statement should be outside to elif statement, it's gonna eat up errors
there is one more below that dont worry
elif isinstance(error, commands.CommandNotFound):
await ctx.send(f'**{ctx.author.name}**, this command doesnt exist, check your spellling maybe??')
elif isinstance(error, commands.MissingRequiredArgument):
if ctx.command.name == 'open':
await ctx.send(f'**{ctx.author.name}**, what are you trying to open?')
elif ctx.command.name == 'craft':
await ctx.send(f'**{ctx.author.name}**, try rpm craft 1` instead')
else:
raise error
else:
raise error
ctx.send('tell HydroRICO1209#5556 there is a bug')
```its like this
You can remove the first else statement
hmm ok
yes
👋
how to import a file from a folder
from folder import file
how can i see which server my bot joined and the server owner?
cuz i think somebody is spamming new server and putting my bot inside it
hey! 👋
HIHI sparky
Hii
for gu in bot.guilds:
print(gu.name, gu.owner.name)
ok thanks
and i cant get the server owner?
it's server_owner or smth
but there is a way to get the owner
!d discord.Guild.owner
property owner```
The member that owns the guild.
yes
why this is not working anyone?
Broooo
Wtd
from jishaku.cog import Jishaku
def setup(bot: commands.Bot):
bot.add_cog(Jishaku(bot=bot))
correct?
press space
Spacebar
in embed
!eval
print('''
something
like
this
''')
@loud junco :white_check_mark: Your eval job has completed with return code 0.
001 |
002 | something
003 | like
004 | this
owo
Or \n
he doesnt want \n
is that what u want?
yes
nc
!e
print("something \n like \n that")
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | something
002 | like
003 | that
whats the code to add reactions?
he wants to do embed a longggggggg description but without \n cuz its impractical i guess
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji")...

Late
thanks
lol
sparky got sum speed
I'm on mobile...
python3 main.py
Traceback (most recent call last):
File "main.py", line 40, in <module>
from jishaku.cog import Jishaku
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/jishaku/__init__.py", line 15, in <module>
from jishaku.cog import * # noqa: F401
me too, just purged my laptop's disk, feeling proud.
anyone?
you can just bot.load_extension("jishaku") instead of adding the cog manually
I usually type on my tab I'm from mobile rn so I can't type that fast
Yes?
errors
DM?
Why not here?
python3 main.py
Traceback (most recent call last):
File "main.py", line 40, in <module>
bot.load_extention("jishaku")
NameError: name 'bot' is not defined
exit status 1
Keep in mind that my bot is client not bot
whatever your bot instance is, did you name it client?
What's error?? @jade tartan
That that code wont use client attributes
as well as bot
sparkyshowspeed
Back
ursina's documentation
looks like its made by a 3yo
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\cogs\reactions.py", line 84, in rr_channel
reaction_roles = await self.client.reaction_roles.get_all()
AttributeError: 'Bot' object has no attribute 'reaction_roles'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "c:\Users\thoma\OneDrive\Desktop\discord server bot\Bot2.py", line 27, in on_command_error
raise error
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 1348, in invoke
await ctx.invoked_subcommand.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Bot' object has no attribute 'reaction_roles'
You skipped that part from the tutorial
Where at?
The person most likely once did
client.reaction_roles = ...orself.client.reaction_roles = ...
kek
i want this
lemme send deez nuts code
WHAHWAHAWHAW
thanks
!d disnake.ActivityType
class disnake.ActivityType```
Specifies the type of [`Activity`](https://docs.disnake.dev/en/latest/api.html#disnake.Activity "disnake.Activity"). This is used to check how to interpret the activity itself.
Again. Please get through the tutorial again
Sry @jade tartan I can't figure out
You skipped something
shesssh
i have it now
You've never defined the bot variable, unlike in the tutorial
looks pro but still noob
for example ~ py game = discord.Game("your mom") bot = commands.Bot(activity=game) # will show "Playing your mom" as a status message
BRUH u really like trolling 🤣
im 13
Not what they want at all, but yeah
check my bio
ik
i can send both sides of my passport if you need further id
ID doesn't give the address, so you can't really signup a credit card with just the ID
byebye
idk im just trolling like him
i saw the tutorial and it seems i havent missed anything
What are you talking about?
They once defined client.reaction_roles
Which you have never done
So yes, you have skipped something
No.
Stop guessing, you're doing random things as you don't know Python properly.
I would learn Python more and actually follow the tutorial correctly.
You definitely skipped something.
but im facing a problem now
well await self.client.reaction_roles looks the same as await self.bot.reaction_roles
looks the same except using diff attr
im doing step by step with the tutorial but i end up forgetting how to write it without guidance
but i know what it does if i look at it
wait you got a client and a bot?
not i use my bot as a client
what are you trying to do anyways?
client = commands.Bot(command_prefix = '!', intents = intents)
They haven't defined the bot variable, unlike the tutorial
There's nothing we can do for you besides tell you to look at the tutorial properly from the beginning. As yourself most likely don't know what a bot variable is, or what the self.client.reaction_roles is supposed to return, therefore you can't explain that and we can't provide proper help in the end.
LOL
@jade tartan
Reaction roles
Like on emoji press
Well id be better asking in another server than this
since you dont wanna help
They will tell the fame
Well just like two days ago I started working on a package that simplifies dc py may help you out: https://pypi.org/project/dpy-toolbox/
doubt it
I'd love to help like I do, but due to your lack of knowledge and understanding I can't help you.
Its makes it really easy
You don't know what the client.reaction_roles variable is supposed to return, we can't help you further.
i mean i want it in cogs form
but thanks
The only thing I can tell you is to watch the tutorial more closely.
even better
you can
Well thats what it has https://github.com/MenuDocs/Discord.PY-1.x.x-Tutorials/blob/Episode-22/cogs/reactions.py
The code for the discord.py tutorials on the MenuDocs youtube channel. - Discord.PY-1.x.x-Tutorials/reactions.py at Episode-22 · MenuDocs/Discord.PY-1.x.x-Tutorials
Im rn adding a ReactionRole class so you just gotta add that
Have you seen my code tho?
Not to be rude but ask in #python-discussion or claim a help channel.
ok
get the image? you'll need the full path if your bot isn't in the pictures directory
yea
No docs?
isn’t docs like a come as you go kinda thing tho
dude chill
cya guys later heading off
not really that helpful, but its clean
what do you guys use to host?
I use this thing called salafihosting.com, its pretty cheap, 2 dollars for 1 gb, 5 dollars for 2gb, 8 dollars for 4 gb, and 10 dollars for 8 gb
I think its pretty cheap
how much do you guys pay?
0 pounds 😔
Code
@bot.command(name="lnk")
async def lnk(ctx, link):
print(Fore.YELLOW + ctx.message.content + Fore.WHITE)
wget.download(link, "temp/")
Error
Ignoring exception in command lnk:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 169, in wrapped
ret = await coro(*args, **kwargs)
File "<string>", line 108, in lnk
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/wget.py", line 506, in download
(fd, tmpfile) = tempfile.mkstemp(".tmp", prefix=prefix, dir=".")
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/tempfile.py", line 332, in mkstemp
return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/tempfile.py", line 251, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: './temp/jtnpfhd7.tmp'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/bot_base.py", line 570, in invoke
await ctx.command.invoke(ctx)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 920, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/disnake/ext/commands/core.py", line 178, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: FileNotFoundError: [Errno 2] No such file or directory: './temp/jtnpfhd7.tmp'
I make a bot -> leave it -> gets out-dated -> I re-write it -> I don't have money to host a bot -> I open source it
12 months of AWS is a good option though
u could use replit
ew
the servers your bot is in has more bots than actual members or doesnt have enough members to get marked as an actual server
replit isnt even usable, its worse
Yep
wdym
@slate swan
My coding experience spits out a ton of errors ×_×
why dont you use aiohttp, its async
it prolly is
well, if you know the reason, why'd you ask us?
i got my answer from discord dev server
idk if its true
the admin said if it reaches 75 servers in a short period of time
idk
Can you give an example that should work for me?
Hey can you apply a cooldown to an events listener successfully?\
For example debouncing flood protection for joining/leaving voice channel as an example
or how would you go about doing that?
what to do if, when using the command, data in json-file is overwritten, and not written to a new line. I want the data to be written and not updated
import aiohttp
import aiofiles
#assuming this is inside a command
# I recommend creating a single ClientSession and storing it in a botvar
async with aiohttp.ClientSession() as session:
image = await session.get(link)
async with aiofiles.open(...) as f:
await f.write(image.content)
Am i doing it wrong? https://paste.pythondiscord.com/emujafisid
I think am doing it wrong
i mean i passed every parameter
can you show in what format are you dumping the data
What if the recieved link is for a pdf. Would that work?
hm, would have to do a lot more stuff for that
Bruh this code is a huge mess i'm not even understanding if you wanted to do group commands or smth
I don't fully understand you, sorry. I can show you my code, ok?
sure, that is what i was asking
@client.command()
async def bans(ctx, member: discord.Member, *, reason = 'причина не вказана'):
author = ctx.message.author
command = 'BAN'
toprole = author.top_role
data = {
"Role": f'{toprole}',
"ID": f'{author.id}',
"Name": f'{author}',
"Command": command,
"Reason": f'{reason}',
"Member": f'{member}'
}
with open('jsons\\bans.json', 'w', encoding = 'utf-8') as write_file:
json.dump(data, write_file, indent = 4, ensure_ascii=False)```
using an API VS using asyncpraw 

you will have to create a new dictionary in the root dictionary everytime
Reddits api is so easy to use. Idek why people use praw
with open(...) as f:
data = json.load(f)
data[str(user_id)] = {}
data[str(user_id)['key1'] = ...
...
You can do that with list comp
Wait.
I think I mis read the question.
I thought he meant every server the bot was in
And see all of the owners of those.
well dunno that, i'm readin' the server so i assume it is for a specific server
Yea just use list comp or something and do your own display.
[g.owner for g in bot.guilds]
Sure group commands is okay
I mean I got this off of the internet obviously we can’t obviously waste our time writing all this

Can you help me with it?
I just gave you it
As i said the code is a mess, you are tryin' to use the command reaction add but reaction doesn't have any subcommand named add or everything else, instead you have a command called reaction_add which is a command on his own
It’s up to you to figure out how you wanna display each and every in that list
does someone know how to put a icon of a guild in embed.set_thumbnail() ?
embed.set_thumbnain(url=Guild.icon.url)
thx
nail*
if you copied it is because i miss typed thumbnail
oh
mistyped*

please get annoyed uwu
can you show?
bruh
you have two guild object in that command, one named server and one is the attribute guild of ctx
and you just typed guild

i also tried server.___
bruh
How do i add a role to a member using their discord ID? I can get a user object but user objects dont have an "add_roles" function?
of course it has
Well not user object, but Member does
!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.
How do i get the a member object from a user ID?
i still don't get it
try ctx.guild.icon.url
can bots bypass bans or something? 😔
a member is a guild user, so the user will have the same id even inside of a guild
¯_(ツ)_/¯

