code:
import discord
from discord.ext import commands
from ro_py import Client
ROBLOSECURITY = 'no bro'
GROUP_ID = 34217794
GROUP_URL = f'https://www.roblox.com/groups/{GROUP_ID}'
roblox = Client(ROBLOSECURITY)
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='!', intents=intents)
@bot.event
async def on_ready():
print(f'Logged in as {bot.user.name} ({bot.user.id})')
print(f'Connected to Discord!')
@bot.command()
async def setrank(ctx, username, rank_id):
try:
user = await roblox.get_user_by_username(username)
if not user:
await ctx.send(f'User named {username} not found.')
return
group = await roblox.get_group(GROUP_ID)
rank = await group.get_rank_by_id(int(rank_id))
if not rank:
await ctx.send(f'Rank with ID {rank_id} not found in group.')
return
await user.promote(group, rank)
await ctx.send(f'Rank successfully established {rank.name} user {username}.')
except Exception as e:
await ctx.send(f'An error has occurred: {e}')
bot.run("nah")
error: ModuleNotFoundError: No module named ‘ro_py.exceptions’
i tried:
from roblox.utilities.exceptions import UserNotFound
try:
user = await client.get_user_by_username(“InvalidUsername!!!”)
except UserNotFound:
print(“Invalid username!”)
((please don’t close the post just yet, you never know if there will be more questions))