#discord-bots
1 messages Β· Page 661 of 1
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
False
it'll never be true
yeah
i wonder if you can do operator overloading with different types
i mean technically speaking itll work but idk how to write that
this is not really related to bot development but i kind of found a way to make an error handler for a command using else and if statements
My client secret is my token, correct?
yes
!e
class B:
def __str__(self):
return 'B'
if str(B()) == 'B':
print(True)
else:
print(False)
``` i mean it worked πΏ
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
True
!e
class A:
def __init__(self, letter):
self.letter = letter
def __eq__(self, other):
return self.letter == other
a = A("b")
print(a == "b")
@sick birch :white_check_mark: Your eval job has completed with return code 0.
True
yay
there we go
rlly?
But when i go to the bot section on the Discord Bot API, it says Token there too.
i thought u couldnt
hmmm
__eq__ is a dunder 4 comparing the class to something else right?
correct
hm
!e
class A:
def __init__(self, letter):
self.letter = letter
def __eq__(self, other):
print("ran a dunder")
return self.letter == other
a = A("b")
print(a == "b")
@sick birch :white_check_mark: Your eval job has completed with return code 0.
001 | ran a dunder
002 | True
Please use pointer comparison
cool stuff
Yeah. The client secret didn't work when I tried to run my bot. Now my bot is online when I used the token in the Bot Section of the Discord Bot API.
client secret is for oauth2 flow as far as i'm aware
OMG IT WORKED
i remember using it when i was making my log in with discord thing
@bot.command()
async def lol(ctx, lol: None):
if lol == None:
await ctx.send('bru lol is nothing')
else:
await ctx.send('nice, lol')
OMG FINALLY
unlike java you can't do object == None you have to do object is None
lol = None
i spent like 2 days trying to make my own web browser to bypass shit at school and my dumbass couldnt realize how to do it and now i finally did it
:troll:
Not lol: None
None is actually a NoneType which is technically an object
!ot <=
Off-topic channels
There are three off-topic channels:
β’ #ot2-never-nesterβs-nightmare
β’ #ot1-perplexing-regexing
β’ #ot0-psvmβs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
crab game
!e ```py
a = None
print(a == None)
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
True
== is checking if the value is same
i mean None == None
?
nvm that doesn't make any sense
oh
go to off-topic
oh yeah mb
i never use the == or is, i just check for falsy or truthy values haha
π€
same
That must not be very good practice
say "aye" if you do debug print statements xD
i've actually been trying to learn the debugger
@velvet tinsel π
debug print statements = something which prints whenever a command is triggered
:torll:
in terms of discord bots
token is literally the secret of your bot. your not meant to share it with anyone
!e
b = None
if b:
...
else:
print('doesn\'t exist')
``` i always do this to handle nonetypes π
@boreal ravine :white_check_mark: Your eval job has completed with return code 0.
doesn't exist
thats why regenerate exists
Uhhhhhhh
I know that.
ok
ODAwOTc4NTQyMjI1MzkxNjU2.AZZQ.r-9fRpJ-gykVk
Hehe
wtf?
π€£
!e ```py
a = []
if a:
...
else:
print("doesnt exist")
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
doesnt exist

