-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client Bot Username #106
Comments
Use Client.get_self to get a PartialUser then access the async def get_bot_username():
bot_username = (await client.get_self()).name
return bot_username Also, consider updating to v2 ( async def get_bot_username():
bot_username = (await client.get_authenticated_user()).name
return bot_username |
Thanks for your help! In v2, is there still a way to promote/demote/set-rank users in groups? |
Use either MemberRelationShip.set_role (pick a role from BaseGroup.get_roles and pass it to the method) or MemberRelationShip.set_rank. I wouldn't recommend using a promote/demote method because of this:
but if you want to regardless you could copy the code here into (non-method) functions and adapt it to v2 |
Could this potentially work out? from Roblox import Client
from fastapi import FastAPI, Body
app = FastAPI()
@app.post("/promote")
async def promote(user_id: int, group_id: int):
client = Client()
client.promote_group_member(group_id, user_id)
return {"message": "User has been promoted."}
@app.post("/demote")
async def demote(user_id: int, group_id: int):
client = Client()
client.demote_group_member(group_id, user_id)
return {"message": "User has been demoted."}
@app.post("/set-rank")
async def set_rank(user_id: int, group_id: int, rank: int):
client = Client()
client.set_group_member_rank(group_id, user_id, rank)
return {"message": "User's rank has been set."} Edit: it seems that v1 doesn't function on getting the bots info, but v2 does. Replying to this response. |
Never mind, looking at it further, it seems that that won't work out unless I create a function with the name, "promote" and "demote". |
So I have this code, where it tries to find-out the bots username, it returns with
AttributeError: 'Client' object has no attribute 'user'
, is there a way to fix this?The text was updated successfully, but these errors were encountered: