#discord-bots
1 messages · Page 38 of 1
in nextcord, its the same as bot.logout()
Alternate implementations have been written in things like Rust, C#, Java, and even Python itself!
Default interpreter like ?
The one you get off python.org
Ohh k let me read !
you can write your own script which runs the bot and use it after logout
like a terminal command
python interpreter has many variants
Cpython being the most commonly used one
other than that Jython ( interpreter in java ), rustpython etc exist too
the one you download from python site is the C interpreter
The only good way to restart your bot is to shut it down and have your process manager handle it. You can shutdown your bot by running Bot.close().
Do use:
- run your bot in a process manager such as:
- systemd
- openrc (gentoo, devuan)
- runit (void linux)
- supervisord
- upstart (old ubuntu)
- docker
- manually reboot it
Do not use:
- a bash loop (it can eat your C-c by rapidly spawning python and if your bot fails it won't stop it from constantly failing)
- subprocess.call (you will eat your memory up by not letting your old processes die)
- os.exec*
An interesting thing is that PyPy, is the Python interpreter, written in Python itself
Similar to a "bootstrap" compiler but not necessarily
i have school tomorrow😔 ✌️
its quite easy
Well yeah, no doubt about that. Just interesting, like a paradox
oh yeah i suppose you could call it a day at that
no hard coding
the bot is running in windows and I don't wanna bother with docker
hey guys
got a question
how can I get users pfp without
having a discord bot
I just want to use api
You can just go to https://discord.id/ or something similar
can I do a request to that
????
Oh, do you need it to be programatic?
ya
You'd just go in that website and type someone's ID in
But if you want to use the API you'd have to use discord
Check the network tab while making a request on that website to see how
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
I found this
but but idk
not without breaking tos (selfbotting)
It's not again TOS
not talking about that website
https://discord.com/developers/docs/resources/user#get-user see this endpoint @zenith basin
I mean discords api using a user account
🤔 though I think that requires a bot token so you may be right
thx
.
I just want to get an avtar
so?
it would be F12 if someone is wondering to see all the requests, so you can make a request to the host
How to check if message was sent by certain user?
I want to make an owner function but it wont work
@blacklist.command()
async def remove(ctx, member: discord.Member = None):
user_id = member.id
if str(ctx.message.author) in Owners:
if user_id in BlacklistedUsers:
try:
remove_user_from_blacklist(user_id)
embed=discord.Embed(title="User Removed From Blacklist", description=f"**{member.name}** has been successfully been removed from the blacklist", color=0x00ff11)
await ctx.send(embed=embed)
except:
blacklist_error_remove
if user_id in Owners:
await ctx.send("**HEY**! Thats my owner! You cant do that!")```
!d discord.ext.commands.is_owner
@discord.ext.commands.is_owner()```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the person invoking this command is the owner of the bot.
This is powered by [`Bot.is_owner()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.is_owner "discord.ext.commands.Bot.is_owner").
This check raises a special exception, [`NotOwner`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.NotOwner "discord.ext.commands.NotOwner") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
fixed ty
@client.command()
@commands.command(aliases=['hban'])
@checks.not_blacklisted
@commands.has_permissions(ban_members=True)
@commands.cooldown(1, 3, commands.BucketType.user)
async def hackban(self, ctx, user_id: int, *, reason: str):
if user in ctx.guild.members:
user = await self.bot.get_or_fetch_user(user_id)
embed = discord.Embed(
title="Error!",
description="An error occurred while trying to ban the user. Make sure ID is an existing ID that belongs to a user.",
color=0xE02B2B
)
await ctx.reply(embed=embed, mention_author=False)
else:
await ctx.guild.ban(user)
await ctx.guild.ban(user_id)
user = await self.bot.get_or_fetch_user(user_id)
embed = discord.Embed(
title="User Banned!",
description=f"**{user} (ID: {user_id}) ** was banned by **{ctx.author}**!",
color=0x9C84EF
)
embed.add_field(
name="Reason:",
value=reason
)
await ctx.reply(embed=embed, mention_author=False)```
ERROR:
Traceback (most recent call last):
File "c:\Users\Clicks\Desktop\Stuff\test.py", line 269, in <module>
async def uyeai(self, ctx, user_id: int, *, reason: str):
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 1480, in decorator
result = command(name=name, cls=cls, *args, **kwargs)(func)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 1752, in decorator
raise TypeError('Callback is already a command.')
TypeError: Callback is already a command.
like what
remove the client command deco
you registed the command twice
I'm sorry but I dont see anything
its the first line in the code you have given?
oh lmao
I thought, that @commands.command(aliases=['hban']) & @client.command() didnt do anything but call the command
no it registers the command
they get called internally
and the error was raised because you used 2 decos that register commands
I understand now
same code as before but with 1 deco
ERROR:
Traceback (most recent call last):
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\bot.py", line 1330, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 983, in invoke
await self.prepare(ctx)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 900, in prepare
await self._parse_arguments(ctx)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 807, in _parse_arguments
transformed = await self.transform(ctx, param, attachments)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 659, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: user_id is a required argument that is missing.
okimii hi! :)
Hey master✌️
wait oki its 1 am go sleep
its 12 am technically 

@client.command(aliases=['hban'])
@checks.not_blacklisted()
@commands.has_permissions(ban_members=True)
@commands.cooldown(1, 3, commands.BucketType.user)
async def hackban(self, ctx, user_id: int, *, reason: str):
if user in ctx.guild.members:
user = await self.bot.get_or_fetch_user(user_id)
embed = discord.Embed(
title="Error!",
description="An error occurred while trying to ban the user. Make sure ID is an existing ID that belongs to a user.",
color=0xE02B2B
)
await ctx.reply(embed=embed, mention_author=False)
else:
await ctx.guild.ban(user)
await ctx.guild.ban(user_id)
user = await self.bot.get_or_fetch_user(user_id)
embed = discord.Embed(
title="User Banned!",
description=f"**{user} (ID: {user_id}) ** was banned by **{ctx.author}**!",
color=0x9C84EF
)
embed.add_field(
name="Reason:",
value=reason
)
await ctx.reply(embed=embed, mention_author=False)```
Traceback (most recent call last):
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\bot.py", line 1330, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 983, in invoke
await self.prepare(ctx)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 900, in prepare
await self._parse_arguments(ctx)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 807, in _parse_arguments
transformed = await self.transform(ctx, param, attachments)
File "C:\Users\Clicks\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\discord\ext\commands\core.py", line 659, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: user_id is a required argument that is missing.
user_id is added in async def hackban(self, ctx, user_id: int, *, reason: str):
Remove the self parameter
@slate swan
how do i make these using python can anyone help me
yes
woah that's a big question
xD
as for buttons, i think this gist: https://gist.github.com/lykn/bac99b06d45ff8eed34c2220d86b6bf4 along with some examples from here: https://github.com/Rapptz/discord.py/tree/master/examples/views should help
then I get "Self is not defined"
when it comes to music, https://github.com/Rapptz/discord.py/blob/master/examples/basic_voice.py should help but it's a very nuanced topic and you need to do your own research or ask more specific questions.
what do you need self for?
you're not in a cog, so why do you need it?
hold on can you send more code?
!paste use this service
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.
nothing much just naming ctx as self
it could be another instance of using a cog wrong
your sarcasm is totally dead, no offence
nvm
fixed
lol i just have no idea what this even means
Ur totally dead
i pondered it for a bit but gave up cause it made no sense
no, please send more code
not the same stuff again
we can skip the whole Q&A bit if you just provide the code for quick diagnosis
average no english lover 😔
wat
im as confused as timtoy
how can i set the permisions on a voice channel when i create it to make it private
Slash Commands >.<
You need to send the view in interaction.send
Also what is menus.Menu
And remove the try-except so you can see what the error is
overwrites kwarg
I hate discord py so much ugh
Is there any reason why the code in the last if statement won't run? Assumedly everything above it is correct:
@client.event
async def on_message(message):
if message.channel.name == 'welcome':
author = message.author
if not author.roles.find(name='member'):
....
Is list.find even a thing
I don't use nextcord sorry
I think so?
oh so does author.roles return a list?
that would make sense
!d discord.Member.roles
property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.
These roles are sorted by their position in the role hierarchy.
oh so 'role' in author.roles should be it?
it says Interaction has no attr bot thats not CTX it's an interaction object
role = discord.utils.get(message.author.roles, name = "member")
now u can check if not role
Thanks, yeah. So my bot works in my test server but fails in the actual one -- same code, same permissions. Intents are declared, but this error is raised when trying to assign roles: AttributeError: 'NoneType' object has no attribute 'id'
It assigns a role when the member joins, but then fails to assign one when they send their first message
code👀
I'll send over a modified one. hold on
@shrewd apex https://paste.pythondiscord.com/anomahekoz
There's no role named verify
It's a placeholder. The real code has a different role that I do not want to expose
Then the role in the real code doesn't exist either.
wdym? it exists on the server
that holder role exists on both server A and server B. the code works in full on one but not the other, despite permissions being the same. that error that I mentioned above is raised in B and idk why or what it means
maybe you lack guild members intents?
possibly, but i don't understand why it does assign the role in the first half but fails to assign or remove in the second
server member intents are on
Well, so I fixed the game, but it says "This interaction failed" every time I click the button, Is that because I don't respond with a message?
yes, if you dont respond to the interaction in any way it shows This interaction failed
in any way?
but i open the field
fixed my issue. switching to assigning roles by id and not name worked for whatever reason
yes e.g an ephemeral message is good
users will be like "why tf is you bot sending ephemeral messages, he's spamming me can I just play the game"
of course i thought of ephemeral msgs
well you can do something else......
or that is the only way..
you can defer the interaction but you really shouldnt lol
that wont really help
blame discords api ez
not looking nice:(
whatsup y⁹✌️ 
@bot.command()
@commands.is_owner()
async def view(ctx,arg):
async with aiofiles.open(arg+'.txt', mode='r') as f:
lines = await f.read()
await ctx.reply(lines)
await ctx.send(f"Total lines: {len(f.readlines())}")```
why doesn't this code output the second message?
oh my you still haven't fixed this? 😭
nope
just speculating but f.readlines() should be a coro, no?
Might want to check aiofiles docs
@slate swan but can I delete that response message immediately?
didnt find anything in docs:(
wdym by coro?
well actually I found Interaction.delete_original_response
coroutine
coroutine, add await
but error says that there is only delete_original_message
thats odd that an error was never raised about awaiting ctx.send
does it not give you an error though? it would say it's not awaited
await is awaiting the readlines here right, goverment of awaits lmao
it would say coroutine has no _len_
ah my fault
could be because of a faulty error handler
🔄
are you sure the arg your passing is one word
yes
how do you use the command

"myPrefix" view txtfile
!view txtfile
yeah
and what's the file called
txtfile
.txt ?
yep
won't fix it but make it into a format string, where you async aiofiles
it's faster, and more readable
it's working well as it outputs lines of the txt file
yeah but still, f strings are better
try iterating over each line perhaps? @deep osprey
for line in f:
await ctx.send(f"{len(line)}")```?
test it
still doesn't work
error or doesn't send anything
doesn't send anything
can you prnt it out
print out the last line
how can I do that?
replace the last line with
print(f"Total lines: {len(f.readlines())}")
aha I thought to print the last line in the .txt
ah
still nothing in the console
do you have any error handlers?
yes
try commenting them out
command handlers or the default handler?
command handlers
yeah
still nothing changed
so weird
wait lemme do that function in a separate command
even the new command doesn't output
what the
is there something wrong with file opening mode?
what's it?
let me see
why not just defer that way u don't need to send anything
await interaction.response.defer()
@deep osprey okay
so your problem was you were trying to print the length of a generator, just replace your last line with
await ctx.send(f"Total lines: {len(await f.readlines())}")
thats odd tho, wouldnt it still send the gen obj?
no it errors out for me
Total lines: 0
TypeError: object of type 'generator' has no len()
what does it say? you need to await it?
is it not right?
nope
so it is right?
it's not 0 lines
how many is it
ahhh cool
What's your code for that command now @deep osprey
@bot.command()
@commands.is_owner()
async def view(ctx,arg):
async with aiofiles.open(arg+'.txt', mode='r') as f:
lines = await f.read()
await ctx.reply(lines)
await ctx.send(f"Total lines: {len(await f.readlines())}")```
yeah, I just wrote the function in a new file, somethings blocking errors for him
what the hell, I reproduced your error
awaiting the read somehow makes the total lines 0
why is it saying 0 lines then?
I'm not to sure
UGH
Guys can anyone here suggest me a command idea?
@deep osprey I've been trying for a while, you probably have to count each line with a for loop
it's very weird, it's like you can only use one at a time or something @deep osprey
Guys how we can add a user cooldown to a messgse event?
custom cooldowns
How bro?
just make a dict to store user id and time the event was triggered then make a task loop to check and delete from that dict
@shrewd apexyou mind helpin @deep osprey, he's using aiofiles(https://github.com/Tinche/aiofiles) but it seems it doesn't allow you to use .read() and .readlines() in the same function, if you do it says the file has 0 lines.
just use read lines then
it returns a list right?
yeah
I confused how bro
I confused how to make task loop check
just use once it gives a list do
data = await f.readlines()
print(len(data), "".join(data))
that way u get both what's the problem
reaction roles out dated for 2.0 make button roles
¯\_(ツ)_/¯
idk ur code
@deep osprey so basically, this should work
@bot.command()
@commands.is_owner()
async def view(ctx, arg) -> None:
async with aiofiles.open(f'{arg}.txt', mode='r') as f:
lines = await f.readlines()
await ctx.reply(''.join(lines))
await ctx.send(f"Total lines: {len(lines)}")
mode is r by default 🗿
u don't need to specify
that package aiofiles has like no docs at all
it so simple who need docs 👀 
Me
welp it's fine, double specifying then
the only issue is that spoonfeeding never works
I hate my new keyboard smh so many typos
!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.
fetch the role once and print the role object var
How to make task loop check?
fard
wow thanks, but why did that work?
is there a problem with how i passed combat into CombatView? combat is a class as well but im getting an error that says CombatView has no attribute 'children'
https://paste.pythondiscord.com/xeliyajifa
you need to call the original init
super()._init_()
inside of my combat class?
CombatView

like super().__init__(combat)?
dangerous world out there people even robbing pfps
can't have shit in detroit
ykw nah bro i'm changing pfp here specifically
how to check if the .txt file got more than 2000 characters?
len()?
len(file) ?
yeah i know
async with aiofiles.open(...) as f:
chars = len(await f.read())
if chars > 2000:
...
also rule 7
what's rule 7?
!rule 7
7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.
works 😳, thx
okimii said that i really shouldn't do that
when two zero's are next to each other: one zero opens second, and second opens first and then first opens second and the second opens first
wait didnt you say me about that?
TypeError: expected Item not <class 'int'> what does <class 'int'> mean?
hmm yeah i kinda noticed that yesterday couldn't say for sure without printing pos i think i told i to print pos
yeah that recursion seemed off
idk if my way to stop it is good but itworks
So this is my code py @bot.command() @commands.is_owner() async def view(ctx, arg) -> None: async with aiofiles.open(f'{arg}.txt', mode='r') as f: lines = await f.readlines() x = len(lines) z = len(await f.read()) if z > 2000: await ctx.reply(''.join(lines[1:(x/2)])) await ctx.send(''.join(lines[(x/2):x])) await ctx.send(f"Total lines: {x}") else: await ctx.reply(''.join(lines)) await ctx.send(f"Total lines: {x}") I am trying to send the content of the text file even they are more than 2000 characters in 2 messages but it's not working
integer (0935205 for example)
im getting the error in regards to
super().__init__(150, 5, 5, 3, 'Dark', 'Light', 'Tank')
more code? or full traceback
super()._init_() calls the original init (of the superclass)
you don't pass those arguments to it
!d discord.ui.View
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
that's all you can pass
"Command.call() missing 1 required positional argument: 'context'" why?
you probably have a command function called x and then you're calling x() somewhere
oh
without full code can't help debug that
that is the whole code
no
?
i have a problem in my code could anyone plzz help me?
better just put [:2000] and [2000:] instead of those [1:(x/2)], [(x/2):x]
just send your problem
I don't know where do you get your emoji from, but it's already a string, not an Emoji object, to get name from it
1:2000 and [2000: ?]
what's wrong with [:2000] and [2000:]?
remove .name probably
doesn't output anything
would on_guild_join be reliable for running code when my bot is added
all i wanna do is send to webhook when my bot gets added to a server
no error?
nope
is there something in your text file?
yeah
uhm... do you have an error handler?
an error handler for each command
yes? why not
thanks
how can i make this? This is not an emoji at the front
i'd do print at the start of command to see if it even gets runned, and if you have an error handler try disabling it so error can appear if there is one
!d discord.InteractionResponse.defer
await defer(*, ephemeral=False, thinking=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Defers the interaction response.
This is typically used when the interaction is acknowledged and a secondary action will be done later.
This is only supported with the following interaction types...
print what exactly?
so if you are just making a slash command with getting an interaction, then: await interaction.response.defer()
i usually do here it doesnt matter
the command is working well if the txt file doesn't have more than 2000 characters
idk if this lib is actually called discord_components, but I really don't recommend using it
i see...
hm weirdo
I'd just send a txt file with the content... lmao
any solution?
not use discord components
or install them...
if you want to use them for some reason....
so no solution for this?
I'm so confused with this error, anyone got any idea what it means?
idk, it should raise an error, probably it does not, because of error handler, you can try py try: code... except Exception as e: raise e
there's no discord.Embed.Empty
@bot.command()
@commands.is_owner()
async def view(ctx, arg) -> None:
async with aiofiles.open(f'{arg}.txt', mode='r') as f:
try:
lines = await f.readlines()
x = len(lines)
z = len(await f.read())
if z > 2000:
await ctx.reply(''.join(lines[:2000]))
await ctx.send(''.join(lines[2000:]))
await ctx.send(f"Total lines: {x}")
else:
await ctx.reply(''.join(lines))
await ctx.send(f"Total lines: {x}")
except Exception as e:
raise e``` no output no errors
are you using discord.py?
why don't you just send the txt file directly
Yeah
.
what version?
2.0
do pip list
you probably have 1.7.3 and 2.0 both
because Embed.Empty was removed in 2.0
Nah but in my whole code there, there is no single embed
pip uninstall discord ig
same error still
im not sure if it will only remove 1.7.3, so better do pip list after that to see if it removed properly
2.0 is still there
and 1.7.3?
Thats removed
hmmm.....
id better just reinstall it then
pip uninstall discord.py
pip install git+https://github.com/Rapptz/discord.py
The official dpy 2.0 is coming soon right
done
idk i just use it and idc
yeah okay
still error?
yeah 
Rapptz/discord.py is the original and "official" discord.py
well i thought he meant a PyPi release
do you have any file or folder named discord?
uh no
then.... im confused
from utils.util import Paginator?
I don't have any embeds in that code.
from discord.ext.buttons import Paginator*
I got that in my util.py file
that paginator makes use of Embed.Empty which doesn't exist anymore
Its bit old code btw just trying to get it to work with 2.0
oh, so how would it be now?
None
I mean what do I import?
discord.py doesn't have a builtin paginator
find a 3p lib which is updated for dpy 2.0 or make your own
oh
!d discord.ext.commands.Paginator
class discord.ext.commands.Paginator(prefix='```', suffix='```', max_size=2000, linesep='\n')```
A class that aids in paginating code blocks for Discord messages.
len(x) Returns the total number of characters in the paginator.
RIP
well... but it's a paginator anyways)
@bot.command()
@commands.is_owner()
async def view(ctx, arg) -> None:
async with aiofiles.open(f'{arg}.txt', mode='r') as f:
try:
lines = await f.readlines()
x = len(lines)
z = len(await f.read())
if z > 2000:
await ctx.reply(f=discord.File(f,f'{arg}.txt'))
await ctx.send(f"Total lines: {x}")
else:
await ctx.reply(''.join(lines))
await ctx.send(f"Total lines: {x}")
except Exception as e:
raise e``` doesn't send the .txt file
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=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/latest/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.10)") of [`File`](https://discordpy.readthedocs.io/en/latest/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/latest/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.10)") of [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
why changed f in discord.File
why did you change f to file in discord.File()
still doesn't send the file
because you're reading before and you aren't resetting the file pointer
@bot.command()
@commands.is_owner()
async def view(ctx, arg) -> None:
async with aiofiles.open(f'{arg}.txt', mode='r') as f:
try:
lines = await f.readlines()
x = len(lines)
z = len(await f.read())
if z > 2000:
async with aiofiles.open(f'{arg}.txt', mode='rb') as ff:
await ctx.send(file=discord.File(ff,f'{arg}.txt'))
else:
await ctx.reply(''.join(lines))
await ctx.send(f"Total lines: {x}")
except Exception as e:
raise e``` ok I tried that
My bot now responds after like 10 seconds and does not error in the console, any clue why that happens?
Oh it does error but after like 10 seconds
does anyone thing its possible to make a googl translate bot?
yeah it is
how?
!pypi googletrans
thatnk you i will look into it
yeah it takes like 10 seconds+ to respond to anything
.name is still here
and what is the error?
No errors in console at all
code?
Its the whole bot so
hm
Myabe its the database because it needs to get the prefix from the database
and that just errored when i tried changing it
how do you get it?
ok
@silk fulcrum that was the issue
lmao
I want to make my bot that's being developed in Discord 2.0 to work in all servers await bot.tree.sync() apparently requires the object of all the guilds that the server is supposed to work in.
I am thinking of looping over all the guilds that the bot is in, then create a list of objects of all the servers that the bot is in and pass it to sync(). The question that I have is whether there is a simpler method or not (such as a default command or something to make the bot work in all the servers).
POV: when you have a bot developed in Discord 2.0
ok mr fork user
why? are you trying to make global commands or did you make a slash command for several guilds
actually I have this in my setup_hook and it works on all guilds without problems
auto syncing sucks
waht\
__A__uto __S__yncing (your command tree) __S__ucks, and here's why:
Syncing your command tree automatically causes extra unnecessary requests to be made, this is because you only need to sync when commands are updated.
*see ?tag whensync for a more enunciated list on when to sync.
What syncing does is send your commands to discord for one guild or globally. If you haven't changed your command's descriptions, added/removed commands, changed names, parameters, etc. you shouldn't sync, since you'd only be updating discord with the commands they already have without doing any changes, which is pointless and a waste of an API request to a limit with an already tight rate limit.
*see ?tag whatsync for a more enunciated on what syncing is, and how to do so.
Where should I sync instead?
It's better to sync using a normal (message) command (or even an on_message if you prefer Client) You can even use just a simple eval to do so.
*for example:?tag umbras sync command
*But I don't have the new message content intent... What now?
Bots can still receive message content when the bot is mentioned in it, or in DMs! You could set the bot prefix to commands.when_mentioned
*Why do I get a Missing Access error when trying to sync to a guild? -> See ?tag mas
best use jishaku to sync ur commands 
I want to make global commands.
Oh, so by default that's a global.
thanks!
all this code should be one indent lower (remove one Tab)
backspace
before backspace
after backspace
What is the cache in discord bots? (What is the concept)
Well... wdym cache? if you are 'bout caching channels, users, e.t.c, so like you can get them instead of fetch, then... it just saves that info in cache?
Cache is the storage of info.. to which the access bot has?
nothing changed
Deleting tabs in block of code
how do you delete symbols?
isnt there a backspace button right below it?
or like next to it
user = message.author.id
if user in dict:
if time.time()-dict[user] > 5:
del dict[user]
await message.channel.send("rr")
else:
await message.channel.send("on cooldown")
else:
dict[user] = time.time()
Is it correct?
- dict is a shadowing a built-in name
- you cannot do
in dict, you can doin dict.keys()orin dict.values()
it is delete
backspace deletes symbol which is before the cursor, and delete deletes symbol which is in front of the cursor
anyways you can delete a tab even with delete
before delete
after delete 4 times
also if your editor is smart then you can just select the code and press Shift+Tab
yes
that multi line string is also 1 space off I think
Can any one make a bot?m
InputText? wtf? are you using pycord?
InputTextStyle
no
in the style=discord.TextStyle.long
oh my bruh...
you cannot subclass with keywords
there cant be title=
and i gotta do something
nothing.....
so bye
hey guys so im asking rn if all those discord py codes are outdated cuz the ban and kick commands aint working for me
wait wha
bruuhh
I tested this on my old laptop, didn't worked it but rn when i tested this on my new laptop like wth it just worked
shit happens
what does that mean
it means "i know right"
ohkay
in_memory_point_keeper = {}
def write_point_keeper_to_file(in_memory_point_keeper):
with open('point-keeper.json', mode='a') as f:
json.dump(in_memory_point_keeper, f)
in_memory_point_keeper.update()
def add_points(user):
try:
with open("point-keeper.json", mode="r"):
in_memory_point_keeper[f'{user.name}'] = int(in_memory_point_keeper[f'{user.name}']) + 1
write_point_keeper_to_file(in_memory_point_keeper)
in_memory_point_keeper.update()
except KeyError:
with open("point-keeper.json", mode="r"):
in_memory_point_keeper[f'{user.name}'] = 1
write_point_keeper_to_file(in_memory_point_keeper)
in_memory_point_keeper.update()
if message.channel.name == "test":
for content_type in message.attachments:
if content_type == "JPEG" or "PNG":
print("point added")
add_points(user)
{"Custom": 1}{"Custom": 2}{"Custom": 1}{"Custom": 1}{"Custom": 1}{"Custom": 1}{"Custom": 1}
it is saving points like this, each time the script gets restarted and when an image gets uploaded again, it starts a new one, how do i get it to just add to the point amount?
dont use the names, use the ids of the users and check if the ids are in the json file or not
Keep in mind that using JSON as a db can cause some big problems, such as file corruption when two processes try to write simultaneously
What lib is that?
I could help with d.py 2.0.0a, tho slash_command seems to be sum bad fork 
pycord 😭
Yeah don't use that
, either interactions.py or d.py
interactions 💀
Legit is more discord API conform than dannys code

"We think discord.py is a good library, however, it violates the API and does not follow the API guild schema."
What does that mean
I don't see how would it be violating the API
Does not follow the guild schema? Is there a missing field in discord.Guild?
yes, schema
discord.Guild.schema :lmao:
why
This is legit a quote from some discord dev
No one asked what you think about that
no one ask that discord dev either
They did 
who
how u know u were sitting next to him
Check this discord api server
what 💀
What does that even mean 
learn some english 🗿
or atleast explain how it violates don't just quote someone and tell what they told
Says the dude who doesn't know what a QUOTE IS
are u going to explain how it violates or u just simply trolling
There is an API Guide by discord
i have a discord i had made but the dev is rude as hell but i have an error i need help with``` Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 195, in wrapped
ret = await coro(args, *kwargs)
File "ragebot.py", line 109, in stock
return await ctx.send(embed=discord.Embed(description=b, colour=0x00ff80).set_footer(icon_url=ctx.author.avatar_url,text=f"{ctx.author} • {datetime.datetime.now().strftime('%H:%M')}").set_author(name="Product Stock"))
AttributeError: 'Member' object has no attribute 'avatar_url'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 1330, in invoke
await ctx.command.invoke(ctx)
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 991, in invoke
await injected(ctx.args, ctx.kwargs) # type: ignore
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 204, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Member' object has no attribute 'avatar_url'
2022-08-16 08:47:57 ERROR discord.ext.commands.bot Ignoring exception in command stock
Traceback (most recent call last):
File "/home/container/.local/lib/python3.8/site-packages/discord/ext/commands/core.py", line 195, in wrapped
ret = await coro(args, kwargs)
File "ragebot.py", line 109, in stock
return await ctx.send(embed=discord.Embed(description=b, colour=0x00ff80).set_footer(icon_url=ctx.author.avatar_url,text=f"{ctx.author} • {datetime.datetime.now().strftime('%H:%M')}").set_author(name="Product Stock"))
AttributeError: 'Member' object has no attribute 'avatar_url'
The above exception was the direct cause of the following exception: ```
haha get wrecked, your violation have been asked by noone with similar undesrandion of english as the silverfish
That wasd a question not an opinion
what did i just say
shut up and read it
any askers?
so just cause PPL like u will pop out randomly and say that this library dosent follow we have to go and read api guide so if tomorrow i question Newton's laws u will go calculate them again for me
Hey i want to add category buttons to my help command but i dont know how to edit the message after it got pressed
ur making a claim or quoting and quote u should backup ur sentence 🗿
i think you're using dpy 2.0, where member.avatar_url is replaced with member.avatar.url
await interaction.response.edit_message
I have a lot of util functions that need to access my postgres database using a pool connection, but I dont want to pass the pool or my bot through every function I plan to query my database in. Am I thinking about this the wrong way or is there a better method of statically referencing my pool than putting a single connection in the bot's attributes?
await interaction.edit_original_message 😎
make a class pass the pool in the class, then make commonly used functions as class methods, then make an attr for bot class like bot.db and instantiate the db function class to it
that only when u defer the response
I never clicked a button before this
u responded once already
But i just restarted the bot, typed the command and then pressed the button
.. Imma need some commas in that
ok actually just defer it at start then do as master32 said
are you just suggesting i move my util functions to the bot class?
alright yeah cause otherwise I have no idea what you are saying
https://github.com/FallenDeity/sassy-snallygasters_code-jam-9/tree/main/wild_chess/database
check setup and utils and database
those contain all the db parts
hopefully u'll get a rough idea
looks like just create a new class with a static classreference to the pool?
Hey, are you capable of passing json file info into an embed?
!d discord.Embed.from_dict
classmethod from_dict(data)```
Converts a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.10)") to a [`Embed`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Embed "discord.Embed") provided it is in the format that Discord expects it to be in.
You can find out about this format in the [official Discord documentation](https://discord.com/developers/docs/resources/channel#embed-object).
iirc load automatically converts json data to dict
So, you're not able to put json files into it by default?
what's the problem with doing json.load lmao
Can someone tell me what the issue is?
The api isn't the issue
The embed isn't actually sending once I run the command.
I don't see the line where you're sending the embed
anyways, you can refactor some indentation
your if: ... else: ...
can basically become
if steamid is None:
return await ctx.send("...")
ts = int(...)
...```
this eliminates/removes a whole else block
you should also consider using aiohttp
but you probably knew that already
If you want a command to be able to be used like py def something(ctx, one, two, three, four)
Or ```py
def something(ctx, mode)
How would you do it?
Use aiohttp instead of requests, I've heard it is integrated with discord.py
what exactly do you mean?
- aiohttp is async
Which is exactly the reason I've recommended using it
httpx 
💀
httpx is faster but you'll need another dependency
Like it can be invoked both ways
um, actually, i've just helped a person who uses it in dms 😭
Okay. I'll look into it. Thanks!
but that would take an extra subcommand
Is that a problem
depends for him
It makes sense to
*args
not really that good, since if some args are multiple words, you wouldn't know which word is for which arg
example
You can use quotes
yeah, but that's not really user-friendly, right?
That's why I suggested using a group
I've done it for private guilds, but I don't think regular members would like it
make the other arguments optional except the one argument, easy
can't you choose which arg you're passing a value to through autocomplete or whatever in the newer versions?
so this ban command is not working for some reason
@client.command()
@commands.has_permissions(ban_members = True)
async def ban(ctx, member : discord.Member, *, reason = None):
await member.ban(reason = reason)
then mode would also be one
huh?
error?
mhm
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
how would he know if the member's argument is a mode he passed, or the value of one?
it might also be that he meant to fill in the ctx, one, two ,three command, but accidentally ended up with ctx, mode
hard to explain, but not failproof I think
your bot needs some perms
you can't ban yourself, or someone with a higher/equal role than your bot I think
I'm not developing moderation bots, so idk
but if all the others are made optional then one would act as mode, wouldn't it
yeah i am trying to ban my alt so
or an admin
right, yourself being the admin
true, would be a strange argname though
mode_or_one of some sorts
Let's not imagine in that case 
Traceback (most recent call last):
File "/home/container/main.py", line 32, in <module>
client = commands.Bot(
TypeError: __init__() got an unexpected keyword argument 'test_guild'```
never got this wtf -
Which dapi wrapper are you using?
if you're using disnake it's test_guilds
nextcord
im using nextcord
and in all my other bots, test_guild work
test_guild or test_guilds is not an attribute of nextcord.ext.commands.Bot
it works in all my other bots tho
those use disnake
they dont
i switched from disnake to nextcord a few months ago and i think i just still have test_guild in my code
i didnt get any errors yet, so i just kept it lol
I was working on that for like an hour 😭 you're right though my fault
that's not possible
First it's test_guilds in disnake, not test_guild
😳
someone told me to use test_guild when i got some errors
and it worked
as you can see nextcord doesn't have that attribute for commands.Bot
+++
test_guilds it's a list of guild id so as not to load the slash commands globally every time
the most confusing is pycord for me
i know
discord.Bot
I like this guy
how do i use that in nextcord tho
disnake is also good, btw I'm thinking to reswitch to d.py
cus no personal opinion? or what
I will look later for you in the docs
for a better opinion
oh ok
🥺
Possible to use id in
@commands.has_role(Id)?
yes
@commands.has_role(920208020473008139)
``` fine?
yes....
which message did you even reply to, my discord cache 
🤷
fix your second if indentation
yes
😐
if argument == "...":
...
elif argument == "...":
...
basics of python
Is it
commands.MissingPermissions
Or
commands.MissingRequiredPermissions?
the first
k
!d discord.ext.commands.MissingPermissions
exception discord.ext.commands.MissingPermissions(missing_permissions, *args)```
Exception raised when the command invoker lacks permissions to run a command.
This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
Something named elif in python exist
whats the thing called again to use a command if you have x ID
in english reference, it should be else if, right? In python that thing is elif(else+if)
whAT 400MB one contain ?
contuniue to if statement hmm
is anything like async and await while useing mysql ?
!pypi aiomysql
its impotant in my bot dev. right ? or simple sql will work ?
Yes use aiomysql for discord.bot
got it , let me read doc thanks btw
maybe their dashboard is working with mysql
Wdym.for a discord bot
what's with your keyboard
Mobile
ohkay
It's scalable
@commands.command()
async def test(ctx):
id1 = 813824599522541628
id2 = 574217755692236803
if ctx.message.author.id == id1 or ctx.message.author.id == id2:
ctx.send("a")
else:
None
``` Should this just work?
why the else: None
who as... well, must agree... mysql is overkill
It's better in the long run
ctx.send is a coroutine, you should await it await ctx.send(...)
idk what it should be like I want else: just ignore if you get me
Just don't have an else
yeah mb I know that
How so?
ah yeah lmao
It's not like using MySQL is causing any performance hits
However if data size and read/writes increase then sqlite won't be enough
That's going to mean refactoring, copying old data etc
btw, how do I copy data from postgres to async postgres
wait nvm nononono dont asnwer that
im stiupid
It's not like discord bots store only some specific data
Depends on what the bot does
A music bot could be storing lots and lots of track metadata
noone uses them because youtube is denied... wait nvm noone cares about rules
APIs don't let you collect data and statistics
Of course it is. But for large amounts of data MySQL is better
Why are you assuming that discord bots are always small and private
i also like it
And using MySQL hardly increases development time
Except for the initial setup everything is the same
It even has support for more types
You're saying that they have less knowledge now, so they will never be able to make a popular bot?
So you agree that their bot can be in many servers? There is a chance?
In which case it's better to build a scalable solution in the first place
Depending on the data being stored it absolutely does
who said they're bad?
databases were always behind them
Ikr who tf uses databases anyway
Everyone just does that for a joke, cus why not right? who ever will store data in them...
It's 30 mph now but it can speed up anytime 🤷
Unless of course it's a private bot and OP is going to intentionally restrict it
Have you seen the discord channel db thing
Why not
Can requirements never change
thats cursed
also, initializing that db in on_ready is... debatable...
Where source
well it seems new() is merely creating the channel if it doesnt exist in cache, so its not that big of a deal
compared to its existence
CRUD database for python discord bot developers that stores data on discord text channels - GitHub - ankushKun/DiscordDatabase: CRUD database for python discord bot developers that stores data on d...
!d discord.Guild.bans
async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/latest/api.html#discord.BanEntry "discord.BanEntry").
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
Changed in version 2.0: Due to a breaking change in Discord’s API, this now returns a paginated iterator instead of a list.
Examples
Usage...
ctx.guilds.bans
it doesn't return a list
what
why did you make it ctx.guilds
i was just telling you that ctx.guild.bans() is an AsyncIterator
not a list
that's why i linked this
just write an example -_-
there are literally 2 examples in the doc
what we here for if PPL read docs😔
to show them how to read doc so they dont need someone to hold their hand everytime they run into a problem ☺️
life be easier if PPL read docs and extra bonus if they read a bit of python basics before reading docs
yes !!
the ideal utopian idea
gl achieving
for now spork feed them if not spoon
it's like whitest invention ever up along with stuff like garlic crusher
https://tenor.com/view/uncle-roger-uncle-roger-meme-uncle-roger-so-white-why-so-white-so-white-gif-25414039
ill wait
lmaoo
which example do you not understand
ur coding skill idk but u are very good at designing embeds that's a very important talent for making discord bots
true very good UX
now that await checkinput() gives me a feeling that co pilot was suggesting and u pressed tab to complete 
ur wait_for lacks checks
your variable naming is insanely creative
and a timeout
"susy_baka_check" so beautiful
i saw check_dic before 
yeah define a checkinput
idk what it does tho what does it do
or whats it supposed to do
so why did check_input become checkinput
just install dpy👀
i did 😢
2.0 has slash commands
discord_slash != discord.py
All the discordpy slash command extension modules should be take off pip, they’re garbage lol
My humble opinion
just the name looks sussy enough that i won't install it
f
it like writing on label i-am-not-fake-get-me
i watched some yt videos about slash commands and somehow it works for them
;-;
show check_dic
yt tutorials and discord bot python are few words u try to not put together
the check_dic function def
not u calling it
Traceback (most recent call last):
File "/home/container/main.py", line 41, in <module>
client.load_extension(f"cogs.{filename[:-3]}")
File "/home/container/nextcord/ext/commands/bot.py", line 851, in load_extension
self._load_from_module_spec(spec, name, extras=extras)
File "/home/container/nextcord/ext/commands/bot.py", line 732, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
nextcord.ext.commands.errors.ExtensionFailed: Extension 'cogs.status' raised an error: UnsupportedOperation: not readable```
why am i getting this 💀
anyways do you know what to do?
unreadable cog first i am seeing someone with unreadable cog what is in the cog 🗿
yes install dpy2.0
not much i just added
settings = json.load(f)```
at the beginning
what's bomb here
!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.
you're trying to load the file after opening in write mode
214
what's bombs now
hmm ic
so are u sure the guessed word is in the json file
and it's all lower case
like ball should be there in key as ball and not Ball
Traceback (most recent call last):
File "/home/container/main.py", line 41, in <module>
client.load_extension(f"cogs.{filename[:-3]}")
File "/home/container/nextcord/ext/commands/bot.py", line 851, in load_extension
self._load_from_module_spec(spec, name, extras=extras)
File "/home/container/nextcord/ext/commands/bot.py", line 732, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
nextcord.ext.commands.errors.ExtensionFailed: Extension 'cogs.status' raised an error: JSONDecodeError: Expecting value: line 1 column 1 (char 0)```
now im getting this
invalid json
does the json have to be inside my cogs folder ?
what's inside the json
not needed but can be kept
is that alr ?
just clear it and write again
it looks fine
add a few print statements and check
like print the word in checkdic print wort and other all that stuff
and print other also
print it before the of statement
even before the for
just after loading the json add those prints
possible to send ephemeral = True on ctx.send?
or send an ephemeral message with ctx
no
yes
add print(other)
also
i'm trying to define some application commands inside of my commands.Bot subclass, yet am running into an issue. If i don't call tree.add_command for the commands and go to run the commands, I get CommandNotFound, yet when I add it and then sync, I get CommandSignatureMismatch. What exactly am i doing wrong?
how 🥲
remove print(word) sorry didn't see was helping out a friend
check the pins the install link there the git link
code
got it thx man
on_ready looks like this
async def on_ready(self):
self.log.info(f"Ready! Logged in as {str(self.user)}")
await self.__load_cogs()
self.tree.add_command(self.reload_cogs)
self.tree.add_command(self.sync_commands)
c = self.load_config()
if c.get("sync_commands_on_start", False):
self.log.info("Syncing global commands...")
await self.tree.sync()
...
both commands follow a similar sorta structure:
@discord.app_commands.command(
name = "reload_cogs",
description = "Reloads all cogs that are currently loaded, loading them if necessary."
)
@discord.app_commands.guilds(816348537800753182)
async def reload_cogs(self, interaction: discord.Interaction):
cogs: dict = self.cogs
for cog_name, cog in cogs.items():
self.log.info(f"Reloading cog `{cog_name}`")
...
wait so i should install the git right? just asking to clarify
on_ready looks terrible
just run that pip install in replit shell
ight
ok? so what exactly am i doing wrong regarding my commands?
firstly load cogs sync and all in a setup hook
thats so strange we had like 2 print statements
did u remove print wort?
@shrewd apex IT DOESN'T WORK 🥲
poor ashy
there was word and wort just remove word why remove wort as well
sheesh that's not dpy that's discord_slash
alr, done. doesn't make a real difference tho
remove that import statement
k
yeah yeah i saw that
are u on 2.0
there's a pycord server y'know?
which one is better
might find better help there
at least other forks dont have the discord namespace
need help!
install dpy 2.0
but i heard its not good
is it truew?
heyy can you invite me to your dc server , i wanna see your bot once
False
i updated
still i cant same error
You have to update it by installing it from GitHub
i just installed dpy2.0 and am getting this error even after modifying my code, i dont understand it even a bit ;-;
what is discord2 module then??
run pip list or print in your code discord.__version__ and send the output, as Roie said you need to install d.py 2.0 from git
send warn.py code
code?
¿
