#discord-bots
1 messages · Page 845 of 1
i also have an overridden run method that loads the cogs
that as well can also be done
you are saying I should move the db connection to run?
no no
async def run(token: str) -> None:
await connection()
cog_setup_method()
super().run(token, reconnect=bool)
async def botrun() -> None:
await SubclassName().run("token")
if __name__ == "__main__":
asyncio.run(botrun())
how would i make it so when the bot sees !help, it would paste text, ex: for help, contact the owner!
something like this i forgot how its done
all good, thanks for the help. I'll try it when I wake up tomorrow.
anytime
sometimes the helpers need the help🗿
😌
if youre trying to learn how to make bots i recommend you use this tutorial
https://vcokltfre.dev
A tutorial on how to use discord.py to create your own Discord bot in Python, written to fix the flaws of many other popular tutorials.
no problem!
Why 5 people out of 100, cant see my slash commands?
if it's a global slash command, it takes time to roll out, they say ~ 1 hour
so perhaps those are in a server that hasn't gotten the slash command yet
So new members need to wait like 1 hour until they get slash commands?
Why can't users see slash commands in certain channels? if these are global channels, these should pop out from every channel, correct?
You can just do if member.bot: count += 1 just to simplify things
Can we see your intents?
both
ah
that would explain it
on the ddp yeah
and on discord use .all() for testing
Can i see the updated intents?
and in the code?
!d discord.Intents
class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.
Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.
To construct an object you can pass keyword arguments denoting the flags to enable or disable.
This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
New in version 1.5...
bot = commands.Bot(..., intents=discord.Intents.all(), ...)
there you are
🤷
doubtful
Obviously they do, it's just not available to the public
Unless you mess around with session cookies and perform tomfoolery with the help of requests
Lot of bots employ the use of a private API, mine included
i personally find it easier to do seperation of concerns, such as have interact with a database using an api rather than messing with connectors
Their API is not public
A wrapper is just something that makes it easier to work with an api
If an API isn't public there will not be a wrapper
Link me that
I mean the API is public
I don't see any trickery going on in the package
I don't see why it wouldn't be allowed
Mee6's website is mee6.xyz right
So they do have a public api
i don't think they do but perhaps someone managed to find the endpoints?
Their API is not public.
yet there are these "wrappers"? curious
How do you know?
I'm looking at the GitHub right now
GitHub for the...?
guys help
in #help-donut
Exactly, the wrapper. Please point me to where the API is publicly documented and the usage of it is encouraged.
Just because the API isn't documented doesnt mean it's not public
If it wasnt public they would require some sort of verification header
That's not hard to figure out, you can just head over to /levels/... and check Network tab
anyone?
Authorization isn't required, but that still doesn't make it public
How is that so hard to understand?
Because if it was meant to be private they would require some sort of verification
It's quite simple
I mean it's undocumented and they haven't said they even have one so yeah it's not really public
It's equally as simple to just perform a Google search and try to see the rationale behind what I'm saying.
If they didn't want it to be used they would just add a verification header. Extremely simple
This isn't an argument, you don't need to defend your claims.
I'm seeing it as such
Then I'm not continuing this conversation.
does have a point, it's sort of confusing how they have an api that basically looks like it has public endpoints
at least that's what i'm gathering from looking at these wrappers
Maybe they just don't want a lot of traffic
Well, viewing server xp leaderboards would be more painful if the user had go through the whole OAuth2 process.
Especially on mobile.
How about someone just contacts them
😔
Is there a way to turn on 2 bots, With one python file?
And how do I print {client} is now online
And instead of client, It should show the bot name
anyone?
ping me please...
you're looking for on_ready
yes and?
you can use multiprocessing.
Is it hard? And are you sure it's gonna work on discord bots?
I'm tryna cheat my Hosting Service and run 2 bots at the same timey
hey, my bot wont start and i dont understand the console error
The concept itself isn’t that complex but I’ve used it before to start multiple processes at the same time and it works fine. I wouldn’t imagine it being different with discord bots since they're basically processes.
oh
ill try that thank you
keep me updated :)
Yeah, just run each bot.run() task in an asyncio.create_task
And then gather them at the end, when you want to block
I've never used asyncios
the same thing happened, do you have anythign else in mind?
Well, you should learn it, because the library you are using is async-enabled 😃
I will try it, ty :)
Np
Send me the new error
with full screen please
or just copy it and send it as a code block
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
oh sorry
--> python3 -m poetry add discord humanize imutils opencv-python aiohttp replit scikit-image portolan flask html2text art psutil
Using version ^1.7.3 for discord
Using version ^4.0.0 for humanize
Using version ^0.5.4 for imutils
Using version ^4.5.5 for opencv-python
Using version ^3.8.1 for aiohttp
Using version ^3.2.4 for replit
Using version ^0.19.2 for scikit-image
Using version ^1.0.1 for portolan
Using version ^2.0.3 for Flask
Using version ^2020.1.16 for html2text
Using version ^5.4 for art
Using version ^5.9.0 for psutil
Updating dependencies
Resolving dependencies...
SolverProblemError
Because no versions of discord match >1.7.3,<2.0.0
and discord (1.7.3) depends on discord.py (>=1.7.3), discord (>=1.7.3,<2.0.0) requires discord.py (>=1.7.3).
Because discord.py (1.7.3) depends on aiohttp (>=3.6.0,<3.8.0)
and no versions of discord.py match >1.7.3, discord.py (>=1.7.3) requires aiohttp (>=3.6.0,<3.8.0).
Thus, discord (>=1.7.3,<2.0.0) requires aiohttp (>=3.6.0,<3.8.0).
So, because python-template depends on both discord (^1.7.3) and aiohttp (^3.8.1), version solving failed.
at venv/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
237│ packages = result.packages
238│ except OverrideNeeded as e:
239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
240│ except SolveFailure as e:
→ 241│ raise SolverProblemError(e)
242│
243│ results = dict(
244│ depth_first_search(
245│ PackageNode(self._package, packages), aggregate_package_nodes
/home/runner/SOL/venv/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
exit status 1```
ty
@stiff anvil why do you want to run it with one python file?
do you have a requirements.txt ?
i do not
I'm tryna cheat my Hosting Service and run 2 bots at the same time
That's probably the issue
So apparently the MEE6 endpoints are not for public use and apparently there is a verification system
Just curious, what provider is this exactly?
That's a pretty terrible solution.
Plox Host
I see
@stiff anvil You should run each process as a daemon with a process manager, try out pm2
Oh, I see, I recently found a deal for a 90c per month 768mb vps but you have to pay yearly
Infinitely better than random services
And what's up @slate swan
add a requirements.txt to your host, And put
disocrd
discord.py
Why both discord and discord.py?
idk, I just do it everytime
They're the same thing..
Can you make requests with the python bot?
yeah, I just do it
try going into packages, search for discord.py and add it
No
Yeah, this works too
Yes, you can use aiohttp (this is already installed if you're using discord.py or a fork)
or really any asynchronous library of your choice
With the bot
?
What do you mean "with the bot"?
They are taking about @unkempt canyon
Oh
My bad
Don't you guys add Jishaku to your bots
I don't develop bots anymore
How do I print {client} is now online? So it shows the bot's name
Has a ton of useful features apparently
client.user.name (might also want to include client.user.discriminator)
use on_ready , and client.user.name would be the username
Pep nightmare
🤷♂️ That's not really the issue here, it's that whatever python-template is, pip has fucked it over as usual
I'll verify if mee6's endpoints actually have a verification system tomorrow
They do
You tested it?
It's not even using pip
I checked, you need some form of authentication (Probably a session cookie)
That's poetry
Well, shit
I usually just fork it if it's on github, change the dependencies and then pull from that
@upbeat vigil is it working?
So do all the wrappers just not work?
Probably not anymore, though that's just from what I know.
Custom evals , debugging, the eval hides your token automatically, helpful with dealing with cogs, terminal Commands, source command and much, which would be quite hard for a beginner to work with
Any challengers?
What is a beginner doing trying to create discord bots lmao
that's 0.00003 seconds
Literally all of that is simple Python.
Multiply it with with 1000 and it's your ping
Discord.py, right?
Yeah, I already got it ty
str(client.user) is a shortcut for client.user.name + client.user.discriminator
Pings are measured in milliseconds tho
No, the library returns them to you in seconds
@client.command()
async def ping(ctx):
await ctx.send(f'Pong! I response in {round(client.latency, 2)} milliseconds!')
So this whole time I've been thinking I was cool?
fuck man

What do you consider yourself to be?
Hey, 30ms ping isn't bad either way
yeah, I know lol
True,on replit
!ping
You are not allowed to use that command here. Please use the #bot-commands channel instead.
An idiot
But not a Python beginner, for sure.
Um
I didn't mean as a python developer, someone who just began with discord.py library
Come on, when you waste hours upon hours on Discord every day, 100ms isn't much 
30ms is cooler tho :)
It's free, That's why...
I mean, they're on datacenters, so their networking is very strong either way
As for the python bot . The bot is already dealing with like 2-3 eval and more than 10 commands per second in a server with 315k members, so more than the latency things like cache and memory matters
!eval
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
evel huh?
@stiff anvil :white_check_mark: Your eval job has completed with return code 0.
Im gae
eval
A custom eval is as simple as doing eval() on some greedy string command argument with a bit of magic using the io module to capture stdout
Eval hiding your token automatically... I mean just use ''.replace(bot.http.token, '') and that's good enough.
Terminal commands.. Just use subprocess.run()
Source command is simple too, just use inspect.getsourcelines() and then create a link to GitHub page with line highlighting
I've used it for a while and know some stuff, but I'll still get things wrong. When I'm unsure about something, I just read up on it again and keep my mouth shut at the same time to avoid giving bad info.
hey guys so i want to make a command that takes the args in replies. Whenever someone calls the command the bot says smth and whatever the person says next is taken as an arg. Any idea how that can be done?
even im trying to understand that
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**...
use this to wait for a message
store the time when you login, subtract it from when the command is invoked
you can use time.time/perf_counter if you just want it in seconds, otherwise check out the datetime package
ty
Are you here?
@client.command()
async def uptime(ctx):
uptime = starttime - datetime.datetime.now()
await ctx.send(uptime)
@client.event
async def on_ready():
global starttime
starttime = datetime.datetime.now()
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'starttime' is not defined
I get this error
@vocal snow
make it an attribute of client instead; ```py
client.starttime = ...
and?
okay wait
Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "/home/container/setup.py", line 29, in uptime
uptime = starttime - datetime.datetime.now()
NameError: name 'starttime' is not defined
should I add client.starttime here too?
@vocal snow
'Bot' object has no attribute 'starttime'
urgh
that means that the command is being invoked before the on_ready callback
How do I fix it?
set client.starttime somewhere else i guess
okay...
Can Someone pls help me? When i use this code here right it shows the status of those using spotify what song and what not but the code is only working for certain people and not all people when they are not using spotify the only to work was the try and except. But that doesnt work for everyone.
@commands.command()
async def spotify(self, ctx, user:nextcord.Member = None):
try:
if user == None:
user = ctx.author
pass
if user.activities:
for activity in user.activities:
if isinstance(activity, Spotify):
embed = nextcord.Embed(title = f"{user.name}'s Spotify", description = "Listening to {}".format(activity.title), color = 0xC902FF)
embed.set_thumbnail(url=activity.album_cover_url)
embed.add_field(name="Artist", value=activity.artist)
embed.add_field(name="Album", value=activity.album)
embed.set_footer(text="Song started at {}".format(activity.created_at.strftime("%H:%M")))
await ctx.send(embed=embed)
return
if user.activity is not Spotify:
await ctx.send("Hello")
if user.mention.activity is not Spotify:
await ctx.send("Hello")
except:
em = nextcord.Embed(title = f"{user.name} isnt using spotify thou?", description = "They are currently using a different application <3", color = 0xC902FF)
await ctx.send(embed=em)
return
It may look like its not indented properly but it is.
the suppose output is meant to be:
https://gyazo.com/d75959b7de37a17383170eee27569798
Make sure you have presence intents
I changed the hex color to an int but it didnt work, i dont know y
oh , that just doesn't work as expected
It has all intents enabled
Utilise the any function to check if the user has a Spotify activity using instance
That would be faster, and easier to handle
Copied code
Instead of a try/expect
ill try it
@commands.command(aliases=['Ban'])
@commands.has_permissions(ban_members=True, administrator=True)
async def ban(self, ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="No reason provided"
await ctx.guild.ban(member)
await ctx.send(f'{member.mention} has been Banned from the server for: {reason}')
if self.user.dm_channel == None:
await self.user.create_dm()
await self.user.dm_channel.send(
content=f"You have been banned from {ctx.guild} by {ctx.message.author}\nReason: {reason} ")```
For some reason it’s not dming the user when they are banned am I missing something?
Nope, just the bot doesnt have mutual servers with the user no more and maybe their dms are closed
Send the message first
Then ban the user
I was using my other acc and it’s in another server with the bot
I want the bot to dm the user lol
Do that b4 await ctx.guild.ban
Move your last sentence outside the if
And you an just await user.send
If the user's dms are closed it will return an error
Also, it's not self.user
True
No
If I keep it as just user I get the user is not defined so would it be ctx.user?
Why do you use user when in the function you have a member?
Would it work if member i thought it would be like the member who made the action? And the user affected
I got it fixed thanks
ok, is there any way to make my bot shows all the commands cooldown at once
what
use ur search skill, too much type hint not gud
me 2 tbh xd
1st tip: dont use replit
Idk what's that
Why
- it suck
- fking visible to everyone with ur link
is it possible to make a bot add a slowmode to a channel that is less than 5 seconds?
or is 5 seconds the lowest.
ok'
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="prefix", help_command=None, case_insensitive=True)
@bot.command()
async def ping(ctx):
await ctx.send("pong")
bot.run("token")
Oh ok thanks
ok, np
bro that code is written in the documentation of the package that you are using...
1 sec
if you go to the github of the package you can find a lot of examples
?
you want to show all the commands that has a cooldown?
no, i mean like show all comands cooldown
all the commands that are in cooldown?
yes, and their own cooldown timer
normal
ok
how do i send a embedd text using discord bot ???
like text with image ?
ok so
b h r e
ty
and 3 sec also exist
so?
you have to get the list of your commands doing bot.commands)
not for me?
but i'd like to set it to one second
just to make sure noone can spam
ok
mmm, ok?
didn't understand
commands has a parameter to check if a command has a cooldown, which is command.cooldown_after_parsing
ooh i see
then you can use the method get_cooldown_retry_after which requires the context as argument to get the time remaining before the command can be invoked again
ok :V
and in code use?
well there are many, you want to make something like an help menu?
mmm, more likely into command cooldown list
then you can try something like this:
async def get_cooldown(ctx: Context):
message = ""
for command in bot.commands:
if command.cooldown_after_parsing:
message += f"times before invoking {command.name}: {command.get_cooldown_retry_after()}\n"
await ctx.send(message)
get_cooldown_retry_after return a float, probably is the time remains in seconds
and maybe you have to check if that value is greater than 0 too before adding it to the message
ok, wait
@bot.command()
async def get_cooldown(ctx):
message = ""
for command in bot.commands:
if command.cooldown_after_parsing:
message += f"times before invoking {command.name}: {command.get_cooldown_retry_after()}\n"
await ctx.send(message)```400 Bad Request (error code: 50006): Cannot send an empty message
probably no commands are in cooldown
litteraly a command in cooldown for 10 minutes ;-;
doing what
it's the same thing, btw it founds no commands on cooldown
HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
What bucket type has the cooldown?
wut
copy the @vale junco decorator function
lol @vale junco
this ig?
@commands.cooldown(1, 600, commands.BucketType.user)```
lol it is written too, try to set it to None
the what
u know how?
same way as u set the 5sec cooldown
then 3 sec
the bucket type
doesnt have that either
oh ok, command.BucketType.None?
b r u h
i thought u knew what u were doing
Nope, BucketType.default
oh ok
same thing
wait you are not sending the ctx as the argument of the get_cooldown_retry_after
i even said to you that it needs the context as argument
???
do you know what the context is?
yes ig?
(dat ctx : Context maybe?)
yes, get_cooldown_retry_after needs it as argument
anger
b r u h, ok
from where :V
it is in the commands folder, so..?
oh, from discord.ext.commands import context?
ok :V
i hate liiiife
HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message
you have to PASS the CONTEXT in the get_cooldown_retry_after() method
ctx or Context
ctx is your context .-.
oh ok
@bot.command()
async def get_cooldown(ctx : Context):
message = ""
for command in bot.commands:
if command.cooldown_after_parsing:
message += f"times before invoking {command.name}: {command.get_cooldown_retry_after(ctx)}\n"
await ctx.send(message)```
still cant send empty message error and ukr that i alr use dat farm command
what?
still HTTPException: 400 Bad Request (error code: 50006): Cannot send an empty message error
print bot.commands in the console
ok wait
<bound method GroupMixin.command of <discord.ext.commands.bot.Bot object at 0x00000246BAB68D30>>
send me where you declared the bot
bot = commands.Bot(command_prefix=["sal! ", "Sal! ", "SAL! "], help_command=None, case_insensitive=True)
and bot.commands gave this?
yep ;-;
oh, no "s"
...
Hey @small igloo!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
bruh
@small igloodont u want is_on_cooldown?
what?
you gonna check if you have any cooldowns right?
send a list of command's cooldowns
oh not the actual users cooldown
yep
my vpn doesn't let me join the page
then turn it off :D
i need it to work 😄
Why
ok, just examples
{<discord.ext.commands.core.Command object at 0x000001EC3CFA7820>, <discord.ext.commands.core.Command object at 0x000001EC3A918070>}
helo
most of VPN users wont admit what their true intention of using VPN...
list comprehension
cuz to join some pages of the docs of my company i need the company vpn and my credentials
that should work
@small iglooi can tell your code dosnt show anything with cooldowns
ok
uptime #commandname
False #bool-> command.cooldown_after_parsing
0.0 #how much time till command can be used again
this is what you checking
i dont think you can get the cooldown of a command
async def testing(self, ctx):
for command in self.bot.commands:
print(command)
print(command.cooldown_after_parsing)
print(command.get_cooldown_retry_after(ctx))```
my bot has 2 commands, createbackup and applybackup, createbackup basically gets every channel and role and compiles them into a single file. and applybackup it takes the file the user uploaded and reads it. now my problem is to convert my key "type" thats a string into a channeltype object. how do i do that
ye cant find anything about it either
why not use build in discord templates?
mhm
irrelevant

well to make string to channelobject should be selfdescribed
theres channel.type.name
thats just a string of the channels name
smartass
but you said u didnt want strings and actual objects
when you need to convert a discord object from a raw data type (python builtin types) then the best way is to use the id of the object
yes?
he dont even need to do that
and if that object gets deleted?
you can just get the channelobjects from the guild
congrats, purpose of backup destroyed
didn't know that you are makin a backup .-.
show how far you came with your backup functin
maybe try reading the message i sent?
btw you can't get the istance of an object which doesn't exists anymore
you have to recreate that object from the data that you have
yeah u will need to save permissions n all, and then create new channel with them permissions
what?
you cant just copy objects
when they doesn't exists .-.
thats the name of the type of channel
thats what im trying :|
then what is your problem? D_D
Hey @quasi stag!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
br
... its still a string
i can't open paste bin .-.
I need help again
okay if for example chocolate cake and strawberry cake are both cakes, and you think both of them has the the same flavor
its discord.Client()
yes
of course .-.
Oh ok thanks guys
everything you code is case sensitive
please learn that functions like abc() and Abc() are not the same
Oh ok
didn't I recommend getattr
and what does that return?
the attribute you requested
exactly
@quasi stagchannel.type.name so what u want? this e.q will be "text" if a simple textchannel etc
i would have to do getattr(discord.channeltype, "news") == discord.channeltype.news like 8 times
you use it to convert the string back into a channel type
then compare that channel type to the other channel types
and?
or just use the string and don't bother with channel types
how do i create a channel using a channeltype argument
you cant just do await ctx.create.channeltype.channel
you can make your own dict
what?
I also recommended this earlier
he can't get an attribute that doesn't exists, doesn't change nothing .-.
t = {"text": Guild.create_text_channel()} etc maybe
who said it doesn't exist
something that aproach
he is makin a backup command
yeah
pretty sure ChannelType has the text attribute no matter what

hm wait how do you run the function
yes but he will not have the argument of that attrivute
are you high
Index the dict and call it normally
t[thing](...)
bro here, if "news" doesn't exists getattr returns None
your dict would look something like
{
"text": guild.create_text_channel,
"voice": guild.create_voice_channel,
...
}
recreate the dict on each command
t = {"text": ctx.guild.create_text_channel, "voice": ctx.guild.create_voice_channel}
test = "voice"
await t[test](name="test")
``` something like this
breh
and access guild from the context
okay ill try
free token! 
coding in mobile!??!!?
anyways client.run shouldn't be indented
it works for now
Maybe you wont see your server in 5 minutes
:)
lol
why tho
I would watch ratelimits though
large amount of channels might not end well with discord
np
where?
that was a different person
shes dumb
indeed
the whole last 3 characters are hidden
#saved
lol
okay i just realized i would need to place the channels in the correct categories and permissions
Which Basically are just a permutation of around 40 characters
ill work in this later
could brute force it in a few seconds probably
you didnt mention how slow bots logging in
doesn't take that long to test a bot token
when you invite bot with permission code like 8 for admin or what it is but lets say u skip "can cfreate channels" can u edit permissions inside server for bot so that he can create_channels?
i would say like 20 channels
or u need to reinvite bot with correct permissions
admin overrides every permission
yeah just find the bot's role and smack the permission toggle
give it administrator permissions and see what happens
give it manage channels
it has all i just said 😄
discord issue
if it still doesn't work it might be something to do with creating permission overwrites for a higher role
this apparently works
any idea abt this error? py Traceback (most recent call last): File "C:\Users\Saad\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "C:\Users\Saad\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "C:\Users\Saad\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In embed.fields.1.value: Must be 1024 or fewer in length. Ignoring exception in command c: Traceback (most recent call last): File "C:\Users\Saad\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "c:\Users\Saad\Desktop\Files\tst.py", line 39, in c await ctx.send(embed=em) File "C:\Users\Saad\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\abc.py", line 1065, in send data = await state.http.send_message(channel.id, content, tts=tts, embed=embed, File "C:\Users\Saad\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 254, in request raise HTTPException(r, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In embed.fields.1.value: Must be 1024 or fewer in length.
In embed.fields.1.value: Must be 1024 or fewer in length.
selfexplained errors 🙂
im slow so :P
read errors from below to top ^^
tnx for the advice ^^
me2 i need cofee but too lazy to make xD
@slate swan i want an advanced bot 😛
btw does wait_for("message") needs a message intent or nah
can be a reaction

docs wait_for(event, *, check=None, timeout=None
but does it need message intent?
the "message" event
it can be a reaction i said 😄
wym by that 🦥
@client.event
async def on_message(message):
if message.content.startswith('$thumb'):
channel = message.channel
await channel.send('Send me that 👍 reaction, mate')
def check(reaction, user):
return user == message.author and str(reaction.emoji) == '👍'
try:
reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
except asyncio.TimeoutError:
await channel.send('👎')
else:
await channel.send('👍')
no like im talking abt the wait_for on a command
nvm imma just try it without the message intent
ik but the question is
does it require the message intent?
no
message content intents, no
alr tnx alot
reaction, user = await client.wait_for('reaction_add', timeout=60.0, check=check)
as u see here no message needed
ok np
can someone tell me how i can get member id using discord.py??
property id```
Equivalent to [`User.id`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.id "discord.User.id")
https://github.com/sifte/bonbons rate code
will I get a cookie? Sure!
God willing
why mongo tho, asqlite/asyncpg is better for bots
Kinda messy imo 
do discord bot users get banned easily? like i'm wondering what is the risk involved of making a bot and then getting banned from discord for example because of trolls. do i have to make it so the user that supports the bot is separate so that the bot owner is a secret just to avoid getting banned or something like that?
@boreal ravine for ext in os.listdir("./cogs"): self.load_extension(f"cogs.{ext.replace('.py', '')}")
wat if a file gets there that has maybe .txt
i don't want to become like this bot https://www.reddit.com/r/discordapp/comments/lgozmy/eli_bot/
n u dont check if even failed or successed load cog
@strong vessel code ur bot well
n use alot of decorations n cooldowns
the bot owner got perm banned, so the bot died forever
nvm i guess its unavoidable
nope
why would I need that?
I needed a quick and easy database to use
sqlite
🤷♀️
anyhelp #databases
ah
guys mongodb vs json?
ok but i how to use it
?
I need someone to show me how to handle channels and prefixes because it went in json, but I want to switch to a regular database.
use SQLite because Mongo is relatively hard
mongo is not recommended for discord bots
And someone can help me? not here, but privately with sqlite
I want to save channels and prefixes in it.
that doesn't make sense lol
but i need normal database
What should I type in my code: client.run(???)
If I saved my token in Heroku as TOKEN. ??????????????
someone help me switch to sqlite? I still have one of these commands and a prefix.
don’t use heroku for discord bots
Why?
it’s made for web services
But can you help me?
it’s probably in your environment variables somewhere
I got you, but I wanna know what should I type in client.run. Because I saved my token as TOKEN
os.getenv(“TOKEN”)?
so anybody? everybody say use sqllite but if i try nobody help
If you want help with SQLite #databases
Thanks!
thanks Ben
you have to use the sqlite3 module or aiosqlite
I would like my bot (about 10,000) on a lot of servers which database do you recommend? report system & log system & welcomerre should be the database.
SQLite can hold a lot so you should be fine
but you prolly shouldn’t have a table for each guild
ok thanks
@strong vesseland uhm yeah owner of bot got permbanned not the bot itself
he probally did something against ToS and stupid he was used bot owner account
is there something wrong with my code? help me?
is user.guilds a thing
And that’s not how if name main is used
ops my bot token
yeah LMAO
Put it atleast in an ENV or something
is this a valid thing
yes so how do i fix it
user.guilds
property guilds: List[discord.guild.Guild]```
The guilds that the connected client is a member of.
property mutual_guilds: List[Guild]```
The guilds that the user shares with the client.
Note
This will only return mutual guilds within the client’s internal cache.
New in version 1.7.
!d discord.Client.event
@event```
A decorator that registers an event to listen to.
You can find more info about the events on the [documentation below](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events).
The events must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.9)"), if not, [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.9)") is raised.
Example
```py
@client.event
async def on_ready():
print('Ready!')
How do I listen for commands in DMs
wdym listen for
Commands should work in dms unless they have a @guild_only() decorator
i don't get it
my code is literally the example and it still gives the same error
read your code
show the code
and read what the command says
god
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Says command not foundpe @bot.command(aliases = ["help", "pleh"]) async def test(ctx): await ctx.send("Test help")

from discord.ext.commmands import Bot
bot = Bot(command_prefix=?,etc..)
@bot.event
async def on_ready():
pass
It's been months since I've used a msg command ngl
subclass 🗿
🗿
"on ready"
"command_prefix=?"
there are some security measures you can take
So even if you get perma banned you still have acces to the bot
?
Why does this happen?
https://cdn.discordapp.com/attachments/881224361015672863/945322055031750776/Screen_Shot_2022-02-21_at_9.12.12_AM.png
I dont even use abc or what ever it is
class discord.abc.User```
An ABC that details the common operations on a Discord user.
The following implement this ABC:
• [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User")
• [`ClientUser`](https://discordpy.readthedocs.io/en/master/api.html#discord.ClientUser "discord.ClientUser")
• [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member")...
I’m confused what
doesn’t matter, what’s the code that raises it
ABCs are base classes that define members that must be implemented by classes that derive from it
That's only because of sharding, which big bots need to have. And yea when the bot got removed from discord it stopped working in all the servers.
!d exit
quit(code=None)``````py
exit(code=None)```
Objects that when printed, print a message like “Use quit() or Ctrl-D (i.e. EOF) to exit”, and when called, raise [`SystemExit`](https://docs.python.org/3/library/exceptions.html#SystemExit "SystemExit") with the specified exit code.
Sorry not sorry
but my code exits
hunter 🗿
Hm?
It's seems you have done pip install typing or something
Uninstall it and it should be fine?
How can i get user that was mentioned in a embed
U forgot to call it
This is just here for versions of python that do not have typing builtin
It's a method
Same with asyncio
!pip asyncio
Who even uses those versions anymore?!
Some people still use python2 ¯_(ツ)_/¯

How can i get user that was mentioned in a embed please help
Ah
I'm out
it could not be more clear
How can i get user that was mentioned in a embed please help
do you want them to stick a massive youtube tutorial saying exactly what to do?
bro
its a bit complicated
@slate swan the error tells you to add await
!d discord.Message.embeds
A list of embeds the message has.
!d discord.Embed.description
The description of the embed. This can be set during initialisation.
And then, u gotta use regex or smth
you would have to check each part of the embed
hm
😔 you can just if user.mention in description
Sarthak 👀
and then put it ona embed
dont you use command parameters?
there are 2 ways to ping
yo, rare sight
do you mean the !?
mhm
discord/member.py lines 489 to 494
@property
def mention(self) -> str:
""":class:`str`: Returns a string that allows you to mention the member."""
if self.nick:
return f'<@!{self._user.id}>'
return f'<@{self._user.id}>'```
the api always returns the correct mention type, i moment
so im trying to list a specific guild members but idk how to do that properly
indentation...

why in on connect?
on_connect doesnt pass guild
on connect takes in reconnect param
idk wtf you're trying to conjure
^ some wizardry shit
!d discord.on_connect
discord.on_connect()```
Called when the client has successfully connected to Discord. This is not the same as the client being fully prepared, see [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready") for that.
The warnings on [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready") also apply.
takes nothin
oh I was thinking of just connect
Avada Kedavra
there changed it to on_ready
ok
That doesn’t make any difference?
on_ready doesn’t take in anything either
!d discord.on_ready
discord.on_ready()```
Called when the client is done preparing the data received from Discord. Usually after login is successful and the [`Client.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.guilds "discord.Client.guilds") and co. are filled up.
Warning
This function is not guaranteed to be the first event called. Likewise, this function is **not** guaranteed to only be called once. This library implements reconnection logic and thus will end up calling this event whenever a RESUME request fails.
oh
there is a difference between on_ready and on_connect. on_ready is when the bot is ready to be used. on_connect means that it is only connected to discord
mm ok
your indentation sucks man
thats why it dosent work
if there are more errors please print it out
!indents
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
and there is no parameters to on_connect
i still haven't tested im just asking if im doing it properly
except should be un-indented once more
() in the event
no, it won't work that way
there is no guild inside the brackets it is supposed to be empty
right...
you can't pass a guild as argument, you'll have to pass the id or whatever and get_guild
he also needs member intents for this
rip my spelling
no
why would you uninstall this? also, isn't this preinstalled with python?
discord.on_connect()```
Called when the client has successfully connected to Discord. This is not the same as the client being fully prepared, see [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready") for that.
The warnings on [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready") also apply.
well andy said to
just the same error keeps popping up
Andy said something about uninstalling it for an ABC callable error, but I said the same thing
So then is it ssomething i installed?
its just replit being weird, it installed another library named typing and now he's unable to delete it
!pip typing
replit moment
just try making a new repl
found where its hidden
did that 3 times
e thats typing extensions and is important
imma delete this and see how it goes
if you delete that then the whole thing wont work
oops
he installed some whack 3rd party typing which fucked with some abc class
i didnt though
there is an error for this
await message.add_reaction(':thumbsup:')
it says
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPException: 400 Bad Request (error code: 10014): Unknown Emoji
the fuq now everything inst running
you need the unicode/emoji instance
you need to put an actual emoji
or unicode
ok
just move to something like vs code and then once everything is solved make a new repl
alright
also if i delete these, these would create back again?
unicode?
Can you send the insides of the pyproject.toml
that will also work
what is that
alright
!code
not that uhm the thing where i can paste it
!pastebin
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.
Something is wrong with your repl
People get that error by having the pypi version of typing installed
But here it says you don't have it
and then run it?would it create it back?
Sure
alright thank you
what does this mean btw?
@fresh iron
write yes
when i use the code below i get the error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'function' object has no attribute 'int' how wouldi fix this?
@bot.command(name="contact")
async def contact(ctx):
guild = ctx.guild
admin_role = guild.get_role(945326991526219848)
bot_role = guild.get_role(945107766035513357)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
bot_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
await guild.create_text_channel("private-channel", overwrites=overwrites)
@fresh iron i found the problem you havent defined the guild in the command
so is the repl functional now?
Full traceback?
Hey @brittle axle!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
sorry?
Full error that’s sent
!traceback
Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.
A full traceback could look like:
Traceback (most recent call last):
File "my_file.py", line 5, in <module>
add_three("6")
File "my_file.py", line 2, in add_three
a = num + 3
TypeError: can only concatenate str (not "int") to str
If the traceback is long, use our pastebin.
https://paste.pythondiscord.com/asonupoxuc @fresh iron
ohhh
Traceback (most recent call last):
File "C:\Users\NAME\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\NAME\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\NAME\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'function' object has no attribute 'int'
U forgot to do () (call it)
@final iron
Imagine
bebop
nope
oh no not pycord
going to pycord
because in the poetry it was discord
poetry install
you have better choices tho
i like pycord though
disnake pls
no :)
*someone said its cool and best
their docs are shit they kept the discord namespace for some reason
and it just makes it harder for people to transfer to it
?
They kept the namespace lol?
pycord docs have like discord.discord.ext
This is gonna be like client vs bot all over again
console.log("Waiter Is Online, Just Checking: \n :heavy_check_mark: Means Working \n ✘ Means Not Working \n")
});```
nothing showing in terminal after this
**Making a discord bot btw** - node.js
yea, discord.Client vs discord.Bot
idky they did that
You should ask in one of the javascript servers, this is a python server
this is python server lol ccheck out discord.js
Disnake
disnake.
cuz im getting tired of this
(Even though I am a nextcord user mainly)
No
um?
🏃♂️ im a hikari user, but yea i find disnake cool
I like neither of the forks 👁️ 👁️
I’m a pincer watcher but a Rin lover
Must be becus of collectors 😼
rin ahem
when i use the code below i get the error: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'function' object has no attribute 'int' how wouldi fix this?
Traceback: Traceback (most recent call last):
File "C:\Users\NAME\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\NAME\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\NAME\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'function' object has no attribute 'int'
@bot.command(name="contact")
async def contact(ctx):
guild = ctx.guild
admin_role = guild.get_role(945326991526219848)
bot_role = guild.get_role(945107766035513357)
overwrites = {
guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(view_channel=True),
admin_role: discord.PermissionOverwrite(view_channel=True),
bot_role: discord.PermissionOverwrite(view_channel=True),
guild.me: discord.PermissionOverwrite(view_channel=True)
}
await guild.create_text_channel("private-channel", overwrites=overwrites)
btw where is the disnake community
you didnt send the main part of error again
so i can go make helli mean ask questions
https://disnake.dev it has an invite to their server
im not sending it cause i dont think it gets bypassed
A modern, easy to use, feature-rich, and async API wrapper for Discord written in Python.
yep thank you
^ we can’t see the line of code where the error was raised
me?
Yes

