#discord-bots
1 messages · Page 843 of 1
Can you please go learn python before making a discord bot? And the error clearly says what you need to do..
'await' outside function
Yes
await xyz
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embed: Embed size exceeds maximum size of 6000 any help?
Yea
Give me Ur code
@slate swan too much text in ur embed
i know
len(data) > 5000:
send as txc
but it doesnt work ig
@honest vessel
Yay finally its working
Maximum size is only 6000
@slate swan
Also is it possible to connect a python bot to a web dashboard?
str("test").title()
Yes
i just said i alr know that
Liar
🤬
@novel apex
"str" is already a string theres no need to cast it
Thats way too easy
words = language.split(" ")
for word in words: word.capitalize()
embed.add_field(name="Hunter uwu", value=' '.join(words))
word = word.capitalize()
How can it happen that an event and its code parts only happen to work in some servers. I have an if statement which prevents stuff to happen, but that just doesn't work in some servers..?
I have this weird unexpected indent , that I can't seem to fix can anyone help? | if yes dm.
how can i use on_member_join to change somebody’s nickname instantly
You get the member object in the event, use member.edit
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
Hi, I saw this video where we can send messages using python requests in discord
how to interact with interaction (bot buttons) ???
using requests and python
Why am I literally in every code you write...?
You would need to make a Gateway connection for that if I'm not wrong, and it's not possible with raw HTTP requests
Correct me if I'm wrong
hmm idk . . . ;-;
Uhhh, actually u can use raw requests, but too much work
@commands.command(alieases=["Repli","Replpy"])
async def reply(self,ctx):
pipa=client.get_emoji(944579032828227646)
embed=discord.Embed(color = ( discord.Color.random()), title="", description="**i replied**")
await ctx.reply(embed=embed)
await ctx.message.add_reaction(pipa)
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: InvalidArgument: emoji argument must be str, Emoji, or Reaction not NoneType.
So yea, u r correct
would it be able to recieve the interactions?
Nope, u need to connect to the gateway
!e
language = "hello world xd"
words = language.split(" ")
for word in words: word.capitalize()
print(" ".join(words))
@buoyant quail :white_check_mark: Your eval job has completed with return code 0.
hello world xd
it changes nothing @maiden fable
anybody? whats the problem.
!e print("this changes into title".title())
@slate swan :white_check_mark: Your eval job has completed with return code 0.
This Changes Into Title
this yes
The emoji ID is wrong or the bot is not in the server the emoji is from
done ty
👌
this ?
Ah my bad. I thought it edited the string in-place ;-;
@bot.command()
async def start(ctx):
overwrites = {
ctx.guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True, send_messages=True )
}
category = ctx.guild.get_channel(944748748117012560)
await category.create_text_channel(f'{ctx.message.author.name}', overwrites=overwrites)
await ctx.reply("channel is created")```
Command doesn’t seem to work
It sends the components, not recieve the data when the interaction is added on user side.
well, I just want to make a random button click from the options what the bot gives in chat
Errors?
I think command prompt is broken there is none
I'm having this weird unexpected indent I can't seem to fix can anyone help me | if yes dm me.
is this possible ?
Anyone has a keep_alive.py code?
Anyone uses oracle host?
Help me bruh
No I'm getting it right now
Oh cool!
but
dm me
would it be considered a good free host?
@maiden fable
like, on levels of paid ones
help me bruhhhh
ignore "sexmaker" LOL
Any keep_alive.py codes?
@fresh smelt I suggest not disparaging people with disabilities in your rules ¯_(ツ)_/¯ Doesn't set a great tone tbh.
@visual yarrow can you help
What do you need help with?
hello LX
Can I get a keep_alive.py code for Discord Bots?
I did.
you have 4 times "
Not sure what you mean sorry.
@visual yarrow can you look into my problem #help-peanut
you right , I removed it but still the same error.
its your type problem
To host a bot 24/7 using a webserver like https://uptimerobot.com
then i dont know
how do i make an embed without fields.
@visual yarrow
Yups
god the sign up process is annoying
@visual yarrow @visual yarrow
Haha indeed it is
and what's the uptime of your bot?
Wdym
that was to Hunter
^
from flask import Flask
from threading import Thread
app = Flask('')
@app.route('/')
def main():
return "Your bot is alive!"
def run():
app.run(host="0.0.0.0", port=8080)
def keep_alive():
server = Thread(target=run)
server.start()
Ok thx
for keep_alive
don't use add_field
So it needs any code modifications?
Since I have moved over the bot to my friend's VPS, it hasn't had any downtime(s) (since 3 days ago)
na
what should I add instead of that then
Ok thx
🙂
umm.. just add nothing
embed = disnake.Embed(description='something')
This is the least you can do with an embed
Sorry @drowsy thunder, can you not spam-ping me please.
This works with Uptimer Robot?
just a description
yea
Ok dude
I wanna put spaces n and make it in line
like that
description =
I don't add "await ctx.send" ??
if you want send - add, if you don't want - don't add
How do I make a command only work for certain user ids
!d discord.ext.commands.check
@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its subclasses. These checks could be accessed via [`Command.checks`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks").
These checks should be predicates that take in a single parameter taking a [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context"). If the check returns a `False`-like value then during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure") exception is raised and sent to the [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event.
If an exception should be thrown in the predicate then it should be a subclass of [`CommandError`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CommandError "discord.ext.commands.CommandError"). Any exception not subclassed from it will be propagated while those subclassed will be sent to [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error").
Is it possible to store ids onto txt
Sure
Ok
@maiden fable ```py
@bot.command()
@commands.has_role('RoleName')
async def command_name():```?
Sure
Could you do has_id
There ain't anything like that
custom checks be like
LOL
ID of what? a role or user_id?
a txt isn't a db, I don't encourage bad implementations
I’m poopy at dbs
then learn it lmaop
well, txt is worse
How can i slipt args
example
async def help(ctx, arg1, arg2, arg3):
!help arg1 arg2 arg3
To
async def help(ctx, arg1, arg2, arg3):
!help arg1:arg2 arg3
async def help(ctx, arg, arg3):
arg1 = arg.split(":")[0]
arg2 = arg.split(":")[1]
Ty
this clearly is an XY problem, what you probably need is the following:
#burp
!shit now please I have to go```
this will result in
`arg = "now"`
`other_args = "please I have to go"`
Yep but thats not it im added if agr1 etc but ty for help
aight, gl
how can I make a function in bot that creates an invite with the specified guild id (example usage: .get_invite {guild id})
you can create an invite with a (text_)channel, check its methods in the docs
I tried making but it throws error
async def get_invite(ctx,gid):
guild = bot.get_guild(gid)
invite = await guild.channels[0].create_invite()
await ctx.send(f"{invite}")
Command raised an exception: NotFound: 404 Not Found (error code: 10003): Unknown Channel
gid is a string
make it an int
gid: int
also, get_invite creates an invite for another guild than the current one, I hope?
still the same
Command raised an exception: NotFound: 404 Not Found (error code: 10003): Unknown Channel
first you get guild, via converted gid to int
then you check if guild is not None, THEN you execute the rest of the code
can you help me writing that
@client.command()
async def google(ctx, *, search : str = None):
if not search:
await ctx.send("https://google.com")
return
await ctx.send(f"https://www.google.com/search?q={'+'.join(search)}")
input
.google i am mentally stupid```
output
```https://www.google.com/search?q=i+ +a+m+ +m+e+n+t+a+l+l+y+ +s+t+u+p+i+d```
hlep
what did i do wrong lol
Wrong quotes
You would not use the double quotes inside a f-string with double quotes
wdym
you're using double quotes inside of a string that uses double quotes
you know what a quote means right?
solution: use single quotes
it works
sry lol german is just kicking in and i sometimes forget words 
lol
lol
is there any way to make a discord bot show the results of the google search? like the top 5 results or something
lol
@bot.event
async def on_message(message):
if {i.lower().translate(str.maketrans('','', string.punctuation)) for i in message.content.split(' ')}\
.intersection(set(json.load(open('cenz.json')))) != set():
await message.channel.send(f'{message.author.mention} по губам отшлепать??')
await message.delete() ```
your json file might be empty, double check
ofc
any guides on how to do that ?
I'm talking about cenz.json
you first have to find an async python API which can google for you
OR you could use requests optionally
Is there a way to create an embed which updates itself and tells if a bot is online?
something like a bot status command
and i already feel to dumb for that lol
yaes
at least, you now know what to look for
!pip aiohttp
how
^^ this is one of the async versions of requests, which you can use
!pip httpx
i didn't understand
.intersection(set(json.load(open('cenz.json')))) != set():
File "/app/.heroku/python/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/app/.heroku/python/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1) ```
This json
?
Sorry
import json
ar = []
with open('cenz.txt', encoding='utf-8') as r:
for i in r:
n = i.lower().split('\n')[0]
if n != '':
ar.append(n)
with open('cenz.json', 'w', encoding='utf-8') as e:
json.dump(ar, e) ```
This json
You need to split the string
heroku 
Yes
lol
when sombody clicks the reaction on the bots message how does it reconize who did it
@weary sierra its a list
.
!d discord.Reaction.author
No documentation found for the requested symbol.
async for ... in users(*, limit=None, after=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") representing the users that have reacted to the message.
The `after` parameter must represent a member and meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
Examples
Usage
```py
# I do not actually recommend doing this.
async for user in reaction.users():
await channel.send(f'{user} has reacted with {reaction.emoji}!')
```...
ok
Well then you should learn it first
Blindly copying code is not a good practice
how do i get reaction variable
its just one error 💀
The root of this error is in your python knowledge lack
This would be pretty easy to fix if you knew what a list is and what a dict is
can u just telll me ;/
You would need to change a lot of things that I am not going to explain to you
However I can recommend resources
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

sure, just check is_running() beforehand so the command doesnt try starting it twice
why do you wanna do that
how do i get reaction variable
message.reactions
!message.reactions
@bot.command()
async def start(ctx):
overwrites = {
ctx.guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True, send_messages=True )
}
category = ctx.guild.get_channel(944748748117012560)
await category.create_text_channel(f'{ctx.message.author.name}', overwrites=overwrites)
await ctx.reply("channel created")```
How do I limit 1 channel
probably the most preferred method would be to store the newly created channel's id in a database then add a command check to make sure it doesnt exist
When someone creates channel they all have same name as user so that might work
Db isn’t really needed since you can just check the username, BUT the username can change so a db is indeed the best method
if you trust that they wont change their name sure
Na they won’t
Don’t assume things 😂, there will always be exceptions
someone will
No, it can be unintentionally…
but if you're fine with it then you can skip the database part and just have the custom check
I’ll just delete the channel no big deal
Yes
Is there docs related to that?
hey, please i'm working on a discord.py project, and i was wondering how to make a command usable on the bot dms, like for example i have a simple ?ping command that works perfectly on the server, but i cant use it on his dms
!d discord.ext.commands.guild_only
@discord.ext.commands.guild_only()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that indicates this command must only be used in a guild context only. Basically, no private messages are allowed when using the command.
This check raises a special exception, [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
commands should trigger in dms by default
Use ctx.send?
wat
ctx.send allows the bot to send a dm to a user, but i need the opposite, i need to be able to execute a command directly on the bot dms
Any ctx.send commands work in dms
O
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.


it doesn't work for noobs
you'll need to share your code since a simple command shouldnt have a problem in dms
!resources
LMAO NOT AGAIN
go to #bot-commands not here 
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
🗿 there's nothing i can do, he assuming knowing but in fact he doesn't
for example if i make the ?help command on server it works fine
but if i make ?help on his dms it doesnt
thats what i need 🙏
!d discord.ext.commands.guild_only
@discord.ext.commands.guild_only()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that indicates this command must only be used in a guild context only. Basically, no private messages are allowed when using the command.
This check raises a special exception, [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
moai i think you have a misunderstanding
i need to be able to execute a command directly on the bot dms
oh so the command is only usable in dms?
they're saying it doesnt work in dms, and they want it to
well, you can invoke the command in the server and eventually dm the user
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
i do it all the time
don't be rude to users
@hoary cargo for the help command that was just to get you in situation, actually i'll need the user to send infos that arent supposed to be seen by other, like email or whatever
thats why it would be better to make command in dms
It means super thankful for ur help
I forgot the h tho
vertex you'll need to share your code since there shouldnt normally be a problem using commands in dm
didn't look like it
💀
you can try with slash commands, prefix commands might not work in dms since most of the times the prefix is registered by guild
ight ty
as for the !resources tag there's likely a cooldown for it
right
Am I supposed to make the accept and decline a command?
?
How can I disable a select menu after I used it. I tried like this but it wont work. So how to disable the menu after I used it
class DroppDownMenu(discord.ui.View):
options.append(discord.SelectOption(label=case_name, description="descrption"))
@discord.ui.select(placeholder="Choose one option", min_values=1, max_values=1, options=options)
async def callback(self, select, interaction : discord.Interaction):
DroppDownMenu.disabled = True
i think you need to edit the original message attached to and set .disabled = True
!d disnake.Interaction.edit_original_message
await edit_original_message(*, content=..., embed=..., embeds=..., file=..., files=..., attachments=..., view=..., components=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original, previously sent interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://docs.disnake.dev/en/latest/api.html#disnake.InteractionMessage.edit "disnake.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.
This method is also the only way to edit the original message if the message sent was ephemeral.
Note
If the original message has embeds with images that were created from local files (using the `file` parameter with [`Embed.set_image()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_image "disnake.Embed.set_image") or [`Embed.set_thumbnail()`](https://docs.disnake.dev/en/latest/api.html#disnake.Embed.set_thumbnail "disnake.Embed.set_thumbnail")), those images will be removed if the message’s attachments are edited in any way (i.e. by setting `file`/`files`/`attachments`, or adding an embed with local files).
hello
who can help me with discord.py
i will to command has datetime
with send message in channel in 7:00 am
i searching many internet but not finding
if you can send me friend invite
:incoming_envelope: :ok_hand: applied mute to @modern egret until <t:1645373753:f> (9 minutes and 59 seconds) (reason: discord_emojis rule: sent 30 emojis in 10s).
hi everyone im making a discord bot currency does anyone have any unique features i can add to it
it will be really helpful
Getting money when chilling in VCs
Hmm that is not bad idea ill actually work on that
:incoming_envelope: :ok_hand: applied mute to @cyan rover until <t:1645374353:f> (9 minutes and 59 seconds) (reason: discord_emojis rule: sent 100 emojis in 10s).
has anyone here got a good method for reloading cogs they can share?
!d discord.ext.commands.Bot.reload_extension
reload_extension(name, *, package=None)```
Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is equivalent to a [`unload_extension()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.unload_extension "discord.ext.commands.Bot.unload_extension") followed by a [`load_extension()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.load_extension "discord.ext.commands.Bot.load_extension") except done in an atomic way. That is, if an operation fails mid-reload then the bot will roll-back to the prior working state.
Anyone know how I could gather user input from a discord message? https://pastebin.com/1th6BBLY
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
!d discord.ext.commands.Bot.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
I don't like this if message.content.startswith('$greet'). I want it to occur after after a command has been initiated.
Okay?
Why has it been giving me the same rate limiter error for 5 times in a row?
it's been like 30 minutes
thanks ill try that
How is your bot the discord api
it ain't, stop picking words
just asked how to solve it, ok obv answer do not spam
but I'm not
You asked how the bot was spamming itself
.
That implies the bot is the discord api
If i'm not spamming, who else is
your code
Your code
finally someone saying thanks after taking help is nice
nah it was the code
Haha
from roblox import Client```
says roblox isnt defined but i have installed ro.py
this is bot realted though?
!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.
Use this so it doesn't clog chat
Read the channel description
It's not relevant to this channel
I'm still confused.
Cogs are a very important part of discord.py which allow you to organise your commands into groups - not to be confused with actual command groups, which will be explained later in the tutorial.
Oh yeah sorry
I thought you were loading commands one by one
cogs are loaded automatically when you start the bot, and yes, there's other way rather than hardcoding them to double load apparently
You could create double loop
why
for cmd_folder in os.listdir('cogs'):
for ext in os.listdir(f'cogs/{cmd_folder}'):
if ext.endswith('.py'):
bot.load_extension(f'cogs.{cmd_folder}.{ext[:-3]}')```
yeah but they are cogs
literally you don't have to create cogs/cog_name/cog_name.py for each
Or you could use the power of recursion but that's a bit more complicated
You know what recursion is right?
it's just unpractical
you use what you want to use but still
You could do a logic like if the file is extension then load it, if folder then call function on that folder
The good thing about it is it would work at any depth if you program it well
Unlike double loop
yes, i am sure, y'all just like to make your stuff way more annoying and complex than it should be
There are only 2 proper ways to implement the thing you want and I told them both
embed.add_field(name = f"Стоимость {row[1]} PumCoins", value = f"Вы приобретёте роль {row[0]}", inline=False)
await ctx.send(embed=embed)
await ctx.send(embed=embed)```
Hello russian comrade nice to meet you
i too
Could you describe your issue
@client.command()
async def find(ctx,*, query = None):
if not query:
return
embed = disnake.Embed(
title = "Here is your Google Search",
color = disnake.Color.orange()
)
embed.set_thumbnail(url = "https://niclas.wants-to.party/google.png")
num = 0
for j in search(query, tld="co.in", num=5, stop=5, pause=5):
embed.add_field(name = f"Number {num}", value = j)
num = num+1
await ctx.send(embed = embed)
what exactly did i do wrong? -
i need help a datetime
i will to discord bot send message in channel in 7:00 am
i searching in google and nothing find
what if you use a disnake.Embed but no discord.Embed
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
wdym
Disnake is a fork of dpy
ye
Probably something is wrong with indents
but use datetime is nothing?
ye but where lmao
For
th other thing smh works
Try replacing it with tab or four spaces and vice versa
sorry
can told me what is my error
@commands.command() async def shoprole(self, ctx): await ctx.message.delete() embed = discord.Embed(title ="**Магазин ролей**", color=emcolor) for row in cur.execute(f"SELECT role_id, cost, name FROM shoprole WHERE id={ctx.guild.id}"): if ctx.guild.get_role(row[0]) != None: embed.add_field(name = f"Стоимость {row[1]} PumCoins", value = f"Вы приобретёте роль **{row[2]}**", inline=False) await ctx.send(embed=embed)
shop dont shows
but shop work
and i can buy role
That's how i have them, and I have more than you, this doesn't affect me at all when I edit them, it's more handy, I don't need to open 20 folders just for a file.
Are you those kind of people with just 20-30 lines per cog and also puts them on different folders? Lmao, irrational
how tf do i format this so it looks nice
Unpack j
how do i make another argument for a command?
async def profile(self, ctx: commands.Context, *, profile=None):```
!e ```py
something = ["foo", "bar", "baz"]
foo, bar, baz = something
print(foo, bar, baz)
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
foo bar baz
Add it before *
sure, but i mean more for the long ass strings
async def profile(self, ctx: commands.Context, profile=None, *):```
Is it not better than seeing indexes
With unpacking I actually know whats going on
Otherwise I'd only know j is a sequence, and you're indexing it
Hi
Someone can help me with a discord bot
gotta be a better way
Pls
oh wow, you switched
in the process, got all of the tables set up
Bunch of code
maybe if u said ur problem
sure
do you guys usually pull out the whole table at once or just one value at a time, gotta be better to grab the whole table rather than searching many times
need most of the table in the function and connected ones
It’s for mod mail
yeah, grab the whole table mostly
yes, please?
throw it in a dictionary or like i have?
You don’t accept fríen request pls send me a dm or friend request
hmm could do a for loop and use the row name to declare local variables
Grab the table if you need all of it. #databases here they might be able to help you further
you can ask about it here, my dear
i guess it's more of a how do i grab the whole table neatly
Is that sqlite3?
yeah
hey im trying to fix an issue.
i am trying to make api request with an argument named profile
https://paste.pythondiscord.com/ucogolekig
error gives this:
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'int' object is not subscriptable```
Hi all, is there a Tableau expert in this room?
expected is this (if it was .profile michigun)
Michigun :c
Can u provide a full traceback?
And dont do so many ctx.send make it all a single message
There is also no need to use the .json method everytime
File "C:\Users\no\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\bot_base.py", line 561, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\no\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 930, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\no\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 185, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'int' object is not subscriptable```
await ctx.send(f"""{username})
Rank: {rank}
Stars: {stars}
Diamonds: {diamonds}
Coins: {coins}
User Coins: {user_coins}
Demons: {demons}
Creator Points: {creator_points}
Icon ID: {icon_id}
Friend Requests Enabled: {friend_requests}
Messages Enbaled: {messages}
Comment History Enabled: {comment_history}
Moderator Status: {moderator}
Youtube: {youtube}
Twitter: {twitter}
Twitch: {twitch}""")
fixed it
Unable to convert '@hoary cargo check out some other open source projects and you will understand that you need it to be organized. Seems like you have never done such thing, neither released any legit package.' to valid command, tag, or Cog.
Display information and a GitHub link to the source code of a command, tag, or cog.
Sollution is on the message you are treating an int like a suscriptable object. I cant tell u which one cos I am not able to try it out rn
im sorry but what is a subscriptable object?
imagine assuming things about me when you don't even know me, seems like I hurt your pride or something 
And no, my cogs are organised, each cog does have a suggestive name of what type of commands you will find in there, the classes are documented each of them
but you don't have to know this because it's not your business how I organise my stuff
how to check if the member status is empty
chill guys
how ?
Smt like response = req.json()
is there a way to unpack a tuple in a segmented way like merging head and body into one variable that has both
whats happening here....
hey could someone guide me on how to use a mongodb database for a warn command?
Listen here mf, you come here and ask "How I do X" and people telling you how you do X and get mad about it, fucking grow up
well, thats completely fine, its up to you
I try to be polite and you start assuming shit about me
lets all calm down
can u guys stop beefing in this channel :l there is DMs for a reason and thank yall ^^
I hate to be the guy but please stop, I'll have to ping the mods
Don't compare that
Have you ever opened those folders to see how many files are in each? They don't have 1 file per folder
I'm out
Anyone?
i just need a guide on how to store the warns on a db as I haven't used mongodb before
ok
anyone?
Status as in? Activity?
Ye
well, if it returns None the member has no activity
But
Acitvity returns the status of a member right but if the member doesnt have a status it returns the member's presence(playing, streaming etc)
Idk tbh
I see, well, thats not empty
i've tried```py
if after.activity.type is discord.ActivityType.custom:
if after.activity is None:
print("empty")
btw the status can't be empty 
You're checking if the after.activity is None inside of an if-statement that only is true if activity is a type of custom??
How you layed this out basically means everytime you check if activity is None is always gonna be false
i've tried it outside of the if statement
basically after.activity returns the CustomActivity and the presence
I should just go drop dead
so what exactly you expect to happen when you check
Also, doesnt activity property return a list?
dont use requests for async shit
i mean there is after.activities 
that is activities
Oh nvm, I really should go drop dead
Isn't even 12 tho
tracking custom activity type is quite useless ngl 
6 pm for me
imagine it's not 8 pm
11:30 pm for me
imagine not 7pm
European mfs
Uhhh
if not after.activity: return
if isinstance(after.activity, discord.ActivityType.custom): #do stuff, custom status is true
Hey everyone! I'm just tryung to build a simple bot on Replit that infinitely sends a specific message each second, I watched some youtube tutorials but nobody talks about what I need, can anyone help me?
Not really but idk
Oh well
you don't want your bot to send a message each second
dont use replit as your host
Indeed
Continuous messages on replit uwu
reasons there are ratelimit issues on replit 👀
plus replit is just shit overall
and you have to deal with keep alive shit tf 
we cant help unless you give us the code
i don't have code...
Welp
then no help
Very nice
oh, we dont spoonfeed code.
!d discord.Guild.get_channel
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
im sure you can use a task loop for it though
- it will basically get you ratelimited if you want to send 1 message per second kek
!d discord.TextChannel.send
await send(content=None, *, tts=None, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, mention_author=None, view=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`. If the content is set to `None` (the default), then the `embed` parameter must be provided.
To upload a single file, the `file` parameter should be used with a single [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") object. To upload multiple files, the `files` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`File`](https://discordpy.readthedocs.io/en/master/api.html#discord.File "discord.File") objects. **Specifying both parameters will lead to an exception**.
To upload a single embed, the `embed` parameter should be used with a single [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") object. To upload multiple embeds, the `embeds` parameter should be used with a [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Embed`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed "discord.Embed") objects. **Specifying both parameters will lead to an exception**.
Use synchronous while True uwu
please dont do that

i don't know how to do that... I know very little about discord bots and coding in general
its the best we have
STOP UWUING
discord.py is an intermediate library.
learn python first
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
it's why there's a rule for people who want to learn discord.py straight off the bat in discord.py's server
i think when beginners come here expect some people will give a ready to use bot with their requirements or something
eventually free hosted
while me who completely learned asynchronous stuff while making a Bot
Lmao
true
same
facts
Actually I learnt Python doing dpy, sooooo
xD
Uhh, I was using cogs when I didn't know what was a class in programming 
@alpine storm Learn OOP in python and learn how to utilize async shit before starting discord.py
discord.py is very OOP reliant
I shit hard on bots due to my lack of understanding of OOP too
I do know OOP now
i had some small projects before dpy but still my knowledge about python was quite limited ngl, i learned a lot of this bot hell journey 
I started learning Python for bot making, soooooo
Well the past tense of shit doesnt exist......shat, maybe?
it all started at 3 am with a freecodecamp python video 
Mine started at 5 am lmao
Mine in the.... day
Same
and it was horrible.
!ot anyways
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
wow 
we all know the inspiration is during the night
but it's not ot
Hmm, that time I used to shut down my laptop at 8 cz I didn't have a separate room
we still talk about discord bots
Hunter always hates being the bad guy, but she's always the bad guy
she?
Lmao I was also seeing that
Yeah?
I know this isn't about python but how can I run 2 different tasks with different versions of discord.py? I have a bot for discord.py 2.0 and one for discord.py 1.7
I want to run both on one server. Can any1 help?
Oh typo nvm
Never said I hate being the bad guy
Lmao
nah, now u the bad girl sorry
this isnt python, you know that, right?
I am Hunter, thanks
well, you are and you are not in the same time
how do i learn discord module
literally in the first 6 words.
!d discord
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
Docs are a great way to start
Yea
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
What are docs
documentation
Abbreviation for doctor?

I better get back to helping in DMs
Since discord.py will stop working soon what should i use to code in python still?
Good
a fork.
yeah exactly. many docs
but discord.py isn;t dead yet and it has support for slash_commands via the slash_utils
Python does not depend on the discord.py library whatsoever
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.

I mean like to make discord bots
dpy 1.7.x is dead.
Im new to all this bs so
there are many dpy forks such as pycord, nextcord, etc
You have, disnake, nextcord and our beloved pycord
or hikari for a completely unique wrapper
Slash commands are ugly i refuse to use them lmaooo
that;s what all saying, then start implementing them anyway
Im starting to kinda try hikari but idk it seems confusing because its new and not much documentation
Slash commands are ugly
that was me months ago
slash commands are shit
i will never use those
eventually starts working to migrate to slash
What happen to pycord??
horrible fork
where is rin 👀
i cant even find a fucking link for it
wrong command
🗿
😔
!pypi rin
Same xD, but when I saw you can write multiple stuff for every parameter without a delimiter, I was all in
I mean... 
At least he got a link
Naw but i mean that with a passion never making SLASH commands
Nvm i cant be too strong on that
Have fun with the ugglier button system then
Idk… what do y’all suggest me using for making discord bots?
Disnake
Like pycord, hikari etc
Disnake?
Disnake i think is the main suggested one
yeah
Hikari i think is also pretty good but isnt as beginner/user friendly from what ive seen/heard
If you wanna have similar syntax like dpy, but hikari comes with its own perks
Does it have good documentation?? And tutorials
!pypi disnake
You wont find much video tutorials, really everything is dpy related
!pip pincer 🗿
"rebuild"
Not trynna sound dumb but what dpy mean new to all this tbh
Alright version bumped to v0.1.2 😼
Now pypi isn't so out of date
dpy - discord.py
w o w
Ohh oh alr
When will it become v1.2.0 🥺
I gave an ETA to v1.0.0 by the end of this month
But I don't think I will be able to follow through on that
I gave that, not u ahem ahem
Imagine 88 MB RAM used by a bot in 125 servers 
I never acknowledged your deadline 😼
Why can't my alt account see non admin slash commands 🤔
I decided yesterday I was gonna attempt that
0% cpu 👀
🥺 Andyyyyyyyyyyyyyyyyyyyy
Why u do this to me
Yoo
How can I make admin slash commands private to normal users
They can't use these, but can see these
Use a check
So I might be stupid but what is hikari like what does it do?
youre sus
Oh God
Can you Unlist the goddamn admin slash commands from everybody D:
Its an api wrapper for discord api
Idk if thats a thing
Is it worth downloading and trying to use
just set the timeout to None
timeout=None
Ash do be drunk 👀
I havent slept from 4 days what do you expect
Why tho
No, why?
Guess so
Idk really
Smh just get some sleep and don't u dare use the ot command
yw
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
I'll take a pill to sleep then ig and infernum already did the honours
!source ot
Sorry, an unexpected error occurred. Please let us know!
AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'
bro broken bot
at least u gonna sleep and well, there was no need
!ot I have severe level insomnia so I'm not the one to blame really
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
👀 I did go in the ot tho
who should I let know
Sorry, an unexpected error occurred. Please let us know!
AttributeError: 'TagIdentifier' object has no attribute 'qualified_name'
Oh, thought it was a random error
Facts (same)
where could it hide 
you don't import bot
you make a cog which is gonna get passed bot by the setup function
your setup function will pass your bot to your cog
it will make an instance of it
now I don't understand
are you making this in multiple files?
maybe self.connection is defined after loading the cogs?
should be before it
access (self.)bot.connection?
do you not understand how to subclass
and pls use os.listdir for checking the cogs directory
!d os.listdir
you can do for filename in os.listdir("path")
no you use two for loops./ you can do it in 1
but whats the issue anyways
oh ok my fault
I can’t figure out how to install 3.8 it’s only letting me install 3.7 anyone able to help I’m on Linux btw
wiat im not being rude
i meant that as a question
ik becuase i forgot the question mark
so what are you having trouble with?
for your db?
Can you still run python successfully on 3.7?
ahh ook ye ye. i have dealt with this before
I can’t figure out how to install 3.8 lmfao 🤣 I’m only getting 3.7
Hi, how can I do a command that shows how many people/channels/servers the bot sees?
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
@slate swan You were the one asking earlier for a way to shorten cog loading right?
I'll write a quick example of what you cold do, holdon
guys can someone try making a bot like rhythm
but like you know youtube does not ban it
helppy @bot.event async def on_command_error(ctx, cmd_error): embed = discord.Embed(title = "Ошибка", description = "Команда не найдена", color = 0xe74c3c)
wait i fucked up
for root, _, files in os.walk("Cogs/"):
if root.endswith("__"):
continue
for file in files:
if file.startswith("_"):
continue
print(f"{root.replace('/', '.')}.{file}")
``` Would load all cogs for each sub-directory in `Cogs`
@bot.event
async def on_message(message):
if {i.lower().translate(str.maketrans('','', string.punctuation)) for i in message.content.split(' ')}\
.intersection(set(json.load(open('cenz.json')))) != set():
await message.channel.send(f'{message.author.mention} по губам отшлепать??')
await message.delete()
import json
ar = []
with open('cenz.txt', encoding='utf-8') as r:
for i in r:
n = i.lower().split('\n')[0]
if n != '':
ar.append(n)
with open('cenz.json', 'w', encoding='utf-8') as e:
json.dump(ar, e)
error
.intersection(set(json.load(open('cenz.json')))) != set():
File "/app/.heroku/python/lib/python3.9/json/__init__.py", line 293, in load
return loads(fp.read(),
File "/app/.heroku/python/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/app/.heroku/python/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
A, thx
The first continue is to ignore __pycache__, etc
i'm idiot
!d os.walk
os.walk(top, topdown=True, onerror=None, followlinks=False)```
Generate the file names in a directory tree by walking the tree either top-down or bottom-up. For each directory in the tree rooted at directory *top* (including *top* itself), it yields a 3-tuple `(dirpath, dirnames, filenames)`.
Heres the format it outputs in
how do I solve this problem (I need to take the value "system")
code:
import platform
@bot.command
async def server(ctx):
osps = platform.uname()
await ctx.reply(embed=nextcord.Embed(title="Information for bot", description=f"System: {osps}"))
what he writes:
This should work? Seems cleaner than what you have right now as well
Actually looking at it, might need a fix but eh
shit i forgot how i fixed this the last time
You can still make this connection clearner, and get rid of asyncio.run entirely
Which I would do, as asyncio.run creates a whole new event loop
Could cause issues later on, since your bot depends on an event loop
You can just overwrite your bot's connect method, which is a coroutine function
class Foo(Bot):
async def connect(self, ...) -> None:
self.connection = ...
await super().connect(...)
connect is called internally by the wrapper after you call bot.run()
Also I'm assuming your IDE Is telling you it does not exist because you didn't add a placeholder for it
To get rid of that error you may add it before hand to the constructor method
class Foo:
def __init__(self) -> None:
self.connection: Database
``` etc
This doesn't actually initialise the bound attribute though
It just let's your IDE know it exists, and is expected
If you were to access this before the connection is created you'd get an attribute error
Yea, it goes in your subclass
Database would be the type of whatever connection is
Idk how but I made it work! (fixed manually)
Huh? Were you watching my online status :3
Nope lol
I literally just got online like 8:18 kek
xD
help solve this problem, I need the system value
what he writes:
uname_result(system='Linux', node='e4ecd0a42409', release='5.11.0-1029-gcp', version='#33~20.04.3-Ubuntu SMP Tue Jan 18 12:03:29 UTC 2022', machine='x86_64', processor='')
code:
import platform
osps = platform.uname()
@bot.command()
async def server(ctx):
await ctx.reply(f"{osps}")
how can i make that in a embed message
I was more referring to you knowing the difference between sync and async code.
You need to callawait super().connect(reconnect) otherwise it won't keep the super classes implementation, also you type-checker is going crazy because self.bot is expected to be of commands.Bot not Application
For an example, if you were in a cog you'd typehint it like so ```py
class Cog(...):
def init(self, bot: Application):
self.bot = bot
Now the linter knows bot has connection
connection with whom 👀
This might cause a cycle import, so just use if typing.TYPE_CHECKING when importing
Special.. connection, connection with benefits, like api call 😏 😉
Hahaha
In your connect method
It calls the super classes connect method
You overwritten it, so obviously it stops working as expected
You just pass whatever reconnect is
??
👀
dot work
You should call the super class under, usually good practice to do so when overwriting methods
Helpp
But other than that, looks fine to me, and after you typehint the bot properly your type checker won't cry
andy so smart
When loading a cog? Yea, look at the setup method usually at the bottom of your Cog file
You didn't typehint like I did in my example
do you have a __init__.py in the src directory
Help pls```py
@bot.event
async def on_command_error(ctx, cmd_error, arg):
if arg == help:
embed = discord.Embed(title = "Error", description = "Command not detective", color = 0xe74c3c)
else:
embed = discord.Embed(title = "Error", description = "Command not found", color = 0xe74c3c)
await ctx.send(embed=embed)```
error:
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) TypeError: on_command_error() missing 1 required positional argument: 'arg'
The bottom setup isn't typehinted
Also you will probably get a type error from how your connection is typehinted
I'm almost quite sure that your await asyncpg.connect(...) does not return a coroutine
What is the type error exactly?
Right, ok so inside of test access bot through self.bot
Yea, if you want to access interaction without type error you'd need to subclass the context
Pain, so just don't do it for now unless you are adding more too it
Other than that I'd fix your self.connection typehint in Application as it's wrong
I don't think connect returns a Coroutine
You can just do reveal_type
it returns a Connection object
I don’t know how, but it seems that because of the tabulation I had an error in sending the first embed and after your words, I myself don’t know how to insert the embed sending without an error ... No, I’m really an idiot
The one with connect?
Ok, try moving the connection stuff into into start, and overwrite it the same way you did with connect
I have this code
class DroppDownMenu(discord.ui.View):
with open("cases.json", "r") as f:
cases = json.load(f)
options = []
for case_name in cases:
options.append(discord.SelectOption(label=case_name, description="descrption"))
@discord.ui.select(placeholder="Choose one option", min_values=1, max_values=1, options=options)
async def callback(self, select, interaction : discord.Interaction):
with open("cases.json", "r") as f:
cases = json.load(f)
case_name = select.values[0]
case_picture = cases[case_name]["url"]
await interaction.delete_original_message()
await interaction.response.send_message(case_picture)
@commands.slash_command(name='own_pc', description='Shows charts with benchmark of CPUs, GPUs or RAM', guild_ids=[708218806928932896])
async def own_pc_slash(self, ctx):
view = DroppDownMenu()
await ctx.respond("Choose the case", view=view)
So it sends a message with a select menu
But how can I disable the menu after I used it
I tried to delete the message with the interaction.delete.original_message but it returns unkown webhook error
start is a method bound to commands.Bot
Just overwrite it like you did for connect and add your database connection there
then remove connect, it might fix it?
connect does more important stuff compared to start anyhow iirc
Yea, under it call the super again
run calls start internally with the token
Just pass token to the start method's arguments
What library is this?
then call super().start with it
py-cord
Oh right it's just dpy
basically
What is it
token? I thought it was TOKEN
Me send error
on_command_error() missing 1 required positional argument: 'arg' Ignoring exception in on_command_error
👍
How do you have the bot ask questions in an embed message?
async def start(ctx):
embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
embed.add_field(name= f"User: {ctx.author.mention}", value="✅Verified 18+✅", inline=False)
await ctx.send(embed=embed)```
does anyone want to build an ai in a discord bot????
That's a windows issue, it's fixed in 3.7+ iirc,
You could also set the event loop policy or something like that, but I forgot what it was exactly
Is the error saying some sort of Proactor error
async def start(ctx):
embed=discord.Embed(title="Profile", description="Desc", color=0x00ff00)
embed.add_field(name= f"User: {ctx.author.mention}", value=":white_check_mark:Verified 18+:white_check_mark:", inline=False)
await ctx.send(embed=embed)```
How do you have the bot ask questions in an embed message?
Is it possible to send 2 embeds in one message ? plz ping
I'm pretty sure asyncpg should be handling that, not sure though
interaction.delete_original_message() is considered a followup action, which you can only perform after responding to the interaction. try using delete_original_message() after send_message()
yes, pass in a list of embeds to send() as send(embeds=[...])
thank you
You could try setting the event loop policy to WindowsSelectorEventLoopPolicy
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) iirc?
embed = [embed1 , embed2]
await ctx.send(embed) ?
like this right ?
yep, try it out
windows is so garbage 😔
you can send up to 10 in a single message
Help plspy @bot.event async def on_command_error(ctx, cmd_error, arg): if arg == help: embed = discord.Embed(title = "Error", description = "Command not detective", color = 0xe74c3c) await ctx.send(embed=embed) else: embed = discord.Embed(title = "Error", description = "Command not found", color = 0xe74c3c) await ctx.send(embed=embed)
error:
await coro(*args, **kwargs) TypeError: on_command_error() missing 1 required positional argument: 'arg' Ignoring exception in on_command_error
👍
!d discord.ext.commands.Bot.on_command_error
await on_command_error(context, exception)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
The default command error handler provided by the bot.
By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.9)") however it could be overridden to have a different implementation.
This only fires if you do not specify any listeners for command error.
arg is not part of the signature
not working
help is also a builtin callable, that comparison wouldn't work even if arg was defined
hmm... can't it be turned off somehow? well, so that python help does not work
It's tedious and time consuming
i have come to the conclusion that the current bot I am making will be the last 🗿 . (unless the api wrapper is Rin)
one of my good people typed the code like this:
bot = commands.Bot(command_prefix ='h!', help_command=None)
same error? can you show your code again?
if you finish Rin, and I make a bot with it, that will be it for my bot development "career"
hey everyone,
does anyone have an idea i can add for my currency bot it will be extremely helpful

My wrapper will be the epoch of your bot career 🙀
Or will that not help at all?
ye I'll be moving onto serious c# and rust development instead of python dev
How long have you been programming in python for?
okay okay, but can one command have 2 or more triggers?
Triggers?
anyone got any ideas for a currency bot
1 mouth
Well, like for one team to work from two or more triggers
I have no clue what you're talking about.
Like I write help or pleh and the same command works
The list of aliases the command can be invoked under.
very helpful sentence
pass aliases=... to the @command decorator
Aliases's type is: Union[List[str], Tuple[str]]
Why are you so determined to use help object as a string
@bot.command(aliases = ["help", "pleh"]) yea?
as the type says, a list or tuple of strings
yes
Definitely not enough to be attempting discord.py with
^
hurts me to see so many extreme beginners getting into dpy too early
Well, for the sake of creating bots in discord, I'm learning this language
You see it all the time unfortunately, discord.py is just one of those libraries that attracts newbies like a moth to a light
how hard can be?
learn the LANGUAGE before the LIBRARY
imagine learning first the lib then lang
how i separate arguments in command
edonate 560 adv | 1w | greentea 35 pts
like that
with |
or comma
!args-kwargs ?
*args and **kwargs
These special parameters allow functions to take arbitrary amounts of positional and keyword arguments. The names args and kwargs are purely convention, and could be named any other valid variable name. The special functionality comes from the single and double asterisks (*). If both are used in a function signature, *args must appear before **kwargs.
Single asterisk
*args will ingest an arbitrary amount of positional arguments, and store it in a tuple. If there are parameters after *args in the parameter list with no default value, they will become required keyword arguments by default.
Double asterisk
**kwargs will ingest an arbitrary amount of keyword arguments, and store it in a dictionary. There can be no additional parameters after **kwargs in the parameter list.
Use cases
• Decorators (see !tags decorators)
• Inheritance (overriding methods)
• Future proofing (in the case of the first two bullet points, if the parameters change, your code won't break)
• Flexibility (writing functions that behave like dict() or print())
See !tags positional-keyword for information about positional and keyword arguments
Not the best idea

!e
def func(x, y):
return x + y
print(func(10, 10))
@slim ibex :white_check_mark: Your eval job has completed with return code 0.
20
BUT before I started learning d.py, I somehow taught python, all the same, with zero knowledge, it’s impossible to do something
nah, impossible, just if you blindly copy paste what you see in tutorials and have no idea what are you doing
^
thats just command invocation
no no no, I copy other codes that teach them. I already have experience in coding😄
separate args with |
str.split?
Help me pls
in this case probably you need to have 9-10 args kekw
pros of using slash commands, you don't have to struggle with this kind of stuff
yessir
@commands.command()
async def gwadono(self,ctx,game=None,Winner=None,
time=None,req=None,Amount=None,*,Message=None):```
yes
ya but me not that much pro
are you able to find the server that a command was run in?
does something like ctx.guild.name exist?
The guild name.
yes
watch out, ctx.guild will be None if the command was invoked in dms
nope
if you want to do that kind of stuff you have to only use 1 arg
and then split it between |
like?
wdym like?
Thats why I love slash commands
Ok
How do I get the bot to ping the person I ping like .hey @the
Then the bot would say hey @the
slash commands have a down side and an up side, they are good in some ways and not that good in some ways
it depends on what your commands are gonna do
Get the discord.Member object and use the mention property on it
Of course, but ig list some downsides
So like
@client.command()
Async def fuck(ctx,discord.member):
What are you doing
thats not how args work
I’m just tryna make it respond with the message set and who I ping
You need to use a parameter-
@client.command()
async def fuck(ctx, member: discord.Member): await ctx.send(f"{member.mention}, I politely ask you to fuck off, now if you may.")```
🥄
Indeed
Oh ok im just stupid lol 😂 now gotta try to remake with out fucking up
I'm not going to waste my 7 and a 3 quarters braincells for nothing, tim
Got more brain cells then me
You just have lesser than average
Way less lol
why we bein mean to people
Lmao, thats the usual me
don't you remember when you first started coding
Lol
read the error again
