async def showrank(self, ctx, user): """ Displays the users rank in the set group. """ with open('data/groupdata.json') as f: data = json.load(f) cookie = data[f"{ctx.guild.id}"]["Cookie"] id = data[f"{ctx.guild.id}"]["ID"] client = robloxapi.Client(cookie) RobloxUser_object = await client.get_user(name=f"{user}") try: x = await RobloxUser_object.get_role_in_group(id) except robloxapi.utils.errors.NotFound: embed = discord.Embed( title="THIS USER IS NOT IN THE GROUP, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `demote` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return else: embed = discord.Embed(title="USER DATA", color=0x36393e) embed.add_field( name="<:logo:700042045447864520>", value=f"User-rank: `{x.name}`\nUser-rankID: `{x.id}`", inline=False) embed.set_footer(text="All assets owned by RoSystems") msg = await ctx.send(embed=embed)
async def on_ready(): session = ClientSession() try: global CONFIG_FILE config = CONFIG_FILE.open() roblox = robloxapi.Client(json.load(config)["ROBLOXCOOKIE"], session=session) except OSError as e: print("Could not read config file.", e) await session.close() sys.exit(1) profile = await roblox.get_self() user_id = profile.id try: bundles = await roblox.get_owned_bundle_ids(user_id) except robloxapi.utils.errors.BadStatus as e: print(e) bundles = [] inventory_url = f"https://api.roblox.com/ownership/hasasset?userId={user_id}&assetId=" page = await get_asset_page(session=session) next_page_cursor = page["nextPageCursor"] coroutines = list() while True: coroutines.append( process_page(page, bundles, inventory_url, next_page_cursor, roblox, session)) page = await get_asset_page(session=session, next_page_cursor=next_page_cursor) if page["nextPageCursor"] is None: break next_page_cursor = page["nextPageCursor"] res = await asyncio.gather(*coroutines) print(res) print(f"Completed! Purchased {sum(res)} assets.") await session.close()
async def configured(ctx): with open('data/groupdata.json', 'r') as f: data = json.load(f) if str(ctx.guild.id) in data: try: cookie = data[f"{ctx.guild.id}"]["Cookie"] id = data[f"{ctx.guild.id}"]["ID"] client = robloxapi.Client(cookie) group = await client.get_group(id) await client.get_self() except: await ctx.send( '<:rcross:700041862206980146> Cookie was not valid, use `setup` and pass a valid token.' ) raise discord.ext.commands.CommandNotFound else: return True elif str(ctx.guild.id) not in data: await ctx.send( '<:rcross:700041862206980146> You must configure your server with RoSystems before using this command, use `setup`.' ) raise discord.ext.commands.CommandNotFound
def main(log_name, max_lines, cookie: str): """The main func""" global logger, logged, loop, bot logger_config.main(log_name, max_lines) logger = logger_config.logger if cookie: try: bot = robloxapi.Client(cookie) logged = True except: logged = False bot.logger.error( f"invalid cookie: '{cookie}'\n.Try changing your cookie and restarting the server." ) else: bot.logger.error( f"invalid cookie: '{cookie}'\n.Try changing your cookie and restarting the server." ) if logged: loop = asyncio.get_event_loop() loop.run_until_complete(get_info()) logger.info(f"Logged in as: {bot_name}") logger_config.log_list = []
async def setup(self, ctx): """ Configures your bot with RoSystems. """ def check(m): return m.author == ctx.author def reactionCheck(reaction, user): if user == ctx.author and reaction.emoji == tick: return True if user == ctx.author and reaction.emoji == cross: return True embed=discord.Embed(title="PROMPT", color=0x36393e) embed.add_field(name="<:logo:700042045447864520>", value="Please ensure the bot has the correct permissions otherwise the setup will not work.", inline=False) await ctx.send(embed=embed) embed=discord.Embed(title="PROMPT", color=0x36393e) embed.add_field(name="<:logo:700042045447864520>", value="""What is the ROBLOX account token?\n\nsay **cancel** to cancel.\n\n *How to get the account token:* **NOTE: CREATE A SEPERATE ACCOUNT FOR THIS, DO NOT USE YOUR PERSONAL ACCOUNT.** ```json Step 1; Log into the account. Step 2; Right click and press on the 'Inspect' option (or Ctrl+Shift+I). Step 3; ([If applicable] Press the '>>' arrows) and click 'Application'. Step 4; Look through the 'Name' Colum and find the box called '.ROBLOSECURITY'. Step 5; Double click on the corresponding value then copy it to your clipboard. Step 6; Click on any part of the row ONCE. Step 7; Press either 'del' or 'backspace' on your keyboard until the row disappears. Step 8; Refresh the page. Do not login to this account anymore as it will reset the token.```""", inline=False) embed.set_footer(text="This prompt will automatically cancel in 200 seconds.") await ctx.send(embed=embed) try: token_cookie = await self.bot.wait_for('message', check=check, timeout=200) except: embed=discord.Embed(title="PROMPT TIMED OUT", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return if token_cookie.content.upper() == 'CANCEL': embed=discord.Embed(title="PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return else: try: client = robloxapi.Client(f'{token_cookie.content}') x=await client.get_self() await ctx.send(x.name, delete_after=0.1) lst=[] lst.append(f'{token_cookie.content}') except: embed=discord.Embed(title="AN INVALID TOKEN WAS GIVEN", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return embed=discord.Embed(title="PROMPT", color=0x36393e) embed.add_field(name="<:logo:700042045447864520>", value=f"Please confirm that this is the correct account.\n`Account-name`: {x.name}\n`Account-ID`: {x.id}\n\nsay **cancel** to cancel.", inline=False) embed.set_footer(text="This prompt will automatically cancel in 200 seconds.") msg = await ctx.send(embed=embed) await msg.add_reaction('<:tick:700041815327506532>') await msg.add_reaction('<:rcross:700041862206980146>') tick = self.bot.get_emoji(700041815327506532) cross = self.bot.get_emoji(700041862206980146) try: reaction, user = await self.bot.wait_for('reaction_add', timeout=200, check=reactionCheck) except: embed=discord.Embed(title="PROMPT TIMED OUT", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return if token_cookie.content.upper() == 'CANCEL': embed=discord.Embed(title="PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return else: if reaction.emoji == tick: await token_cookie.delete() pass elif reaction.emoji == cross: await token_cookie.delete() embed=discord.Embed(title="PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return embed=discord.Embed(title="PROMPT", color=0x36393e) embed.add_field(name="<:logo:700042045447864520>", value="What is the your ROBLOX group ID?\n\nsay **cancel** to cancel.", inline=False) embed.set_footer(text="This prompt will automatically cancel in 200 seconds.") await ctx.send(embed=embed) try: groupID = await self.bot.wait_for('message', check=check, timeout=200) except: embed=discord.Embed(title="PROMPT TIMED OUT", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return if groupID.content.upper() == 'CANCEL': embed=discord.Embed(title="PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return else: try: groupID_request = requests.get(url=f'https://groups.roblox.com/v1/groups/{int(groupID.content)}/') groupID_json = groupID_request.json() groupID_name = groupID_json["name"] groupID_id = groupID_json["id"] groupID_memberCount = groupID_json["memberCount"] groupID_owner = groupID_json["owner"]["username"] groupID_ownerID = groupID_json["owner"]["userId"] except KeyError: embed=discord.Embed(title="GROUP DOES NOT EXIST, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return except TypeError: embed=discord.Embed(title="THERE WAS AN ERROR RETREIVING DATA, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return except ValueError: embed=discord.Embed(title="GROUP ID SHOULD BE NUMBERS NOT STRINGS.", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return groupUsers_request = requests.get(url=f"https://groups.roblox.com/v1/users/{int(x.id)}/groups/roles") groupUsers_json = groupUsers_request.json() lsts = [] for elt in groupUsers_json['data']: if int(groupID.content) == elt['group']['id']: lsts.append(elt['group']['id']) if len(lsts) == 1: pass else: embed=discord.Embed(title="THIS ACCOUNT IS NOT IN THE GIVEN GROUP, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return embed=discord.Embed(title="PROMPT", color=0x36393e) embed.add_field(name="<:logo:700042045447864520>", value=f"Please confirm that this is the correct data.\n`Group-name`: {groupID_name}\n`Group-ID`: {groupID_id}\n`Group-MemberCount`: {groupID_memberCount}\n`Group-Owner`: {groupID_owner}\n`Group-OwnerID`: {groupID_ownerID}\n\nsay **cancel** to cancel.", inline=False) embed.set_footer(text="This prompt will automatically cancel in 200 seconds.") msg = await ctx.send(embed=embed) await msg.add_reaction('<:tick:700041815327506532>') await msg.add_reaction('<:rcross:700041862206980146>') tick = self.bot.get_emoji(700041815327506532) cross = self.bot.get_emoji(700041862206980146) try: reaction, user = await self.bot.wait_for('reaction_add', timeout=200, check=reactionCheck) except: embed=discord.Embed(title="PROMPT TIMED OUT", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return else: if reaction.emoji == tick: pass elif reaction.emoji == cross: await token_cookie.delete() embed=discord.Embed(title="PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `setup` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) return embed=discord.Embed(title="SERVER CONFIGURED SUCCESFULLY", color=0x1de97b) embed.set_footer(text="All assets owned by RoServices") await ctx.send(embed=embed) with open('data/groupdata.json', 'r') as f: data = json.load(f) with open('data/groupdata.json', 'w') as f: if ctx.guild.id not in data: data[ctx.guild.id] = {} data[ctx.guild.id] = ({ "Cookie": f"{token_cookie.content}", "ID": int(groupID.content) }) json.dump(data, f, indent=4)
import robloxapi, asyncio client = robloxapi.Client() """ Checks if a user has a gamepass. """ async def main(): ira = await client.get_user_by_id(109503558) if await ira.has_gamepass(7430441): print('he has it!!!!') asyncio.run(main())
import robloxapi, asyncio client = robloxapi.Client("COOKIE") async def main(): trades = await client.get_trades() for trade in trades: await trade.decline() asyncio.run(main())
def __init__(self, bot): self.bot = bot self.icon = "<:h2o:716315229381984257>" self.thumbnail = 'https://cdn.discordapp.com/attachments/714791190926458901/716315345849155634/h2o_1.png' self.helping = Helping() self.client = robloxapi.Client(cookie=None)
import robloxapi, asyncio client = robloxapi.Client("COOKIE") # or client.login """ Joins a group. """ async def main(): group = await client.get_group(3788537) print(f"joining {group.name}") await group.join('2captcha token') await group.leave() # No captcha with leaving groups asyncio.run(main())
async def shout(self, ctx, *, message): def reactionCheck(reaction, user): if user == ctx.author and reaction.emoji == tick: return True if user == ctx.author and reaction.emoji == cross: return True with open('data/groupdata.json') as f: data = json.load(f) cookie = data[f"{ctx.guild.id}"]["Cookie"] id = data[f"{ctx.guild.id}"]["ID"] client = robloxapi.Client(cookie) group = await client.get_group(id) try: embed = discord.Embed(title="PROMPT", color=0x36393e) embed.add_field( name="<:logo:700042045447864520>", value= f"Please confirm that this is the correct data.\n`Message`: {message}", inline=False) embed.set_footer( text="This prompt will automatically cancel in 200 seconds.") msg = await ctx.send(embed=embed) except: embed = discord.Embed( title= "I DON'T HAVE PERMISSIONS TO DO THIS/MESSAGE TO LONG, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `shout` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return await msg.add_reaction('<:tick:700041815327506532>') await msg.add_reaction('<:rcross:700041862206980146>') tick = self.bot.get_emoji(700041815327506532) cross = self.bot.get_emoji(700041862206980146) try: reaction, user = await self.bot.wait_for('reaction_add', timeout=200, check=reactionCheck) except: embed = discord.Embed(title="PROMPT TIMED OUT", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `shout` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return else: if reaction.emoji == tick: pass elif reaction.emoji == cross: embed = discord.Embed(title="PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `shout` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return try: members = await group.post_shout(message) except: embed = discord.Embed( title= "I DON'T HAVE PERMISSIONS TO DO THIS/MESSAGE TO LONG, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `shout` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return embed = discord.Embed(title="SHOUT WAS POSTED SUCCESFULLY", color=0x1de97b) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed)
async def fire(self, ctx, user): """ Demotes a user to the lowest rank. """ def reactionCheck(reaction, user): if user == ctx.author and reaction.emoji == tick: return True if user == ctx.author and reaction.emoji == cross: return True with open('data/groupdata.json') as f: data = json.load(f) cookie = data[f"{ctx.guild.id}"]["Cookie"] id = data[f"{ctx.guild.id}"]["ID"] user_request = requests.get( url=f'https://api.roblox.com/users/get-by-username?username={user}' ) user_json = user_request.json() try: user_name = user_json["Username"] user_Id = user_json["Id"] except KeyError: embed = discord.Embed(title="THIS USER DOES NOT EXIST", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `fire` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return roles_request = requests.get( url=f'https://groups.roblox.com/v1/groups/{id}/roles') roles_json = roles_request.json() lst = [] for role in roles_json.get('roles'): lst.append(str(role["rank"])) lst.sort() for role in roles_json.get('roles'): if int(role["rank"]) == int(lst[1]): rankingRole = role["name"] rankingRoleID = role["id"] client = robloxapi.Client(cookie) RobloxUser_object = await client.get_user(name=f"{user_name}") try: x = await RobloxUser_object.get_role_in_group(id) except robloxapi.utils.errors.NotFound: embed = discord.Embed( title="THIS USER IS NOT IN THE GROUP, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `fire` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return embed = discord.Embed(title="PROMPT", color=0x36393e) embed.add_field( name="<:logo:700042045447864520>", value= f"Please confirm that this is the correct data.\n`Account-name`: {user_name}\n`Account-ID`: {user_Id}\n`Currant-rank`: {x.name}\n`New-rank`: {rankingRole}\n\nsay **cancel** to cancel.", inline=False) embed.set_footer( text="This prompt will automatically cancel in 200 seconds.") msg = await ctx.send(embed=embed) await msg.add_reaction('<:tick:700041815327506532>') await msg.add_reaction('<:rcross:700041862206980146>') tick = self.bot.get_emoji(700041815327506532) cross = self.bot.get_emoji(700041862206980146) try: reaction, user = await self.bot.wait_for('reaction_add', timeout=200, check=reactionCheck) except: embed = discord.Embed(title="PROMPT TIMED OUT", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `fire` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return else: if reaction.emoji == tick: pass elif reaction.emoji == cross: embed = discord.Embed(title="PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `fire` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return group = await client.get_group(id) try: await group.set_rank(user_Id, rankingRoleID) except robloxapi.utils.errors.BadStatus: embed = discord.Embed( title= "YOU CANNOT CHANGE THIS ACCOUNTS RANK, PROMPT CANCELLED", color=0xee6551) embed.add_field(name="<:logo:700042045447864520>", value="Type `fire` to restart prompt.", inline=False) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed) return embed = discord.Embed(title="USER WAS SUCCESSFULLY FIRED", color=0x1de97b) embed.set_footer(text="All assets owned by RoSystems") await ctx.send(embed=embed)
import discord from discord.ext import commands import os from datetime import datetime from discord.errors import HTTPException, Forbidden from discord.ext.commands import (CommandNotFound, BadArgument, MissingRequiredArgument, CommandOnCooldown, NotOwner, MissingPermissions) import robloxapi defaultprefix = ';' #change the prefix to whatever you want defaultcolour = 0xcdcdcd #change to the hex code of your liking client = robloxapi.Client("Your Roblox Cookie") #Change to your roblox client cookie owner = [ 371019056419045376, 449897807936225290 ] # Add discord ids of user who will have owner control over the bot, i.e, can use commands like setrank or shout maingroup = 0000000 TOKEN = "Your Bot Token" #Don't share your token with anyone. Tokens are like a password to the bot. If someone has your token, they have full control over your bot. #If you have accidently revelead it, you can Regenerate it from the application page #---------------------------------------------------⚠---------------------------------------------------------------------------# #----- ⚠ DONT CHANGE ANYTHING OR THE BOT WILL MOST LIKELY NOT WORK intents = discord.Intents.all()