And then there's me who use if statements like if not a only when I don't know what data types can be entered in the variable and when it's None or something π
indeed
And then there's me who doesn't know how else, elif and if statements work but still managed to create a calculator :troll:
You should probably learn how to typehint if you haven't already. That helps a lot with that issue
Especially when there's like three type checkers screaming at me all at once
Me who codes on the basis of typehints only: π
guys we are getting off topic now
No typehints --> I am lost most of the times if I am new to the lib
My discord API wrapper is typehinted and all internals are documented
My contributors are never lost
π
This is one reason I hate JS. It doesn't have fucking typehints but that's the talk of another day
typescript go brrr
I use Coffeescript
never tried it but i'd like to at some point
its great and kinda cute
Made a standalone exe which opens discord web automatically. It's just like the discord app only difference is it opens as a web not as an app
is tabnine even good
it is
and isnt typehinting just code- oh i get it
class DumbPerson: pass
def learn(person: DumbPerson): pass```
its useful in these cases where you can let the user and the IDE know what type the function accepts
Lmao the name tho

hey why did you call me for no reason in a code block
!e
def myFunction(aString : str):
print(aString)
anInt = 81
myFunction(anInt)
@sick birch :white_check_mark: Your eval job has completed with return code 0.
81
this is a certified python moment
!e
def mebeingdumbrn(string: str):
# did you just make "string" a "str" :troll:
print(8+2)
mebeingdumbrn()
@shadow wraith :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | TypeError: mebeingdumbrn() missing 1 required positional argument: 'string'
Not a certified python moment because you aren't following pep8
oh wait your right
def mebeingdumbrn():
# did you just make "string" a "str" :troll:
print(8+2)
mebeingdumbrn()
what does pep8 say on the matter
For function names you are supposed to do snake case
crab i forgot to say !e
Java developer moment
And same for variables
euh what's snake case again
snake_case
this_is_snake_case
i see
you_just_meant_underscores_did_you
definitely didn't just finish doing my java project for school
!e
def mebeingdumbrn():
# did you just make "string" a "str" :troll:
print(8+2)
mebeingdumbrn()
@shadow wraith :white_check_mark: Your eval job has completed with return code 0.
10
whenever im not coding discord bots i always name my variables long stuff like "long_names_like_this" or "among_ussy_gus"
short & sweet is good but sometimes you gotta go big
How can I run a command every so often
run it often Β―_(γ)_/Β―
automatically run a command every x hours* 
your a user so you should run it every x hours
the tasks extension
great ty, how would I go about seeing when a command was last used?
database
I'm already using mongo db
!d time.perf_counter
time.perf_counter() β float```
Return the value (in fractional seconds) of a performance counter, i.e. a clock with the highest available resolution to measure a short duration. It does include time elapsed during sleep and is system-wide. The reference point of the returned value is undefined, so that only the difference between the results of two calls is valid.
Use [`perf_counter_ns()`](https://docs.python.org/3/library/time.html#time.perf_counter_ns "time.perf_counter_ns") to avoid the precision loss caused by the [`float`](https://docs.python.org/3/library/functions.html#float "float") type.
New in version 3.3.
Changed in version 3.10: On Windows, the function is now system-wide.
well if a command hasnt been used in x minutes, i want to invoke another command
then go with, time.perf_counter
subtract the last saved time from the current time, you will get the seconds
!e
import time
s = time.perf_counter()
time.sleep(1)
print(time.perf_counter() - s)
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
1.005091819446534
!e
import time
s = time.time()
time.sleep(1)
print(time.time() - s)
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
1.0043056011199951
gotcha, I just dont know how I would integrate that in terms of the usage of a command
just save the time in database when someone invokes the command
!e
print(round(1.927282827288272))
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
2
yeah but then I needa do a check right
check?
to see when it hasnt been used for x amount of time
thats the check, divide it by 60 and you will get the minutes
Use a task loop
@tasks.loop(minutes=10.0)
async def loop_this(self):
channel = self.bot.get_channel(ID)
await channel.send(βLooping!β)
U should probbaly work within a cog if ur using task loops tho
hmm I havnt used cogs
Itβs not that bad tbh
is it possible to make the bot accept a friend request from a specific user
No
People can't even send friend request to a bot
Bots don't have permission to use the relationships endpoint. This means no friends and no blocking, and also means no bots in group DMs.
sheesh
i made copy of @novel apex
see my codes
import discord
from discord.ext import commands
import os
client = discord.Client()
client = commands.Bot(command_prefix=".")
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Game('Coding'))
print('Bot is ready')
@client.event
async def on_message(message):
empty_array = []
modmail_channel = discord.utils.get(client.get_all_channels(), name="mod-mail")
if message.author == client.user:
return
if str(message.channel.type) == "private":
if message.attachments != empty_array:
files = message.attachments
await modmail_channel.send("[" + message.author.display_name + "]" + message.author)
for file in files:
await modmail_channel.send(file.url)
else:
await modmail_channel.send("[" + message.author.display_name + "]" + message.content)
elif str(message.channel) == "mod-mail" and message.content.startswith("<"):
member_object = message.mentions[0]
if message.attachments != empty_array:
files = message.attachments
await modmail_channel.send("[" + message.author.display_name + "]")
for file in files:
await member_object.send(file.url)
else:
index = message.content.index(" ")
string = message.content
mod_message = string[index:]
await member_object.send("[" + message.author.display_name + "]" + mod_message)
client.run("Nope")
aw man i wanted it in group dms
you just defined client twice
client = discord.Client() and client = commands.Bot(...)
wait
lets see
i don't see it
the bot is running fine
u can also use he code ifu want
you only have need one bot variable
......
so whats wrong?
nice
You could back then but π some people couldn't handle that and we had several problems due to this permission.
I mean you could do it with user accounts but discord doesn't let you do that anymore
Yep, bueno.
You don't need: client = discord.Client()
because you are using: commands.Bot.
https://discordpy.readthedocs.io/en/stable/ext/commands/api.html?highlight=commands bot#discord.ext.commands.Bot
Yes, you can use a VPS.
||/||
wdymn
i use replit only
and pycharm
Ok then you can do 24/7 there on Repl
but i need to on it again and again
?
No, here is your answer: https://youtu.be/SPTfmiYiuok?t=3542
Learn how to code a Discord bot using Python and host it for free in the cloud using Repl.it.
π¨Note: At 16:43, Replit now has a new method for environment variables. Check the docs: https://docs.replit.com/programming-ide/storing-sensitive-information-environment-variables
Along the way, you will learn to use Repl.it's built-in database and cr...
i dont like this old man
Its not about the person.. its about the content, follow the video if you want 24/7 on repl
@sullen shoal π
cuz i saw this vid i was doing it in node.js and it was py
@sullen shoal will give his thoughts on this one
Idk why I am being mentioned..and cool
@maiden fable stop copying me
why aren't you doing your bot in node js then?
why dont i have roles
Okay sorry
thats so ageist lol
Ik, I just ain't in the correct state of mind rn, sorry
Lol
import discord
from discord.ext import commands
import os
client = discord.Client()
client = commands.Bot(command_prefix=".")
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Game('Coding'))
print('Bot is ready')
@client.event
async def on_message(message):
empty_array = []
modmail_channel = discord.utils.get(client.get_all_channels(), name="mod-mail")
if message.author == client.user:
return
if str(message.channel.type) == "private":
if message.attachments != empty_array:
files = message.attachments
await modmail_channel.send("[" + message.author.display_name + "]" + message.author)
for file in files:
await modmail_channel.send(file.url)
else:
await modmail_channel.send("[" + message.author.display_name + "]" + message.content)
elif str(message.channel) == "mod-mail" and message.content.startswith("<"):
member_object = message.mentions[0]
if message.attachments != empty_array:
files = message.attachments
await modmail_channel.send("[" + message.author.display_name + "]")
for file in files:
await member_object.send(file.url)
else:
index = message.content.index(" ")
string = message.content
mod_message = string[index:]
await member_object.send("[" + message.author.display_name + "]" + mod_message)
client.run("nope!")
Whats wrong?
import youtube_dl
import discord
from discord.ext import commands
import os
import wikipedia
client = commands.Bot(command_prefix="!")
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Game('Helping'))
print('Bot is ready')
@client.command()
async def aah(ctx):
await ctx.send("Working on music bot pls be patient")
@client.command()
async def kick(ctx, member : discord.Member, *, reason=None):
await member.kick(reason=reason)
@client.command()
async def ban(ctx, member : discord.Member, *, reason=None):
await member.ban(reason=reason)
@client.command()
async def a(ctx):
await ctx.send("sheesh sheesh sheesh sheesh sheesh sheesh sheesh sheesh")
@client.command()
async def play(ctx, url: str):
song_there = os.path.isfile("song.mp3")
try:
if song_there:
os.remove("song.mp3")
except PermissionError:
await ctx.send("Wait for the current playing music to end or use the 'stop' command")
return
Bruh
voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='General')
await voiceChannel.connect()
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
# for file in os.listdir("./"):
# if file.endswith(".mp3"):
# os.rename(file, "song.mp3")
voice.play(discord.FFmpegPCMAudio(url))
@client.command()
async def leave(ctx):
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
if voice.is_connected():
await voice.disconnect()
else:
await ctx.send("The bot is not connected to a voice channel.")
@client.command()
async def pause(ctx):
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
if voice.is_playing():
voice.pause()
else:
await ctx.send("Currently no audio is playing.")
@client.command()
async def resume(ctx):
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
if voice.is_paused():
voice.resume()
else:
await ctx.send("The audio is not paused.")
@client.command()
async def stop(ctx):
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
voice.stop()
client.run("Nah")
Wtf
!code dude
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.
bunch of
And yea stop spamming code
!slap @maiden fable
Bruh.
bruh, that tutorial is very bad
Sure
Interesting opinion, why is it bad for the context of what I mentioned earlier?
yea + that old man
whats wrong with being old?
i was seeing his video and it was 1hr something and i got confused + he didn't add the github page to copy paste
The link I provided came with a timestamp for the specifics of how to implement 24/7 on your repl.it bot -- Personally I did not learn through him either
π
really
Yes really
does ctx.author.roles contain the role name strings or id's
because his code is old now and there are better ways to do it. Replit uses shared ip, its not meant to be used to host stuff uses third party API with rate limits because it uses shared ip meaning if 50 people are using machine (which is pretty nomal in case of replit) all those requests will be counted as from one bot and every bot which is being hosted with that ip will be rate limited pretty soon if they all together send 10k requests in 10 minutes
It contains the role objects (the name, id etc)
!d discord.Member.roles <=
property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [β@everyone](mailto:'%40everyone)β role.
These roles are sorted by their position in the role hierarchy.
Yeap.. clearly you gave all that opinion without reading my context. I specifically mentioned he should use a VPS.;
Great post tho
Go up more mate
Or.... if you want some basic 24/7 you can also use Repl.it
why are you suggesting that?
just buy vps or host locally, you got two options
i dont need
Because he said that he uses Repl.it, and I did suggest a VPS.
I mean you can use replit to host 24/7, it isn't that big of a deal; It's their choice if they wanna use it not yours or you could use heroku which is an alternative or you could go find a free host yourself (railway, CDH, etc)
Please read prior to posting.
you suggested vps thats it, dont suggest replit after suggesting that
Lol, telling people what to do Myxi?
I will leave this at here, don't wanna escalate.
would:
for i in interaction.author.roles:
if i in [staff_role, "Developer"]:
return
``` work to check if the author has one of these two roles
you want them to ratelimit their bot multiple times and get banned?
no
if i.name in ...
Considering staff_role is also a string
for i in interaction.author.roles:
if i.name in ["Staff", "Developer"]:
return
```?
staff role was an id
Check i.id or i.name for both, either use the ID or the name string
Why not use utils.find
returns none on what
utils.find will return none if the role isn't there
so i want to regularly update my bot, but at the same time i dont want it to keep going offline very often. is there anyway to make sure that i can update it without the bot going offline for very long or it running in multiple instances? it also uses a database to log how many messages a user has sent in all the guilds, so if i do have to update, i will have to first put the bot offline in heroku, then download the git repo, update it, reupload the files and then switch it on.
is connecting to the repo and directly developing on it a good idea?
At this point stop using Heroku and get a real hoster made for bots that isn't volatile.
can you even use discord.utils to find mulitple values in something?
That's for what lambdas are used
utils.find(ctx.author.roles, lambda role: role.name in [])
!d discord.utils.find
discord.utils.find(predicate, seq)```
A helper to return the first element found in the sequence that meets the predicate. For example:
```py
member = discord.utils.find(lambda m: m.name == 'Mighty', channel.guild.members)
``` would find the first [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") whose name is βMightyβ and return it. If an entry is not found, then `None` is returned.
This is different from [`filter()`](https://docs.python.org/3/library/functions.html#filter "(in Python v3.9)") due to the fact it stops the moment it finds a valid entry.
I did the opposite but u get the idea
do I need to iterate through it or something
yeah
but it's only returning one value
I have both kayle and a moderator role
o
!d filter
filter(function, iterable)```
Construct an iterator from those elements of *iterable* for which *function* returns true. *iterable* may be either a sequence, a container which supports iteration, or an iterator. If *function* is `None`, the identity function is assumed, that is, all elements of *iterable* that are false are removed.
Note that `filter(function, iterable)` is equivalent to the generator expression `(item for item in iterable if function(item))` if function is not `None` and `(item for item in iterable if item)` if function is `None`.
See [`itertools.filterfalse()`](https://docs.python.org/3/library/itertools.html#itertools.filterfalse "itertools.filterfalse") for the complementary function that returns elements of *iterable* for which *function* returns false.
Sorry my bad*
hm
ah so what should i rewrite it as
Just delete the space
space?
Yes
where π
In the coro
sorry, i litterally just learnt python a day ago
or the basics
In await
Before await add a space
i did
it j says that
Align await ctx.... with responses
!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
so how should i write it
@slate swan
You know replying with ping and pinging me won't help
async def .....
responses = ......
await ctx.....
This is very basic Python
I'd recommend to learn a little bit more and take a look at this ^
How to make my bot online?
you dont really need to give an eample on how to indent something
you run the file
I dont know how
bru
bru
?
Hey mod, could you provide more of your code? or if you did could you mention me on your response?
put ur discord bot token where it says token
Yeah
im tryna make an 8ball command
As you can see your await ctx.send(..... is outside of the function.
press tab before await.
Im new here
Welcome
is there a way to press the new containers/buttons with discord.py 2.0?
yes
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Thats why im here
What does the pyflake show
^^
yep it works
this is just a test bot
I'm glad it works!
No problem and its totally fine to use a test bot with repl.it but when you upgrade to the real thing bot you should do a VPS.
what is the function called?
it isnt a function, it's a class
!d discord.ui.View <=
class discord.ui.View(*, timeout=180.0)```
Represents a UI view.
This object must be inherited to create a UI within Discord.
New in version 2.0.
!d discord.ui.Select <=
class discord.ui.Select(*, custom_id=..., placeholder=None, min_values=1, max_values=1, options=..., disabled=False, row=None)```
Represents a UI select menu.
This is usually represented as a drop down menu.
In order to get the selected items that the user has chosen, use [`Select.values`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Select.values "discord.ui.Select.values").
New in version 2.0.
There are examples in the github if your stuck by the way
this should be good enough, ty very much
π
go before await and press shift + tab, then press tab again.
how do i make a command that like when i say "!add ___" then it adds the thing i said to a list?
Begin by making command like
async def add_command(ctx, *,msg):
then create a list -> you can either make the list with self. so you can utilize throughout the entire class and the info doesn't get lost or keep it local.
then append msg to the list.
I could give you the entire code but that means you wouldn't be learning
If you can't then come back... and we will help you out again
@commands.command(name='pause')
async def _pause(self, ctx: commands.Context):
"""Pauses the currently playing song."""
if not ctx.voice_state.is_playing and ctx.voice_state.voice.is_playing():
ctx.voice_state.voice.pause()
await ctx.message.add_reaction('β―')
await ctx.send("Successfully paused the song!")
@commands.command(name='resume')
async def _resume(self, ctx: commands.Context):
"""Resumes a currently paused song."""
if not ctx.voice_state.is_playing and ctx.voice_state.voice.is_paused():
ctx.voice_state.voice.resume()
await ctx.message.add_reaction('β―')
await ctx.send("Successfully resumed the song!")```
```py
Ignoring exception in on_command_error
Traceback (most recent call last):
File "/home/container/.local/lib/python3.10/site-packages/nextcord/client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "/home/container/ROG.py", line 799, in on_command_error
raise error
File "/home/container/.local/lib/python3.10/site-packages/nextcord/ext/commands/bot.py", line 995, in invoke
await ctx.command.invoke(ctx)
File "/home/container/.local/lib/python3.10/site-packages/nextcord/ext/commands/core.py", line 887, in invoke
await self.prepare(ctx)
File "/home/container/.local/lib/python3.10/site-packages/nextcord/ext/commands/core.py", line 823, in prepare
await self.call_before_hooks(ctx)
File "/home/container/.local/lib/python3.10/site-packages/nextcord/ext/commands/core.py", line 761, in call_before_hooks
await self._before_invoke(instance, ctx) # type: ignore
File "/home/container/ROG.py", line 713, in ensure_voice_state
raise commands.CommandError('You are not connected to any voice channel.')
nextcord.ext.commands.errors.CommandError: You are not connected to any voice channel.```
music cmd pause and resume gave this error
but the bot is playing music
yeah it still wont work
:((
Same error?
Hello, so you mentioned that you need help with two commands?
Help is used to show commands on your cogs/bot.
If you want to redo the help command you will need to understand completely recreate it with a class.
There is a bunch of info on it online.
i dont think so because you need to mention someone to do the whous one
To create the whois command you will need to define a function with whatever name you want, put 2 parameters (ctx, user)
then you will get info from user
and display it by using ctx.send
k
@faint echo @client.command(aliases=['user','info']) async def whois(ctx, member : nextcord.Member): embed = nextcord.Embed(title = member.name , description = member.mention , color = nextcord.Colour.blurple()) embed.add_field(name = "ID", value = member.id , inline = True) embed.set_thumbnail(url = member.avatar_url) embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}") await ctx.send(embed.embed)
my code
Ok, is that causing any problems?
Oh embed.embed is wrong
Ignoring exception in command None:
nextcord.ext.commands.errors.CommandNotFound: Command "whois" is not found
wots wrong
async def whois(ctx, member : nextcord.Member):
embed = nextcord.Embed(title = member.name , description = member.mention , color = nextcord.Colour.blurple())
embed.add_field(name = "ID", value = member.id , inline = True)
embed.set_thumbnail(url = member.avatar_url)
embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
await ctx.send(embed = embed) # embed.embed is wrong
should i still learn discord.py when its not being updated anymore?
you don't learn a library
what are you on about
i suggest pycord or nextcord lul
you know what i mean lol
Ok ill change it and tell u if any errors pops up
command(name="whois", aliases=['user','info'])
okay thank you
ohk
Is this below your bot.run function? Commands won't register if you put it below the function.
wrong typo
i mean its not
bot.run -> This function must be the last function to call due to the fact that it is blocking. That means that registration of events or anything being called after this function call will not execute until it returns.
https://discordpy.readthedocs.io/en/stable/ext/commands/api.html?highlight=commands bot#discord.ext.commands.Bot.run
!d discord.ext.commands.Bot.get_channel <= don't think you can get a channel with context. you can also do discord.Guild.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
save the channel you got in a variable, then send it
channel = ...
await channel.send(**kwargs)
@faint echo still the same error? Why?
you don't need msg.send
you already got the channel, just do await channel_1.send()
sad
@slate swan r u the owner? lol
or just an admin or mod
LOL
he is the co?
lol
@faint echo new error nextcord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.
read the error
pass in something as the argument
you don't just make a function with a parameter, but then you don't pass in something as the argument
!e
def b(x):
return x
print(b())
@boreal ravine :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 3, in <module>
003 | TypeError: b() missing 1 required positional argument: 'x'
async def whois(ctx, member : nextcord.Member):
embed = nextcord.Embed(title = member.name , description = member.mention , color = nextcord.Colour.blurple())
embed.add_field(name = "ID", value = member.id , inline = True)
embed.set_thumbnail(url = member.avatar_url)
embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
await ctx.send(embed = embed)```
you didn't need to send the code
^^
Whats the error?
oh nice
what is it
cool
did you solve it? I already see the issue lol
return isn't a function
it's a keyword, you don't use anything after it except certain keywords
lmao
IDs are integers, not strings
how do i make a command that renames a channel topic?
sadge
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
you can use that to rename channel topics etc
alr
kayle
the old error is back
nextcord.ext.commands.errors.CommandNotFound: Command "whois" is not found```
show ur code
async def whois(ctx, member : nextcord.Member):
if member == None:
await ctx.reply("Please pass in who's id you wanna see")
else:
embed = nextcord.Embed(title = member.name , description = member.mention , color = nextcord.Colour.blurple())
embed.add_field(name = "ID", value = member.id , inline = True)
embed.set_thumbnail(url = member.avatar_url)
embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
await ctx.send(embed = embed)```
@slate swan
@slate swan umm
if message.content.startswith('/text'):
content = message.content[5:len(message.content)]
list = content.lower().split()
end = list[0]
if end not in extensions:
end = '.txt'
f = open('text.' + end,'w')
f.write(content)
else :
f = open('text.' + end , 'w')
f.write(content[len(end) + 2 : len(content)])
print(content[len(end) + 2: len(content)])
await message.author.send(file = discord.File('text.'+end))
f.close()
os.remove('text.' + end)
whenever it sends a file , the file is empty help
show all of ur code in the file where the command is
THEN DM
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.
yes
@boreal ravinewhats wrong?
your command is named who
try doing $who
i changed it
yeah
your prefix Β―_(γ)_/Β―
i asked bec getting more errors
whats the error now
9 syntax errors
bruh how
try it and see
kk
btw if you still get the command not found error go to discord.gg/dpy cause i only know 1 reason why that error raises
yep
Iβve been banned from dpy server so I canβt join
Rip
Why were you banned?
I'm banned from there as well
Why were you banned
uh... π
nothing
why were you banned then
π .
smh
It's @client.command()
You miss the @
still not working man
Any errors?
Ignoring exception in command None:
nextcord.ext.commands.errors.CommandNotFound: Command "whois" is not found
Did you rerun the bot?
ofc
@commands.has_permissions(kick_members=True)
async def whois(ctx, member: nextcord.Member):
embed = nextcord.Embed(title = member.name , description = member.mention , color = nextcord.Colour.blurple())
embed.add_field(name = "ID", value = member.id , inline = True)
embed.set_thumbnail(url = member.avatar_url)
embed.set_footer(icon_url = ctx.author.avatar_url, text = f"Requested by {ctx.author.name}")
await ctx.send(embed = embed)```
@slate swan
Show full cose
*code
@slate swan dm?
wait
!paste
ill dm
alright
@slate swan
@slate swan so whats wrong??
checking gimme a moment
and having a ban command that long is really bad practice, I could make a simple unban command in like 3 lines
@slate swan your code is outdated
member.avatar_url is invalid in nextcord
!d nextcord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.User.avatar "nextcord.User.avatar")
so what should i use
use this instead
with .url
like this property avatar.url?
nah mate
member.avatar.url
now should i check?
and here , it works well
oof lemme rerun and check
@slate swan
not working fo me
any new error?
or is it the same
Ignoring exception in command None:
nextcord.ext.commands.errors.CommandNotFound: Command "whois" is not found
.
@slate swan ill try restarting my editor
@slate swan check if its working for u
yea and "save" the code before doing it
kk
imagine he doesn't have autosave on his ide
ok working now thanks
vsc is broken or smth but afaik, the indent is correct
mix of tabs and spaces ig
I alrd restarted the vsc and I did not even touch the code and it broke
what error do you get on running
interesting, it works ;-; but the error stays
hm hover on the red line and see what it says
You can just do user: discord.User
if word in message.content:
here how can I have a dataset in "word" which will contain some other words as string
Inconsistent use of tabs and spaces in indentation
use either tabs , or spaces for your code
I could but I made this code like 6 months ago and I don't want to yet change it
I do always use tabs
pls help
Use any
any(word in message.content for word in dataset)
what does it mean when its "outside function"
some keywords only can be used inside functions, like yield, return and await can only be used in coroutine functions
why do you need to compare it
ids are already unique
unless if you pass in an id that isn't a user object
wym compare?
read your code
your comparing it
using a comparison operator
oh you mean that, I have no idea what I was doing when II did that
and the user variable is useless
Screw you Hunter
ok
yes
That forbidden
discord.errors.Forbidden: 403 Forbidden (error code: 50007): Cannot send messages to this user
object member not subscriptive
Why tho
the user probably have they're dms closed
in every other command where is a user to be mentioned
is the error object 'member not subsriptive'
nothing like tha
you tried to index a member object
No
yes
I'm in need of a lot of code rewriting but I don't have energy to do that
Just like ...
sad
just like what
you indexed a member object
@client.command(aliases=['bal'])
async def balance(ctx ,user: discord.Member = None):
if user is None:
#test
await open_account(ctx.author)
user = ctx.author
users = await get_bank_data()
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = users[str(user.id)]["bank"]
em = discord.Embed(title=f'{ctx.author.name} Balance',color = discord.Color.blurple())
em.add_field(name="Wallet Balance", value=f'Φ{wallet_amt}')
em.add_field(name='Bank Balance',value=f'Φ{bank_amt}')
await ctx.send(embed= em)
else:
await open_account(user)
users = await get_bank_data()
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = users[str(user.id)]["bank"]
em = discord.Embed(title=f'{user} Balance',color = discord.Color.blurple())
em.add_field(name="Wallet Balance", value=f'Φ{wallet_amt}')
em.add_field(name='Bank Balance',value=f'Φ{bank_amt}')
await ctx.send(embed= em)```
bruh.
It's also so messy file structure that it's hard to read in editor
now check
I have so many features that I would have to implement but it takes so long
So
show full error
I don't have a lot of time ;-;
wait
what are you suggesting then?
I'm trying to stay doing a feature but I start doing another one and I end up with about 4 unworking commands most of time
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/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: TypeError: 'Member' object is not subscriptable
full error
Hey @graceful mulch!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
β’ If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
β’ If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
!paste lol
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.
Ignoring exception in command balance:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 811, in balance
await open_account(user)
File "main.py", line 1372, in open_account
user[str(user.id)]['career'] = 'None'
TypeError: 'Member' object is not subscriptable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/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: TypeError: 'Member' object is not subscriptable
Ignoring exception in on_message
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 1649, in on_message
await level_up(users, message.author,message.channel, message.guild)
File "main.py", line 1721, in level_up
await user.send('{} has leveled up to Level {} in {}'.format(user.mention, lvl_end,server))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/dislash/application_commands/_modifications/old.py", line 160, in send_with_components
data = await send_message(state.http, channel.id, content, tts=tts, embed=embed,
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/http.py", line 248, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50007): Cannot send messages to this user
Their DMs are closed
hmm
"cannot send messages to this user" and it raised forbidden
what about the balance command thing
I will see
i dont think thats the main error
to it
Me neither but that is a part of it smh
but why cant I do the balance part
You are getting a member object from somewhere?
no
ah
this isnt the right code
how to set slowmode with the bot (for custom slowmodes like 3s, 6s)
File "main.py", line 811, in balance
await open_account(user)
File "main.py", line 1372, in open_account
user[str(user.id)]['career'] = 'None'
TypeError: 'Member' object is not subscriptable
``` show line 1372
It was working earlier
!d discord.TextChannel.edit read this
await edit(*, reason=None, **options)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the channel.
You must have the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to use this.
Changed in version 1.3: The `overwrites` keyword-only parameter was added.
Changed in version 1.4: The `type` keyword-only parameter was added.
Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
Here is it sir
show me an example
replace user with users
wait
i understand from those
why
because user is the user object
ur json whatever is called users
Example of?
then do it?
why do you need an example if you understand already
Here is what the json looks like
read the doc first
You mean you want premade code?
then come here back and tell me what dont you understand π
ok ig
I think i got an error solved
yes
yeah
oh yeah and ctx.channel.edit(...) also works right?
It is working
i literally told you to do that π
Love it
ofc
Thank you
pog
π
import discord
from discord.ext import commands
class Slowmode(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print("Slowmode cog loaded successfully")
@commands.command(aliases=["slow"], description="Changes the slowmode of channel")
@commands.has_permissions(manage_channels=True)
async def slowmode(self, ctx, seconds: int):
if seconds <= 21600 and seconds > 0:
embed = discord.Embed(Title=f"Slowmode ", color=0xFF0000)
embed.add_field(
name=f"Slowmode Changed !",
value=f"Slowmode is now set to {seconds} seconds",
)
embed.set_image(
url="https://media1.tenor.com/images/27b559e217424b733741a34f4a5c24c6/tenor.gif"
)
embed.set_footer(
text=f"Requested By: {ctx.author.name}",
icon_url=f"{ctx.author.avatar_url}",
)
await ctx.channel.edit(slowmode_delay=seconds)
await ctx.send(embed=embed)
else:
await ctx.send("Slowmode cannot be more than 21600 seconds or 0 and less")
@commands.command(aliases=["rslow"], description="Changes slowmode back to 0")
@commands.has_permissions(manage_channels=True)
async def resetslow(self, ctx):
embed = discord.Embed(Title=f"Slowmode ", color=0xFF0000)
embed.add_field(name=f"Slowmode Changed !", value=f"Slowmode is now set to 0")
embed.set_footer(
text=f"Requested By: {ctx.author.name}", icon_url=f"{ctx.author.avatar_url}"
)
await ctx.channel.edit(slowmode_delay=0)
await ctx.send(embed=embed)
def setup(client):
client.add_cog(Slowmode(client))
You can use this cog
@shadow wraith
bruh
- dont spoonfeed
- you dont need a whole cog for changing slowmode
<@&267628507062992896> pls remove the slowmode
br
oh
uh oh
ggs for tagging admin
i get it so ctx.channel.edit(slowmode_delay=int)
I. Okay I gave an example
2. A cog makes the code systematic
got it
Hi, the slowmode exists to keep the channel under control. If you'd like to further discuss this, feel free to ask in #community-meta
- i know
- π
:wow:
ye
oh that was easy to understand
@discord.ext.commands.is_nsfw()```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that checks if the channel is a NSFW channel.
This check raises a special exception, [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") that is derived from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Changed in version 1.1: Raise [`NSFWChannelRequired`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NSFWChannelRequired "discord.ext.commands.NSFWChannelRequired") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure"). DM channels will also now pass this check.
@slate swan ^^ haven't seen you here in a long time by the way
ig
v epic
I just realized I have made 2 mute commands, 1 that just mutes and second that mutes as well, but has a timer (tempmute)
as well the tempmute does not even work, because it never unmutes for some reason ;-;
sad
I remember the good time when it worked... (I still have not even touch the code but it just broke)
relatable
I can't even push my current changes to guthub;-;
Now I found out why.. Conflicting histories, requires merging 
@bot.event
async def on_raw_reaction_add(payload:disnake.RawReactionActionEvent):
member = disnake.utils.get(bot.get_all_members(), id=payload.user_id)
if payload.message_id == 916440449122701382:
if payload.emoji == "π":
print("hi")
await member.edit(roles=[disnake.Object(915935303628361780)])
elif payload.emoji.name == ":youtube:916431078909181962":
await member.edit(roles=[disnake.Object(915935303653531658)])
elif payload.emoji.name == ":youtubeping:916434557115457586":
await member.edit(roles=[disnake.Object(915935303607406625)])
elif payload.emoji == "π":
await member.edit(roles=[disnake.Object(915935303317991433)])
elif payload.emoji == "π―":
await member.edit(roles=[disnake.Object(915935303607406623)])```
does someone know why this isnt working?
What's the error
none
it gets called but but nothing else
so if i do before the member define print("hi")
Is it printing hu?
ill get sth
Hi*
thats from my testing
Okay
So it isn't printed?
no
Ah
it only prints of i put it before the message or after the message check
Try printing payload.emoji
thanks for you help
that gives me the emoji
The same one?
yes
Hmm
and it goes to the checks now
Try printing the message id then
lol
2021-12-08T11:03:19.453777+00:00 app[worker.1]: π
2021-12-08T11:03:20.116824+00:00 app[worker.1]: :youtubeping:
2021-12-08T11:03:20.116836+00:00 app[worker.1]: youtubeping
2021-12-08T11:03:20.855127+00:00 app[worker.1]: :youtube:
2021-12-08T11:03:20.855146+00:00 app[worker.1]: youtube
2021-12-08T11:03:21.404070+00:00 app[worker.1]: π―
2021-12-08T11:03:21.404084+00:00 app[worker.1]: π―
2021-12-08T11:03:24.877535+00:00 app[worker.1]: π
2021-12-08T11:03:24.877543+00:00 app[worker.1]: π```
async def on_raw_reaction_add(payload:disnake.RawReactionActionEvent):
member = disnake.utils.get(bot.get_all_members(), id=payload.user_id)
print(payload.emoji)
if payload.message_id == 916440449122701382:
print(payload.emoji.name)
if payload.emoji == "π":
await member.edit(roles=[disnake.Object(915935303628361780)])
elif payload.emoji.name == ":youtube:916431078909181962":
await member.edit(roles=[disnake.Object(915935303653531658)])
elif payload.emoji.name == ":youtubeping:916434557115457586":
await member.edit(roles=[disnake.Object(915935303607406625)])
elif payload.emoji == "π":
await member.edit(roles=[disnake.Object(915935303317991433)])
elif payload.emoji == "π―":
await member.edit(roles=[disnake.Object(915935303607406623)])```
@maiden fable so the message check works
but where does it fail?
Haha u see now?
The emoji is a custom one, seems like
yes
U can compare emoji.id or emoji.name
or just emoji
that gives it with <>
U can't compare a custom emoji
Ah the full name?
Not recommended
If the person changes the emoji name, your code breaks. But the emoji id never changes
its on my privat server
so it uses it over nitro perms
Okay
why sql database isnt getting updated in a gethub repo after a discord command is used i am using heroku to host
it prints e.g. Racer_JJJ#9686
the reason why is you need to rebuild the project after making changes, while the database cant rebuild by themself. Anyway, you can use a stored database eg. Postgres, Mongo, etc.
sooo there is no option except postgres or mongo?
there are some people saying to push the repo and i tried and keep getting errors i installed git and even added the path
Bots have to pass the nsfw filter too?
you will have to push the latest version (from your local machine) to github for it to be updated
git push?
.
used and got these 2 errors
error: failed to push some refs to 'origin'
error: src refspec main does not match any
yeah, git push origin main or origin master if the branch is master
did you commit?
git commit? yes
run it again
okay dis is comming now
now i am stuck
cannot do anything
guys anyway i could get free vps without cc
no
Yes but people want you to believe there's none ;)
sad really need one but oo yeah ik i
can u tell in dm
it could help me in more ways
But it comes with a huge cost so I wont
I may get warned/muted/ratio'd here but I will sacrifice myself, use heroku.
@Blank.event
async def on_message_edit(before, after):
await Blank.process_command(after)```Will this work??
breh how much resource it provides? also is it safe?
when user edit message?
It's safe, resources idk, but I won't really recommend using it unless you are mhm.
ok lol
Why even do that
just so if user edit and command work like in poketwo
!e```
class a:
a=1
class b:
print(a)```
empty-json
except
environments
enumerate
exit()
for-else
.
Lol
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
hey so i did dis
so now the database will get updated?
π₯΄ what you doing
call b
why b
b()
empty-json
except
environments
enumerate
exit()
for-else
whit
Bro moment
!e```
class a:
a=1
class b:
print(a)
b()```

!e
class a:
a=1
class b:
print(a)
b()
@supple thorn :white_check_mark: Your eval job has completed with return code 0.
<class '__main__.a'>


guys anyone know any rest api which can save image in their server (from link) and return the new link??
What's the error?
seems a bit like #databases error
so when i run the program the bot comes online and all
show full error
At the bottom of the traceback what type of exception is it?
there is an attribute error and a runtime error
how does it look like a database error?
im kinda a noob to python so sorry if i seem dumb
It looks to have been raised on a call to mongo
ye
just show the full error
I already answered this yesterday I think? You've called find.one not find_one
i changed that yest
LOL
must be another time i called the variable
not varible sry
its still there
you get what i mean
show line 51
k i changed it
try it again ig
ye
Hi Kayle
why do they
I'm good. How are you?
Well
full error
yes, but show the full error
πΏ
ah ok
i am sending it calm
They're gonna post it, they're just covering their name
im a he/him so you can call me that
but yeah sending the full error
Will try π I might forget 'cause I'm so used to calling everyone they/them to be safe
calm down π π
bruh its another error when im calling on pymongo
wrong url name
nah the bot goes online but when i post a message i get a whole bunch of errors
ill check my mongo thing
https://stackoverflow.com/questions/55695565/error-message-mongoerror-bad-auth-authentication-failed-through-uri-string <== you have something wrong in your mongodb url
so i changed the url and im not getting an error with that anymore
so i printed a list of user roles and it looks like this:
[<Role id=776775547580579872 name='@everyone'>, <Role id=918105235463995403 name='2'>, <Role id=816361294257061938 name='1'>]
How do I get only the roles IDs?
yo i need help when i join my server i dont get a private dm form the bot why is that?
or it is not giving roles
it cant encode that objet
iterate through the object
but i haven't added a set anywhere?
hm
i checked my code multiple times
set is a type
ik
are there any more errors that might help
hmm
i keep getting the same error
@bot.command(name='ping')
@commands.cooldown(1, 1, commands.BucketType.user)
i have many command like this
how do i show different cooldown?
omfg i think i found the error, i made a variable called levelamt but where i needed to use it i called levelnum
What do you mean?
Whats the error
[role.id for role in member.roles]
^
gj ig
i have many commands
everyone of them have different cooldown
i wanna make a command to show all of them
O
no error show up i just dont get the dm and the role
hmm
i have the buckettype thing
but idk how to show
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
await ctx.send(f'This command is on cooldown, you can use it in **{round(error.retry_after, 2)}** seconds')
else:
raise error
how can i get with the user or user id an instance of the user?
its like this
ye
Is this the error you get when you shutdown your bot?
the second part is when i shut it down, the first part is when i send a message on the server. its a leveling bot fyi
If so this is normal behavior. This has already been acknowledged in discord.py. Especially normal for windows users.
As far as the shutdown part
no but there is a huge error which comes when i send a message, and on top of that
- my xp is not being counted
- i know that because i checked the database where i am storing the xp
have you shown code yetβ¦
@mystic grotto can you show the entire traceback?
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
you mean the thing that happens in the console when i run it and send a message right
yes
ok wait

