#discord-bots
1 messages ยท Page 642 of 1
Oh, it's probably in the AUR and quite simple to install then
probably why i don't remember doing it haha
You can just do pacman, you don't need to download git from the AUR
Yeah, i probably did something like that during or after install
Are you on arch as well?
Yep
Arch buddies haha
installing git now
Great, git will come in handy a lot when you want to have version control for your bot
Or just installing things directly from git
@sick birchYeah it will help loads, thanks ๐
Okay so i installed it
but its saying 1.7 still
Attempting uninstall: discord.py
Found existing installation: discord.py 1.7.3
Uninstalling discord.py-1.7.3:
Successfully uninstalled discord.py-1.7.3
Running setup.py install for discord.py: started
Running setup.py install for discord.py: finished with status 'done'
Successfully installed discord.py-2.0.0a3575+g45d498c1
WARNING: You are using pip version 20.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\Jorda\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.
oh wait..
its done
It's saying it finished installing
Try running pip3 list and find discord.py
command not found
just try pip list then
Tried both, i used git to install
what was the command you used here
Terminal not working either, could it be because i use pycharm?
they're doing it in the git cli
command prompt
yay says v2
^
Now just how to get it working in pycharm? ๐
pycharm is just an ide, you have to select the right python interpreter in the settings to get it working
if you do pip list does it show anything installed?
C:\Users\Jorda>py -m pip list
Package Version
----------------- --------------------
aiohttp 3.7.4.post0
async-timeout 3.0.1
attrs 21.2.0
cffi 1.15.0
chardet 4.0.0
discord.py 2.0.0a3575+g45d498c1
idna 3.3
multidict 5.2.0
pip 20.2.3
pycparser 2.21
PyNaCl 1.4.0
setuptools 49.2.1
six 1.16.0
typing-extensions 4.0.0
yarl 1.7.2
WARNING: You are using pip version 20.2.3; however, version 21.3.1 is available.
You should consider upgrading via the 'C:\Users\Jorda\AppData\Local\Programs\Python\Python39\python.exe -m pip install --upgrade pip' command.```
Great, you have the beta discord installed
You can now go about and use all the new features
Just need to add it into pycharm interpreter ๐
just having a flick through the link above
reminder: the official discord.py will not implement slash commands, to use them you have to implement it yourself. (you can use third party outdated extensions but you wont get any help for them in the official support server. there are alot of them, most people now use forks instead of them so you may not get help anywhere but the extension's support server)
@sullen shoalDo i just set Venv Enviroment to the new discord.py directory?
idk about venvs, seems like you have to install it again
Yeah, I have an aversion to the forks as they're not headed by experienced developers, and implementing slash command support with discord.py yourself is frankly quite easy
No
I assume you haven't created your own venv using the specific commands, so no
it is easy, but it is also a waste of time considering there are alot of other people who has the code for it ready. if you really want to get your hands on it, you still could
also, the person who is managing the slash commands of disnake knows what they're doing, their implementation of slash command is beautiful
they powered doc strings for command description and param description
Well that's new
Most of the lib devs i've talked to were going to implement type hinting for param description
getting descriptions for params and the command is as easy and beautiful as this
Still cant figure out how to get discord working on pycharm ๐
i dont really suggest using pycharm unless you're experienced with all this, you should be using vscode or other editors like sublime, atom if you're not experienced with it
Try using a virtual environment
Conda is a popular one
is there a way to asyncio.sleep till a player completes a "task"? i am making an rpg bot so i need it for that
This code isnt working for me for some reason
@bot.command()
async def collatz(self,ctx,num:int):
if num > 1000000000:
await ctx.send('man thats too big of a number i dont want to die today')
return
tree=Tree()
tree.create_node('1',1)
def do(num):
if (num % 2 == 0):
return num // 2
else:
return num * 3 + 1
def run(num):
chain=[num]
while (num != 1):
num = do(num)
chain.insert(0,num)
for i in range(1,len(chain)):
tree.create_node(str(chain[i]),chain[i],parent=chain[i-1])
async with ctx.channel.typing():
run(num)
text = str(tree)
selected_font = "./fonts/ARIAL.TTF"
font_size = 50
img = Image.new('RGBA', (0,0), (255, 255, 255,0))
font = ImageFont.truetype(selected_font, font_size)
draw = ImageDraw.Draw(img)
text_size = draw.textsize(text, font)
img = img.resize(text_size)
draw = ImageDraw.Draw(img)
draw.text((0,0), text, (255,255,255), font,)
with BytesIO() as image_binary:
img.save(image_binary, 'PNG')
image_binary.seek(0)
await ctx.send(file=discord.File(fp=image_binary, filename='image.png'))
Context: I am trying to create a discord bot that does collatz conjecture
@final iron Ive installed Conda
Create a virtual environment and try to install the master version of dpy
pip install -U git+https://github.com/Rapptz/discord.py
Also try this
Take a screenshot of command prompt
You need to activate the virtual environment
conda activate <your venv name here>
then pip install
Also no need for git to be open. You do this all in windows cmd
Can you also type python in to command prompt and see if its actually installed properly?
You don't type the <>
I don't think they're using anaconda
Are they?
Yes
Oh i see
@polar ice I would suggest you use regular anaconda
Its miniconda
Why is it so difficult ๐ฎ
How long have you been using it?
oh okay, Ive literally just downloaded it
Do you have any specific reason to use anaconda/miniconda?
You suggested to use it? I just want to get discord.py v2 working through pycharm ๐ฆ
I personally think that regular old python would be much easier
you can create and activate a venv with 2 lines
Same with anaconda
im a noob ๐
I've never had any issue with it
I don't think they have any specific reason to use anaconda for the time being
@polar ice if you just import discord and try it like normal, is it 2.0?
sorry wrong ping
because i remember seeing your pip list has 2.0.0a for discord.py
@sick birch my pip list says 2.0 now in cmd window but in pycharm it still installs v1.7
Oh I think I know why. You're using the conda interpreter for pycharm but you're installing in to the main python scope through command prompt
No ive changed it back to python
that would explain it
I'm not really sure about PyCharm as i use vscode and it works flawlessly with this sort of thing
Try restarting your pycharm
it's showing some sort of error at the bottom
Honestly this is one of the reasons I like anaconda. If something goes wrong I can just nuke the environment
๐ if only everything was that easy
It was for me
I would honestly suggest never doing anything in the global python libraries
Try importing discord
Have you successfully installed it yet?
@final iron No ๐ฆ for the sake of me i cant figure it out ๐ฆ
Are you willing to reinstall your entire python installation?
That would fix up everything
sure
How would one uninstall python 
Search add or remove programs in windows search bar
doing it now ๐
Find python and uninstall it
going to re-install pycharm also
What python version are you using?
i am just starting python ๐
You can either add multiple prefixes or just one, they can be letters, numbers, symbols etc
@final ironokay ill install 3.9
Okay installed ๐
Want me to re-install discord.py with those 3 commands?
how to add multiple permissions here? I wanted to add admin perms with ban perms
!d all
all(iterable)```
Return `True` if all elements of the *iterable* are true (or if the iterable is empty). Equivalent to:
```py
def all(iterable):
for element in iterable:
if not element:
return False
return True
Okay python re-installed and discord.py v2 installed
Cant we use and or or here? @sullen shoal
@final iron Where too now, re-install pycharm?
you can if you really dont like simplicity
Why not use has_permissions check?
Hmm, I see
^ yea
thanks

i have an unreg command
async def unregister(ctx):
with open("usersforteams.json", "r") as f:
users = json.load(f)
if str(ctx.author.id) in users:
with open("usersforteams.json", "w"):
users.pop(str(ctx.author.id))
await ctx.send("You have been unregistered!")
else:
return await ctx.send("You have not registered!")``` this shud remove user if it is registered from the json but this, along with the user removes the `{}` too
how to solve?
you are writing users.pop inside of opening your json file
and not dumping them back
popping should be outside
and dump the results
dump the results? what results?
after popping
do you know how to use json files with python?
oh
yesterday a guy said to do it outside
so do it
i mean inside*
I pity them
do it outside
and dump the results while opening the file in write mode
otherwise it clears everything inside the json
if i dont open it with write mode
then how will it pop
it didnt work yesterday
with open("whatever.json") as f:
users = json.load(f)
if str(ctx.author.id) in users:
users.pop(str(ctx.author.id))
with open("whatever.json", "w") as f:
json.dump(users, f)
like this
it didnt pop yesterday lemme try again
,-,
how do i remove the brackets and quotations from the aliases part? https://mystb.in/TraceTechnologicalEdition.python
wdym
how would i remove the brackets and the quotations cuz i want it to look like rep, r instead
that can't be ,-,
they will work like normal commands
doesnt matter
", ".join()
thanks
I didnt understand the question ig ,-,
would this be right
value=f"{command.help}\n**Aliases:** {", ".join(command.aliases) if command.aliases else 'None'}")```
dont use double quote inside f string expression
but what if the bot has more than 50 commands
Aliases?
I doubt heโs making a field for every command.
uh okay
If so he can just use pagination.
thats what i was planning on doing
๐
25
they reduced it?
idk it was 25 since i started making bots
Can someone tell me WTF is ctx_menus_core.send
custom Context i think
When was that changed?
idk about it myself
The guildโs ID.
ctx.guild returns an instance of discord.Guild which does have an attribute named id for the guild id
๐
The guildโs ID.
oooo
@client.command()
async def show(ctx):
users = await get_user_info()
m = nextcord.Embed(title="The users who have registered for the tournament are as follows:-")
m.add_field(name="users",value=users )
await ctx.send(embed=m)
@client.command()
async def clearregs(ctx):
with open("usersforteams.json","r") as f:
users = json.load(f)
with open("usersforteams.json", "w") as f:
json.dump({},f)
await ctx.send("Cleared all registrations!")
@client.command(aliases=["reg"])
async def register(ctx, ign:str, uid:int):
with open("usersforteams.json", "r") as f:
users = json.load(f)
if str(ctx.author.id) in users:
return await ctx.send("You have already registered!")
elif str(ign) in users:
return await ctx.send("This in-game name already exists!")
elif str(uid) in users:
return await ctx.send("This in-game name already exists!")
else:
users[str(ctx.author.id)] = {}
users[str(ctx.author.id)]["IGN"] = ign
users[str(ctx.author.id)]["UID"] = uid
await ctx.send("You have been registered")
with open("usersforteams.json", "w") as f:
json.dump(users,f)
return True
async def get_user_info():
with open("usersforteams.json", "r") as f:
users = json.load(f)
return users
@client.command(aliases=["unregmem"])
@commands.has_permissions(administrator=True)
async def unregister_member(ctx, user:nextcord.User):
with open("usersforteams.json", "r") as f:
users = json.load(f)
if str(user.id) in users:
users.pop(str(user.id))
with open('usersforteams.json', 'w') as f:
users = json.dump(users, f)
await ctx.send("The user has been unregistered!")
else:
return await ctx.send("The user has not registered!")
@client.command(aliases=["unreg"])
async def unregister(ctx):
with open("usersforteams.json", "r") as f:
users = json.load(f)
if str(ctx.author.id) in users:
users.pop(str(ctx.author.id))
with open('usersforteams.json', 'w') as f:
users = json.dump(users, f)
await ctx.send("You have been unregistered!")
else:
return await ctx.send("You have not registered!")``` i want it to display like users = (user.id) and ign=(ign) uid=(uid) how to arrange it in that way/.?
- This is for the show command right?
- What does
usersgive
- yes
- the json data
whats uid gonna be
how do i change the defualt error message?
async def send_error_message(self, error):
channel = self.get_destination()
embed = discord.Embed(
title="Error",
description=error,
color=0xFF4040,
timestamp=datetime.utcnow()
)
await channel.send(embed=embed)
how do i solve this error??
did you import random
yes i did
you forgot the s
show ur error haandler
lol
its this
i dont have an error handler for command not found
am i supposed to make one
@prisma spoke
Error not found isn't an error
command*
Send error message isnt any function
1 ur error handler is wrong
It goes with client.event
im subclassing help command
Then why doing it in error handling?
cuz im followin this https://gist.github.com/InterStella0/b78488fb28cadf279dfd3164b9f0cf96
Bru
Ur not stating the error
After the self,error there shud be commands.CommandsNotFound
Like this u have to state
how can i make multiple channels?
I forgot. The namw
Create multiple channels in a function?
ig
how can I make a queue command
await ctx.create_text_channel("urname")
oh so ill just copy paste that over and over?
Yes and cha ge the namw
Hello guys
Create a list.or somethn to store em ig idk
Long time
Anyonem
?
Try this (if it works)
@client.command()
async def create_new(ctx, names=None):
if ctx.message.author is not ctx.guild.owner:
return await ctx.send("You're not Owner from this Server")
if str(names) is None:
names = "default"
await ctx.guild.create_text_channel(f"{names}")
await ctx.send(f"New Text Channel Created. Name: {names}")
how can i mass delete channels?
Just see you havent named anything else as random
U have done from random import random or assigned the random variable some value
How do I timestamp the bot to EST?
What exactly are you trying to do?
Help me please
Please ๐ฅบ
ask
Idk too
iterate
Regen
@upbeat otter
error?
I am asking u...
How to make it show
Like arrange in a column form....kinds thing if u get meh
I dont get it ,-, what're you tryna say
I wanna send the json contents
But in an arrange way
Are u making a nuke bot?
wdym by arranged way
Iterate though channels
hi eevee ๐
you can do purge()
try something like -
a = random.choice(responses)
await ctx.send(f'Question: {question}\nAnswer: {a}')
Like the ids shud be displayed like
Id- (idhere)
Uid-(uid here)
Ign-(ign here)
In that way
easy peasy, just open the files, load the required data in variables, and use \n to change lines
an example-
it still error
hmm
my brain almost die
you've imported random right?
yea
with open("ign.json") as f:
ign_data = json.load(f)
with open("uid.json") as f:
uid_data = json.load(f)
uid_for_user = uid_data[str(ctx -------)
ign_for_user = ign_data[str(ctx--------)
await ctx.send(f"IGN: {ign_for_user}\nUID: {uid_for_user}")
because all you did was just waste another line
for declaring a useless variable
hmmm
@tacit fog
i = random.randint(0, 4)
await ctx.send(f'Question: {question}\nAnswer: {responses[i]}')
wth
your code does seem right
but I don't really know what's wrong
bruh
I'm just making him try other options
No way it work!
lessgooo
np ๐
๐
Why not just do ```py
random.choice(responses)
he tried that
but it didn't work for him
The i is so extra
ah I was going to say the same thing lmao
Show me your imports
xd

thats brave
indeed
it fixed thx!
I didn't even do anything bruh
xd
but why didnt random.choice work ,-,
idek
You don't need to see his entire code though
nothing seems wrong with his imports
he imported random correctly
or else randint wouldn't have worked either
Did you see his import?
@tacit fog show your imports
his problem has been solved
and
oh...
you could've just imported random
like-
import random
^^
okok
The random module doesn't even have a random object
๐ฉ
!d random.random
random.random()```
Return the next random floating point number in the range [0.0, 1.0).
it exists
my bad then, but he used it wrongly
dont look xd
I'll pass
Me no like code on mobile no matter how big or small
huh?
why are you deleting your messages
oki
worked but i wanna see the details of every user in such a forrmat
not only for that user only
hmm, Interesting, iteration
for users in ign_data:
print(users["whatever"])
SuS lemme try
So I used datetime.now() but it's really specific, does anyone know what will give me just the date and not the time?
!d discord.utils.format_dt u can use this
discord.utils.format_dt(dt, /, style=None)```
A helper function to format a [`datetime.datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "(in Python v3.9)") for presentation within Discord.
This allows for a locale-independent way of presenting data using Discord specific Markdown...
!d time.time returns the unix time
time.time() โ float```
Return the time in seconds since the [epoch](https://docs.python.org/3/library/time.html#epoch) as a floating point number. The specific date of the epoch and the handling of [leap seconds](https://en.wikipedia.org/wiki/Leap_second) is platform dependent. On Windows and most Unix systems, the epoch is January 1, 1970, 00:00:00 (UTC) and leap seconds are not counted towards the time in seconds since the epoch. This is commonly referred to as [Unix time](https://en.wikipedia.org/wiki/Unix_time). To find out what the epoch is on a given platform, look at `gmtime(0)`.
Note that even though the time is always returned as a floating point number, not all systems provide time with a better precision than 1 second. While this function normally returns non-decreasing values, it can return a lower value than a previous call if the system clock has been set back between the two calls.
Hai Hunter
async def showall(ctx):
with open("usersforteams.json","r") as f:
users = json.load(f)
ids = users[str(ctx.author.id)] = {}
ign = users[str(ctx.author.id)]["IGN"]
uid = users[str(ctx.author.id)]["UID"]
for users in ids,ign,uid:
embed=nextcord.Embed(title=f"{ctx.author.mention} The details of all the users registered are as follows:-")
embed.add_field(name="User IDs", value=uid)
embed.add_field(name="In-Game Names", value=ign)
embed.add_field(name="ID's", value=ids)
await ctx.send(embed=embed)```?
you need to add if else in making the new IGN and UID's otherwise all your data will be lost
didnt get u
looks somewhat fine for me, besides a bit of wrapping
Iโm on a phone me no like ๐ญ
How do I make my discord bot online 24/7? ( i am ready to pay for it too )
in reality I can see perfectly well. Itโs just the fact that Iโm on a car and I get motion sick
๐คข
u use vsc?
or pycharm?
vscode
Raspberry pi
ye
find a hosting site
Or buy Linode
that's exactly what i wanted to know from here
Thatโs what @unkempt canyon is hosted from
There are a few others but I forgor ๐
forgor lol
with open("usersforteams.json","r") as f:
current_data = json.load(f)
if str(ctx.author.id) in users:
pass
else:
ids = current_data[str(ctx.author.id)] = {}
ign = current_data[str(ctx.author.id)]["IGN"]
uid = current_data[str(ctx.author.id)]["UID"]
with open("usersforteams.json", "w") as f:
json.dump(users, f)
with open("usersforteams.json") as f:
users = json.load(f)
for data in users:
embed = nextcord.Embed(title=f"{ctx.author.name} your details whatever")
embed.add_field(name="User IDs", value=users["UID"])
embed.add_field(name="In-Game Names", value=users["IGN"])
^
Or a VPS
just see the indentation
wait
@prisma spoke
thatโs what most bots are hosted on
hmm
what
Showโฆcommand?
then dont new blocks for users
๐ me no understand
just cut out that code
@upbeat otter ```py
@client.command()
async def showall(ctx):
with open("usersforteams.json","r") as f:
current_data = json.load(f)
ids = current_data[str(ctx.author.id)] = {}
ign = current_data[str(ctx.author.id)]["IGN"]
uid = current_data[str(ctx.author.id)]["UID"]
with open("usersforteams.json") as f:
users = json.load(f)
for data in users:
embed = nextcord.Embed(title=f"{ctx.author.name} your details whatever")
embed.add_field(name="User IDs", value=users["UID"])
embed.add_field(name="In-Game Names", value=users["IGN"])
await ctx.send(embed=embed)````
but wait
its all wrong
you need to make a new section for users who have not registered?
no?
it wud only show the users hwo have registered
not those who havent
means the users from the json file
cut out this then
ids = current_data[str(ctx.author.id)] = {}
ign = current_data[str(ctx.author.id)]["IGN"]
uid = current_data[str(ctx.author.id)]["UID"]
amazingโฆ10 minutes of looking on the phone and I havenโt thrown up yet or felt queasy. I think this is a new superpower of mineโฆ
That oddly resembles my json database code
async def showall(ctx):
with open("usersforteams.json","r") as f:
current_data = json.load(f)
with open("usersforteams.json") as f:
users = json.load(f)
for data in users:
embed = nextcord.Embed(title=f"{ctx.author.name} your details whatever")
embed.add_field(name="User IDs", value=users["UID"])
embed.add_field(name="In-Game Names", value=users["IGN"])
await ctx.send(embed=embed)
?
with open("usersforteams.json","r") as f:
current_data = json.load(f)
take this out too
and?
in embed?
users = json.load(f)
for data in users:
embed = nextcord.Embed(title="your details ")
embed.add_field(name="User IDs", value=users["UID"])
embed.add_field(name="In-Game Names", value=users["IGN"])
await ctx.send(embed=embed)```
but you wont be able to figure out, whose details ,-,
i want to show all the details
not for only a user
search up google of how to fetch names from people's ids
i dont want the names
i just want to display their ids
alll the users in the json
then add the {users["id"]} in title
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 36, in showall
embed.add_field(name="User IDs", value=users["UID"])
KeyError: 'UID'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 25, in on_command_error
raise error
File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995,
in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 'UID'```
there's nothing as UID key in your json file then
Hey @prisma spoke!
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:
embed.add_field(name="User IDs", value=data["UID"])
In your loop for the "showall" command, since you're looping over every user in there with your var being called "data" you should use that instead of users
try doing
value=data[users]["UID"]
my brain's ded, you guys help
๐
๐ฌ
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 36, in showall
embed.add_field(name="User IDs", value=data(str["UID"]))
TypeError: 'type' object is not subscriptable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 25, in on_command_error
raise error
File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995,
in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'type' object is not subscriptable```
async def showall(ctx):
with open("usersforteams.json") as f:
users = json.load(f)
for data in users:
embed = nextcord.Embed(title="your details ")
embed.add_field(name="User IDs", value=data(str["UID"]))
embed.add_field(name="In-Game Names", value=data(str["IGN"]))
await ctx.send(embed=embed)
await ctx.send(data)```
big bren
oh shoot
didnt work
?
data uid
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 36, in showall
embed.add_field(name="User IDs", value=data["UID"])
TypeError: string indices must be integers
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\nextcord\client.py", line 351, in _run_event
await coro(*args, **kwargs)
File "c:\Users\admin\Downloads\underdev.py", line 25, in on_command_error
raise error
File "C:\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 995,
in invoke
await ctx.command.invoke(ctx)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 895, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: string indices must be integers```
Instead of ```py
for data in users:
Do ```py
for key, value in users.items():
And instead of doing data['UID'] do value['UID']
users is basically a dict, since you're iterating over it, the "data" will actually be the key, which is in fact the user's discord id which you stored as a string
And that's why you get that error
๐
@commands.command()
async def get_permissions(self, ctx, role: discord.Role):
a = ctx.channel.permissions_for(role)
print(a)
``` I'm trying to get a permissions of specific role in a current channel but it's not working: https://paste.pythondiscord.com/digaqibula.sql
It should be correct
Still?
I have not had energy to change to disnake
What's your dpy version
1.7 ig or smth like that
Try updating to 2.0
how can you specify 2 roles the user should have or atleast have 1 because with @commands.has_role() you can only specify 1 role
this works fine
!d discord.ext.commands.has_any_role
@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.
Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.
This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit 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 [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
how tho? It's not available in pypi
!pypi discord.py
pip install git+https://github.com/Rapptz/discord.py
ohh
error
error what?
worked, let me try again
ill just guess how @commands.has_any_role works
@bot.command()
@commands.has_any_role('role1', 'role2')
async def ping(ctx):
await ctx.reply('pong lol')
Cool it will work
because i like learning quick
Same ngl
your here?
yea ๐
uuh now it broke a import for me
@prisma spoke this should fix the problem
for data in users.items():
uid = data[1]["UID"]
lmao
ImportError: cannot import name 'AsyncWebhookAdapter' from 'discord'
;-;
it worked with 1.7.3
;-; seems like a breaking change. Lemme get the list
lmao
that'll error
it doesnt
oh it won't
sigh ||installs disnake because I'm desperate||
but still, it's better if you do for key, value in dict.items() instead of just for data in ...
depends
Webhooks are changed significantly: WebhookAdapter is removed, and synchronous requests using requests is now inside SyncWebhook.
``` *intensified pain*
lmaoooo best of luck
Oops
what does that even mean
sadness
That means you need to rewrite webhooks (:
lmaooo
I would tell how I feel about that but I might get banned by that
async def send_webhook(self, embed: discord.Embed):
async with aiohttp.ClientSession() as session:
webhook = Webhook.from_url(self.webhook, adapter=AsyncWebhookAdapter(session))
return await webhook.send(embed=embed)
``` well this is all of the code I need to change tho
Ouch, I know the feeling. But there is a reason I am telling everyone to switch to disnake
So that they don't need to rewrite their code (:
sigh time to install disnake
is this the rite usage of @commands.has_any_role
disnake's also got slight changes
Yea
Like? Idts tbh
thats in discord.py 2.0 too
That's a dpy 2.0 change tho
disnake too
๐
Because disnake is based on 2.0???
wait... how can I install it as discord? or should I just install as disnake, because I have bunch of files like 11-14 with imports and files that use discord.Embed as example
I told u the way yesterday bro
it was wrong
Nahhh it's fine tbh
No?
pip install disnake ["discord "]
``` is invalid
CTRL Shift F
Search for discord
CTRL D
Change all the occurrences
so I should install it as disnake?
yes
Also the search is not needed I can directly do CTRL D
That's gonna do for only one file bruv
That search will select in all the files ๐คฆ
ctrl f does not?
You need to pass a list afaik.
It only does for one file
Nope
!d discord.ext.commands.has_any_role
@discord.ext.commands.has_any_role(*items)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member invoking the command has **any** of the roles specified. This means that if they have one out of the three roles specified, then this check will return True.
Similar to [`has_role()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_role "discord.ext.commands.has_role"), the names or IDs passed in must be exact.
This check raises one of two special exceptions, [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") if the user is missing all roles, or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") if it is used in a private message. Both inherit 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 [`MissingAnyRole`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.MissingAnyRole "discord.ext.commands.MissingAnyRole") or [`NoPrivateMessage`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.NoPrivateMessage "discord.ext.commands.NoPrivateMessage") instead of generic [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure")
i read the docs
lmfao i did guess the syntax kind of right
See, it's not a list
Yup u did :D
i had experience with had_role
I need to do it per file, I cant make it in bunch of files
I shouldn't think of code while I just woke up.
friendship ended with has_role, has_any_role is my new friend now
Ok then
Facts
i need help with tensorflow and keras
O
i also did
File "C:\Python39\lib\site-packages\discord\ext\tasks\__init__.py", line 101, in _loop
await self.coro(*args, **kwargs)
File "c:\Users\rrfda\OneDrive\Desktop\sublime\commands\snipe.py", line 58, in my_loop
await self.bot.cursor.execute("SELECT blacklisted FROM blacklist")
File "C:\Python39\lib\site-packages\aiosqlite\cursor.py", line 37, in execute
await self._execute(self._cursor.execute, sql, parameters)
File "C:\Python39\lib\site-packages\aiosqlite\cursor.py", line 31, in _execute
return await self._conn._execute(fn, *args, **kwargs)
File "C:\Python39\lib\site-packages\aiosqlite\core.py", line 129, in _execute
return await future
File "C:\Python39\lib\site-packages\aiosqlite\core.py", line 102, in run
result = function()
sqlite3.OperationalError: database is locked
``` what does that even mean
The db is opened in something else like SQLite DB Browser or something
oh fair
Command raised an exception: ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 3 supplied.``` and this ?
Good thing u deleted that message Mini. I already have had an argument yesterday with someone else on that and I ain't in a mood to argue again ๐๐
Idk tbh
๐
Ah I know
oh yeah go ahead
await self.bot.cursor.execute("INSERT INTO blacklist VALUES (?)",(stuff,))```
like that ?
Yea
Dude, I now feel like I have already had literally all the errors u all ask now ๐
theres a big one
?
did i wish , i already did and stuff didnt go well when i tried hosting it
u can host in on railway.app
Seems like the bot can't connect to the DB
0% downtime + its free
See the last line
oh wait fair
Connect Call Failed
Haha sure
uh mind walking me through how to setup that ?
ok.. how do I import AsyncWebhookAdapter from disnake?
Idk ngl
Sad..
If you installed disnake[discord] then just import it from Discord. I believe that's what I did and it worked.
I did not do that
well I will have to wait until I find a way, until that the bot is completely broken
I will have to do smth to this ```
Webhooks are changed significantly: WebhookAdapter is removed, and synchronous requests using requests is now inside SyncWebhook.
python main.py
Traceback (most recent call last):
File "main.py", line 33, in <module>
from cogs.music import music
File "/home/runner/Tirex-Safety/cogs/music.py", line 17, in <module>
client = pymongo.MongoClient(os.environ.get('dbconn'))
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/mongo_client.py", line 677, in init
res = uri_parser.parse_uri(
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/pymongo/uri_parser.py", line 455, in parse_uri
raise ConfigurationError(
pymongo.errors.ConfigurationError: The "dnspython" module must be installed to use mongodb+srv:// URIs. To fix this error install pymongo with the srv extra:
/opt/virtualenvs/python3/bin/python -m pip install "pymongo[srv]"
exit status 1
Whats the issue
python main.py
Traceback (most recent call last):
File "main.py", line 33, in <module>
from cogs.music import music
ImportError: cannot import name 'music' from 'cogs.music' (/home/runner/Tirex-Safety/cogs/music.py)
Now this error
music bot?
Yes
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeโs robots.txt file; (b) with YouTubeโs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
does webhooks really need a token, and what is the token?
from cogs.AntiChannel import AntiChannel
from cogs.AntiGuild import AntiGuild
from cogs.afk import AFK
from cogs.AntiSpam import onMessage
from cogs.AntiRemoval import AntiRemoval
from cogs.AntiRole import AntiRole
from cogs.AntiWebhook import AntiWebhook
from cogs.moderation import Moderation
from cogs.economy import economy
from cogs.server import server
from cogs.misc import misc
from cogs.snipe import snipe
from cogs.emoji import Emojis
from cogs.extra import extra
from cogs.music import music
python main.py
Traceback (most recent call last):
File "main.py", line 33, in <module>
from cogs.music import music
ImportError: cannot import name 'music' from 'cogs.music' (/home/runner/Tirex-Safety/cogs/music.py)
Code and error
we can't help with music bots afaik
it worked but py with open("usersforteams.json") as f: users = json.load(f) for key, value in users.items(): embed = nextcord.Embed(title="User Details") embed.add_field(name="User's In-GameIDs", value=value["UID"]) embed.add_field(name="In-Game Names", value=value["UID"]) embed.add_field(name="User Discord Id's", value=key) await ctx.send(embed=embed) its sending it as many times as there is a user means 5 users 5 msgs.. and if put ctx.send outside the for loop its sending one time with one one data
Really not a music bot
you just told it is
Its is an security bot
just here you told it's a music bot
Yeah its is security +music bot
But main features
Is security bot
we can't still help with music bots
that's because you're defining the embed inside the loop
move the embed = ... above the for loop
It's the webhook token.
Go to any text channel > intergrations > create new webhook, then copy the token of the one you've created.
whats music in cogs.music?
I alrd have it
eh
what sort of shutdown?
Check the web before here, most of the time someone else had the same issue/idea - - -> https://stackoverflow.com/questions/54561531/how-would-i-create-a-command-to-shutdown-my-discord-py-bot
Has saved me a good amount of time
ok one sec
So far I've seen stuff like bot.close(), ctx.bot.logout(), and using exit()
not sure which ones work though, haven't tried them myself
๐
They all work
O not documented
did you forget it?
!d discord.ext.commands.Bot.close
await close()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Closes the connection to Discord.
No, it's not documented
oh
!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.
disnake broke my bot ;-;
???
??
whats disnake lol
!pip disnake
maintained fork of dpy
nah you can go ahead lol I didnt really get it
it keeps throwing a lot of error on every startup, attemping to fix it
What's the error
Cz it is :D
riiight gotcha ๐
how come avatar_url is wrong?
avatar.url
oh ty
Breaking change in discord.py 2.0
just a random picture from Discord's gif library, not my dog
wanted something to go with a background colour since I got the 4.99 nitro and not 9.99
The userโs unique ID.
!d discord.Client.user
property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
So, client.user.id
"avatar" is not defined
๐ define it then
member.avatar.url lol
fk
๐
disnake sucks I hate my life
I'mma Kms
It worked before
text="Sample text", icon_url=member.avatar.url,
AttributeError: 'NoneType' object has no attribute 'url'
``` ;-; I gave it a member
@commands.command()
@restrict_to_user(534738044004335626)
async def test(self, ctx, member: disnake.Member):
content = await self.modlog.send_log_message(
self, colour=disnake.Color.red(), title=f"{member} | {member.id}",
text="Sample text", icon_url=member.avatar.url,
footer="Sample footer"
#thumbnail="Sample thumbnail"
)
That means the member has the default avatar
!d discord.Member.display_avatar
property display_avatar: discord.asset.Asset```
Returns the memberโs display avatar.
For regular members this is just their avatar, but if they have a guild specific avatar then that is returned instead.
New in version 2.0.
Why tho
Probably to make one of those lvl up or welcome images
image on the left, info on the right
Not talking about the other docs
?
read the error
nothings wrong
you had a profile picture before maybe?
hm
display avatar url IG
how to make a command that creates a file?
you dont, you gotta use another lib for that
MKDIR
u do !create json it will create a json file
!d os.mkdir
os.mkdir(path, mode=511, *, dir_fd=None)```
Create a directory named *path* with numeric mode *mode*.
If the directory already exists, [`FileExistsError`](https://docs.python.org/3/library/exceptions.html#FileExistsError "FileExistsError") is raised.
On some systems, *mode* is ignored. Where it is used, the current umask value is first masked out. If bits other than the last 9 (i.e. the last 3 digits of the octal representation of the *mode*) are set, their meaning is platform-dependent. On some platforms, they are ignored and you should call [`chmod()`](https://docs.python.org/3/library/os.html#os.chmod "os.chmod") explicitly to set them.
This function can also support [paths relative to directory descriptors](https://docs.python.org/3/library/os.html#dir-fd).
It is also possible to create temporary directories; see the [`tempfile`](https://docs.python.org/3/library/tempfile.html#module-tempfile "tempfile: Generate temporary files and directories.") moduleโs [`tempfile.mkdtemp()`](https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp "tempfile.mkdtemp") function.
Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `os.mkdir` with arguments `path`, `mode`, `dir_fd`...
which?
This?
Os
you can just with open() in a command, no?
user.display_avatar.url
He want to create one
i mean yes if the file doesnt exist it'll create one
i am asking my own question i am not helping u
Not open it
That should work ig
can u giv an example?
๐
!with
The with keyword triggers a context manager. Context managers automatically set up and take down data connections, or any other kind of object that implements the magic methods __enter__ and __exit__.
with open("test.txt", "r") as file:
do_things(file)
The above code automatically closes file when the with block exits, so you never have to manually do a file.close(). Most connection types, including file readers and database connections, support this.
For more information, read the official docs, watch Corey Schafer's context manager video, or see PEP 343.
bro I gave the simplest example
Hmm but sometimes it causes errors
search it up
os.mkdir(path, mode=511, *, dir_fd=None)```
Create a directory named *path* with numeric mode *mode*.
If the directory already exists, [`FileExistsError`](https://docs.python.org/3/library/exceptions.html#FileExistsError "FileExistsError") is raised.
On some systems, *mode* is ignored. Where it is used, the current umask value is first masked out. If bits other than the last 9 (i.e. the last 3 digits of the octal representation of the *mode*) are set, their meaning is platform-dependent. On some platforms, they are ignored and you should call [`chmod()`](https://docs.python.org/3/library/os.html#os.chmod "os.chmod") explicitly to set them.
This function can also support [paths relative to directory descriptors](https://docs.python.org/3/library/os.html#dir-fd).
It is also possible to create temporary directories; see the [`tempfile`](https://docs.python.org/3/library/tempfile.html#module-tempfile "tempfile: Generate temporary files and directories.") moduleโs [`tempfile.mkdtemp()`](https://docs.python.org/3/library/tempfile.html#tempfile.mkdtemp "tempfile.mkdtemp") function.
Raises an [auditing event](https://docs.python.org/3/library/sys.html#auditing) `os.mkdir` with arguments `path`, `mode`, `dir_fd`...
No?
Good then
I'll try that
disnake has completely broken my webhooks as well
why is this incorrect? ```py
async def send_webhook(self, embed: disnake.Embed):
async with aiohttp.ClientSession() as session:
webhook = disnake.Webhook.partial(
self.webhook_id,
self.webhook_token,
session=session
)
return await webhook.send(embed=embed)
if the from_url is removed how would it work?
from url still exists
y not just send it normally
it does?
webhook = ctx.channel.webhooks[0]
await webhook.send("yo")
!d discord.Webhook.from_url
classmethod from_url(url, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook") from a webhook URL.
๐ค
;-;
async def send_webhook(self, embed: disnake.Embed):
async with aiohttp.ClientSession() as session:
webhook = disnake.SyncWebhook.from_url(self.webhook, adapter=AsyncWebhookAdapter(session))
return await webhook.send(embed=embed)
``` how do I replace the `AsyncWebhookAdapter`?
!d discord.Webhook.partial
classmethod partial(id, token, *, session, bot_token=None)```
Creates a partial [`Webhook`](https://discordpy.readthedocs.io/en/master/api.html#discord.Webhook "discord.Webhook").
whats sync hook
AsyncWebhookAdapter
``` was from 1.7.3
o
discord*
seems like it does not exist anymore
hm
Just like u do in discord.py 2.0
Ok how do I do that
So like that or not like that?
Where should i ask for github help
#tools-and-devops maybe
I don't know how to use .gitignore
Wait...
I'm trying to hide my files
I think yea
A file....
Just add the file to gitignore
I put config.json in the gitignore and i can still see it
In where?
the github
Thank you! I will try it when I can
How?
When you do git add, there should be a remove command for untracked files if not, then I can't help.
git -rm --cached file.name could be the command
intensified pain of trying stuff
Lol
Command raised an exception: InvalidArgument: Invalid webhook URL given.
``` fk off
F
does your url look like https://discord.com/api/webhooks/......... something?
yes
What the sus
it is
I copy pasted the url 3 times by now
fk
yep url is correct, but it ain't working
async def send_webhook(self, embed: disnake.Embed):
async with aiohttp.ClientSession() as session:
webhook = disnake.SyncWebhook.from_url(url=self.webhook, session=session)
return await webhook.send(embed=embed)
``` why it ain't work ;-;
Why are you trying to await a sync method
it's a sync?
Command raised an exception: TypeError: expected requests.Session not <class 'aiohttp.client.ClientSession'>
``` what session should I pass instead?
thank you!
in aguoms
nice
@bot.command(aliases=["reg"])
async def register(ctx):
def check(msg):
return msg.channel == ctx.channel and msg.author == ctx.author
view1 = Confirm()
embed=nextcord.Embed(description="Do you wish to continue?", color=nextcord.Color.blurple())
await ctx.send(embed=embed,view=view1)
await view1.wait()
if view1.value is None:
embed=nextcord.Embed(description=f"โ Timed Out!")
await ctx.send(embed=embed)
elif view1.value:
try:
with open("usersforteams.json", "r") as f:
users = json.load(f)
channel = await ctx.author.create_dm()
await channel.send("Please enter your in-game name!")
msg = await bot.wait_for('message', check=check, timeout=60)
ign = msg.content
await channel.send("Please enter your in-game user ID!")
msg = await bot.wait_for('message', check=check, timeout=60)
uid = msg.content
if str(ctx.author.id) in users:
return await ctx.send("โ You have already registered!")
elif str(ign) in users:
return await ctx.send("โ This in-game name already exists!")
elif str(uid) in users:
return await ctx.send("โ This in-game user-id already exists!")
else:
users[str(ctx.author.id)] = {}
users[str(ctx.author.id)]["IGN"] = ign
users[str(ctx.author.id)]["UID"] = uid
embed=nextcord.Embed(description=f"โ
You have been registered!")
await ctx.send(embed=embed)
with open("usersforteams.json", "w") as f:
json.dump(users,f)
return True
except asyncio.TimeoutError:
embed=nextcord.Embed(title="โ Timeout to respond!",description=f"{ctx.author.mention} this process has timed out! Please re-do the process again if you wish to register!")
await channel.send(embed=embed)
return
else:
embed=nextcord.Embed(description=f"โ
Process Cancelled! ")
await ctx.send(embed=embed)
return``` this wud just send the msg till please enter your in game name then it wud just show timeout error
how to solve this?
Is this good permissions for muted role? https://discordapi.com/permissions.html#67437633
A small calculator that generates Discord OAuth invite links
it totally depends on u
in general, what do you think?
Did u hear about the Time Out button?
it depends on you
of what?
Discord has added the mute button
someone help me?
Click on it and the person gets muted
wtf
The function gonna be in disnake as soon as discord opens the endpoint to bots
I don't see that
?
Discord Beta hehe
That means u taking more than 60 seconds to answer
nope
it wud just send one msg
but give me your opinion of this permissions
then wudnt send another msg
They good
and also wudnt giv error or dump it
ty
Till which message?
Please enter your ingame name! one
how do I convert permission integer to permissions object or smth
discord.Permissions(int)
Well, TimeoutError tells that u taking longer than usual to answer. Providing the traceback would be appreciated
!d discord.Role.edit
await edit(*, name=..., permissions=..., colour=..., color=..., hoist=..., mentionable=..., position=..., reason=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the role.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this.
All fields are optional.
Changed in version 1.4: Can now pass `int` to `colour` keyword-only parameter.
Changed in version 2.0: Edits are no longer in-place, the newly edited role is returned instead.
no traceback..
U using on_command_error?
thx ๐
yes
even raise error
it wud wait until the time
# get data from exception
etype = type(exc)
trace = exc.__traceback__
# 'traceback' is the stdlib module, `import traceback`.
lines = traceback.format_exception(etype, exc, trace)
# format_exception returns a list with line breaks embedded in the lines, so let's just stitch the elements together
traceback_text = ''.join(lines)
# now we can send it to the user
# it would probably be best to wrap this in a codeblock via e.g. a Paginator
await ctx.send(traceback_text)โ
as soon as the msg wud come i gave the msg.content
Add this in your on_command_error
LMAO
Hi there Eevee. Long time :D
Hahaha thanks for the heart
Haha cute. Anyways OT too :D
yes?

OT?
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.11.1422169775\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\Python310\lib\runpy.py", line 268, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "C:\Python310\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "c:\Users\admin\Downloads\underdev.py", line 79
await ctx.send(traceback_text)โ
^
SyntaxError: invalid non-printable character U+200A```
help me plz
encoding error
Off Topic ;-;
how to solve
sorry ,-,
U copied the text, just use backspace on that line
wao
u mean await ctx.send(traceback_text) ?i shud remove this?
Not all but when u use a backspace once, it will delete an invisible character
what're you trying to do tho
Bro, it's traceback not Traceback
He's getting a TimeOut error with bot.wait_for
use asyncio?
did see the code
He shouldn't have it
above.
import traceback
hmm, Good Luck
Yea, he's asking for help from the most laziest coder ever
looool
await ctx.send(traceback_text)โ
^
SyntaxError: invalid non-printable character U+200A```
Bruhhhh didn't I tell u that before?
same thing


