im trying to add the promote command but when i use it, it keeps giving me this error:
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 41, in on_message
await promote(trainees)
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py”, line 374, in call
return await self.callback(*args, **kwargs)
File “main.py”, line 17, in promote
group = await roblox.getgroup(10201866)
AttributeError: ‘Client’ object has no attribute ‘getgroup’
im trying to let me be able to promote multiple people at once and i am confused this is what i have so far do you have any ideas on it?
@bot.command()
@has_permissions(manage_messages=True)
async def promote(ctx, *username):
group = await roblox.get_group(10201866)
for member in username:
member = await group.get_member_by_username(username)
await member.promote()
await ctx.send("Successfully promoted.")
also the command only runs when i remove my @bot.event but i need that for it to work in the way i want
this is the error i get when it use it:
Ignoring exception in command promote:
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 19, in promote
member = await group.get_member_by_username(username)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/ro_py/groups.py", line 276, in get_member_by_username
user = await self.cso.client.get_user_by_username(name)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/ro_py/client.py", line 131, in get_user_by_username
raise UserDoesNotExistError
ro_py.utilities.errors.UserDoesNotExistError
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: UserDoesNotExistError:
EDIT: i got the promote command working but i have no idea how to fixed it so it works with @bot.event on
This * will store all arguments to the command in a list called username. This will promote every user that you pass to the command, which means running a command like !promote apple banana would promote both the users apple and banana.
You then grab the group and then loop through the username list and then get each member, then promote that member. This code is correct, so I believe you actually have given it an invalid username.
I suggest printing out the username list to make sure you haven’t given it an invalid argument.
thanks but i now have a problem. im trying to make a “rank lock” meaning it wont promote someone if they are a certain rank. ex: if rank number = 4 then do not promote
if you could help that would be nice
i tried printing the rank and it gave me a big string then i tried checking that with an if statement by doing if member.role == [long string here]:
(got that by printing member.role of the person while they were on the rank)
i tried doing if member.role == 4 (number of the rank) still didnt work
got any ideas
if i could get this working i would be using this for as long as my group stands
This is really cool but I have one question how would I go about making an authentication system similar to RoVer. I am trying to make a general purpose discord to roblox bot
I found a tiny error within your coding. Specifically in the “promote/demote/setrank commands” category, where you await ctx.send('Promoted user.') in the demote command. Demoted user*
I can agree with you, but there are also many brilliant open-source systems that can be definitely relied on - such as qbot, a free & open-sourced ranking bot. I mainly recommend it for people who aren’t experienced with programming, as it is updated by other developers with the ability for high-quality plugins to be added. Along with that, it’s pretty basic to set up & the Discord server is always open to help others.
This seems like a brilliant API wrapper, but I don’t code in Python. Certainly recommend it for other users.
I don’t like this take. Claiming that because the maintainer of an open-source project is no longer working on it means that every single project that uses it is no longer valid or useful is just obnoxious and a total misunderstanding of the entire point of open-source software.
Yes, the main discord.py repository is archived. But is the entire library dead, never to be worked on again? No. Is the library suddenly broken and unusable? No. You’re overstating what’s actually going on here.
How to get this member object? There’s a default user object with what you cannot get role. Like even if you do {group}.get_member() it doesn’t give you this special object that has role, it gives you only a user object