#getting errors when running the / command
1 messages · Page 1 of 1 (latest)
Now its public (i am new at using github)
@south prawn would appreciate the error you are having too
when i use this command
/addrole rolename: @vip price: 10
gives this command
Traceback (most recent call last):
File "C:\Users\umtaa005\AppData\Roaming\Python\Python38\site-packages\lightbulb\app.py", line 1162, in invoke_application_command
await context.invoke()
File "C:\Users\umtaa005\AppData\Roaming\Python\Python38\site-packages\lightbulb\context\base.py", line 334, in invoke
await self.command.invoke(self)
File "C:\Users\umtaa005\AppData\Roaming\Python\Python38\site-packages\lightbulb\commands\base.py", line 797, in invoke
await self(context, **kwargs)
File "C:\Users\umtaa005\AppData\Roaming\Python\Python38\site-packages\lightbulb\commands\base.py", line 712, in call
return await self.callback(context, **kwargs)
File "c:/Users/umtaa005/Desktop/discordbot/main_copy_test.py", line 140, in addrole
if str(rolename.id) not in data["servers"][server_id]["roles"]:
TypeError: 'set' object is not subscriptable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\umtaa005\AppData\Roaming\Python\Python38\site-packages\lightbulb\app.py", line 1203, in handle_interaction_create_for_application_commands
await self.invoke_application_command(context)
File "C:\Users\umtaa005\AppData\Roaming\Python\Python38\site-packages\lightbulb\app.py", line 1180, in invoke_application_command
raise new_exc
lightbulb.errors.CommandInvocationError: An error occurred during command 'addrole' invocation
what is data in that context?
data.json
{
"servers":{
"0000000":{
"roles":{
"1263267674":17,
"6866587377":23
},
"moderators":[
"8267843543",
"8378748758",
"3645876438"
]
}
}
}
- Dont use json as a database
- Dont use
open, it is blocking -
data["servers"] = {server_id:{"roles","moderators"}}
This line is wrong if you later store the role ids. Here you are creating a set `{"roles","moderators"}`, where you probably want a dict
what about server_id?
"0000000" is server id
@subtle perch Make this github private
huh?
wdym @hybrid canopy ?
@south prawn we will invalidate your token
please dont host it on github
^^ Your token should be treated like a username + password - kept private
How can i make it private
Don't commit it to your git repo
What is gitignore
do you push to github through a command?
i am using github desktop
create a file called .gitignore in your repo directory
add a line containing secret.secret to it
add the .gitignore file to your repository and commit it
remove the secret.secret file from your repository and commit it
push
i tried to fix something and i thing i broke my code can someone help me please ||my brain is burning||
there is no error but bot is not responding
not responding to what
to slashcommands
@south prawn once again you're putting your bot's token on your github repository, once again i need to strongly urge to you that you should not be doing this
how can i dont make that
i gave you instructions a few days ago
i used .gitignore now
you still need to remove the secret file from your folder, and then commit the removal
is it ok now