async def register_modules(): get_files = Bloxlink.get_module("utils", attrs="get_files") for directory in MODULE_DIR: # pylint: disable=E1101 files = get_files(directory) for filename in [f.replace(".py", "") for f in files]: Bloxlink.get_module(path=directory, dir_name=filename)
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import RobloxNotFound, Error, UserNotVerified, RobloxAPIError # pylint: disable=import-error from resources.constants import LIMITS # pylint: disable=import-error from discord import Embed, Object import re get_group, get_user, parse_accounts = Bloxlink.get_module( "roblox", attrs=["get_group", "get_user", "parse_accounts"]) user_resolver = Bloxlink.get_module("resolver", attrs="user_resolver") set_guild_value = Bloxlink.get_module("cache", attrs=["set_guild_value"]) get_features = Bloxlink.get_module("premium", attrs=["get_features"]) RESTRICTION_NAME_MAP = { "groups": "Groups", "users": "Users", "robloxAccounts": "Roblox Accounts" } @Bloxlink.command class RestrictCommand(Bloxlink.Module): """restrict a Roblox user or group from verifying in your server""" def __init__(self): self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Administration" self.aliases = ["restriction"] self.slash_enabled = True self._roblox_group_regex = re.compile(r"roblox.com/groups/(\d+)/") async def resolve_restriction(self, message, content, prompt):
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from discord import Embed from resources.exceptions import Message, UserNotVerified, Error, BloxlinkBypass, Blacklisted, PermissionError # pylint: disable=import-error from resources.constants import GREEN_COLOR, VERIFY_URL # pylint: disable=import-error format_update_embed, guild_obligations = Bloxlink.get_module("roblox", attrs=["format_update_embed", "guild_obligations"]) get_options = Bloxlink.get_module("trello", attrs="get_options") post_event = Bloxlink.get_module("utils", attrs=["post_event"]) class GetRoleCommand(Bloxlink.Module): """get your server roles""" def __init__(self): self.category = "Account" self.cooldown = 5 self.aliases = ["getroles", "get-roles", "get-role"] self.slash_enabled = True self.slash_ack = True @Bloxlink.flags async def __main__(self, CommandArgs): trello_board = CommandArgs.trello_board guild_data = CommandArgs.guild_data guild = CommandArgs.guild author = CommandArgs.author response = CommandArgs.response prefix = CommandArgs.prefix trello_options = {}
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import Message, Error, PermissionError, CancelledPrompt # pylint: disable=import-error from resources.constants import LIMITS, ARROW, DEFAULTS, ORANGE_COLOR, OWNER, PROMPT # pylint: disable=import-error from discord import Embed from discord.errors import Forbidden from time import time from asyncio import TimeoutError import datetime import json count_binds = Bloxlink.get_module("roblox", attrs=["count_binds"]) get_board, get_options = Bloxlink.get_module("trello", attrs=["get_board", "get_options"]) get_prefix = Bloxlink.get_module("utils", attrs=["get_prefix"]) cache_pop = Bloxlink.get_module("cache", attrs=["pop"]) INT_REACTIONS = ["1️⃣", "2️⃣", "3️⃣", "4️⃣"] @Bloxlink.command class DataCommand(Bloxlink.Module): """backup or restore your stored Server Data""" async def _backup(self, guild, backup_name): guild_data = await self.r.table("guilds").get(str(guild.id)).run() or {} if guild_data: return { "data": guild_data, "timestamp": time(), "guildId": str(guild.id), "backupName": backup_name
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import Error, UserNotVerified, Message, BloxlinkBypass, CancelCommand, PermissionError, Blacklisted # pylint: disable=import-error from config import REACTIONS # pylint: disable=no-name-in-module from resources.constants import RELEASE, GREEN_COLOR # pylint: disable=import-error from discord import Object, Role import math guild_obligations, format_update_embed = Bloxlink.get_module( "roblox", attrs=["guild_obligations", "format_update_embed"]) parse_message = Bloxlink.get_module("commands", attrs=["parse_message"]) get_features = Bloxlink.get_module("premium", attrs="get_features") class UpdateUserCommand(Bloxlink.Module): """force update user(s) with roles and nicknames""" def __init__(self): permissions = Bloxlink.Permissions().build("BLOXLINK_UPDATER") permissions.allow_bypass = True self.permissions = permissions self.aliases = ["update", "updateroles", "update-user"] self.arguments = [{ "prompt": "Please specify user(s) or role(s) to update. For example: `@user1 @user2 @user3` or `@role`", "type": ["user", "role"], "name": "users", "multiple": True, "optional": True, "create_missing_role": False }] self.slash_args = [{
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import RobloxNotFound, Message # pylint: disable=import-error from resources.constants import BROWN_COLOR # pylint: disable=import-error from resources.exceptions import Error # pylint: disable=import-error from discord import Embed, Object import re post_event = Bloxlink.get_module("utils", attrs=["post_event"]) get_group = Bloxlink.get_module("roblox", attrs=["get_group"]) get_features = Bloxlink.get_module("premium", attrs=["get_features"]) set_guild_value = Bloxlink.get_module("cache", attrs="set_guild_value") roblox_group_regex = re.compile(r"roblox.com/groups/(\d+)/") @Bloxlink.command class GroupLockCommand(Bloxlink.Module): """lock your server to group members""" @staticmethod async def validate_group(message, content): regex_search = roblox_group_regex.search(content) if regex_search: group_id = regex_search.group(1) else: group_id = content try: group = await get_group(group_id, full_group=True) except RobloxNotFound: return None, "No group was found with this ID. Please try again."
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import Message, Error, CancelledPrompt, PermissionError # pylint: disable=import-error from resources.constants import ARROW, OPTIONS, DEFAULTS, NICKNAME_TEMPLATES, ORANGE_COLOR, GOLD_COLOR, BROWN_COLOR, TRELLO # pylint: disable=import-error from discord import Embed, Object from os import environ as env from discord.errors import Forbidden from aiotrello.exceptions import TrelloUnauthorized, TrelloNotFound, TrelloBadRequest get_prefix, post_event = Bloxlink.get_module("utils", attrs=["get_prefix", "post_event"]) get_options = Bloxlink.get_module("trello", attrs=["get_options"]) parse_message = Bloxlink.get_module("commands", attrs=["parse_message"]) clear_guild_data, set_guild_value = Bloxlink.get_module("cache", attrs=["clear_guild_data", "set_guild_value"]) get_features = Bloxlink.get_module("premium", attrs=["get_features"]) RESET_CHOICES = ("everything", "binds") options_keys = [o for o, o_d in OPTIONS.items() if not o_d[3]] premium_option_keys = [o for o, o_d in OPTIONS.items() if o_d[3]] options_combined = options_keys + premium_option_keys options_strings = ", ".join([o for o, o_d in OPTIONS.items() if not o_d[3]]) premium_options_strings = ", ".join([o for o, o_d in OPTIONS.items() if o_d[3]]) @Bloxlink.command class SettingsCommand(Bloxlink.Module): """change, view, or reset your Bloxlink settings""" def __init__(self): permission = Bloxlink.Permissions().build("BLOXLINK_MANAGER")
import math from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.constants import VERSION, SHARD_RANGE, CLUSTER_ID, STARTED, IS_DOCKER, RELEASE # pylint: disable=import-error from discord import Embed from time import time from psutil import Process from os import getpid broadcast = Bloxlink.get_module("ipc", attrs="broadcast") @Bloxlink.command class StatsCommand(Bloxlink.Module): """view the current stats of Bloxlink""" def __init__(self): self.aliases = ["statistics", "nerdinfo"] self.dm_allowed = True if len(SHARD_RANGE) > 1: self.shard_range = f"[{SHARD_RANGE[0]}-{SHARD_RANGE[len(SHARD_RANGE)-1]}]" else: self.shard_range = SHARD_RANGE async def __main__(self, CommandArgs): response = CommandArgs.response clusters = 0 if IS_DOCKER: total_guilds = guilds = 0 mem = 0 errored = 0
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.modules.commands import commands # pylint: disable=import-error from resources.exceptions import CancelCommand, Error # pylint: disable=import-error from resources.constants import ARROW, OWNER, HELP_DESCRIPTION # pylint: disable=import-error from discord import Embed get_enabled_addons = Bloxlink.get_module("addonsm", attrs=["get_enabled_addons"]) @Bloxlink.command class HelpCommand(Bloxlink.Module): """view the command list, or get help on a certain command""" def __init__(self): self.aliases = ["cmds", "commands"] self.arguments = [{ "prompt": "Please specify the command name", "optional": True, "name": "command_name" }] self.dm_allowed = True async def __main__(self, CommandArgs): command_name = CommandArgs.parsed_args.get("command_name") prefix = CommandArgs.prefix response = CommandArgs.response guild = CommandArgs.message.guild if command_name: command_name = command_name.lower()
import re import discord from resources.exceptions import CancelledPrompt # pylint: disable=import-error, no-name-in-module from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module from resources.exceptions import PermissionError, Error, RobloxNotFound, RobloxAPIError, Message # pylint: disable=import-error, no-name-in-module from resources.constants import NICKNAME_TEMPLATES, ARROW, LIMITS, BLURPLE_COLOR, BROWN_COLOR # pylint: disable=import-error, no-name-in-module bind_num_range = re.compile(r"([0-9]+)\-([0-9]+)") roblox_group_regex = re.compile(r"roblox.com/groups/(\d+)/") get_group, count_binds, get_binds = Bloxlink.get_module( "roblox", attrs=["get_group", "count_binds", "get_binds"]) fetch, post_event = Bloxlink.get_module("utils", attrs=["fetch", "post_event"]) has_premium = Bloxlink.get_module("premium", attrs=["has_premium"]) set_guild_value, get_guild_value = Bloxlink.get_module( "cache", attrs=["set_guild_value", "get_guild_value"]) API_URL = "https://api.roblox.com" FREE_BIND_COUNT, PREM_BIND_COUNT = LIMITS["BINDS"]["FREE"], LIMITS["BINDS"][ "PREMIUM"] @Bloxlink.command class BindCommand(Bloxlink.Module): """bind a discord role to a roblox group, asset, or badge""" def __init__(self): self.aliases = ["newbind"] self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Binds" self.slash_enabled = True
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from discord import File from io import BytesIO fetch = Bloxlink.get_module("utils", attrs=["fetch"]) @Bloxlink.command class HelpCommand(Bloxlink.Module): """view information about Bloxlink""" def __init__(self): self.dm_allowed = True self.slash_enabled = True self.images = None self.urls = [ "https://i.imgur.com/zQwITet.png", "https://i.imgur.com/yv6jfNC.png", "https://i.imgur.com/pwMB8wZ.png" ] async def __setup__(self): self.images = [] for url in self.urls: image_data, image_response = await fetch(url=url, bytes=True, raise_on_failure=False) if image_response.status == 200: self.images.append(image_data)
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from discord import Embed from resources.exceptions import Error, Message # pylint: disable=import-error from resources.constants import ARROW, BLURPLE_COLOR # pylint: disable=import-error from aiotrello.exceptions import TrelloException import asyncio get_binds, get_group, count_binds = Bloxlink.get_module( "roblox", attrs=["get_binds", "get_group", "count_binds"]) post_event = Bloxlink.get_module("utils", attrs=["post_event"]) clear_guild_data = Bloxlink.get_module("cache", attrs=["clear_guild_data"]) BIND_TYPES = ("asset", "badge", "gamepass") async def delete_bind_from_cards(type="group", bind_id=None, trello_binds_list=None, bind_data_trello=None, rank=None, high=None, low=None): if not (trello_binds_list and bind_data_trello): return if type == "group": if rank in ("main", "everything"): cards = bind_data_trello.get("trello", {}).get("cards", []) for rank_id, rank_data in bind_data_trello.get("binds", {}).items():
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module from resources.exceptions import Error # pylint: disable=import-error, no-name-in-module from resources.constants import BROWN_COLOR # pylint: disable=import-error, no-name-in-module from discord import TextChannel post_event = Bloxlink.get_module("utils", attrs=["post_event"]) set_guild_value = Bloxlink.get_module("cache", attrs=["set_guild_value"]) commands = Bloxlink.get_module("commands", attrs=["commands"]) @Bloxlink.command class DisableCommand(Bloxlink.Module): """enable/disable commands globally or per channel for non-admins""" def __init__(self): self.aliases = ["enable"] self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Administration" self.arguments = [{ "prompt": "Please specify the **command name** to be enabled/disabled.", "type": "choice", "choices": commands.keys(), "name": "command_name" }, { "prompt": "Should this command be enabled/disabled **globally** or **for a channel?**\n" "You may either say `globally` or mention a `channel`.", "type": ["channel", "choice"], "create_missing_channel": False, "name":
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import Message, Error # pylint: disable=import-error import time import math from discord import Embed, Object transfer_premium, get_features = Bloxlink.get_module( "premium", attrs=["transfer_premium", "get_features"]) cache_pop = Bloxlink.get_module("cache", attrs="pop") @Bloxlink.command class TransferCommand(Bloxlink.Module): """transfer your Bloxlink premium""" def __init__(self): self.examples = ["@justin", "disable"] self.arguments = [{ "prompt": "Please specify the user to transfer premium to.", "name": "user", "type": "user", }] self.category = "Premium" self.free_to_use = True @Bloxlink.flags async def __main__(self, CommandArgs): author = CommandArgs.message.author guild = CommandArgs.message.guild transfer_to = CommandArgs.parsed_args.get("user") response = CommandArgs.response prefix = CommandArgs.prefix
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from discord import Embed set_guild_value = Bloxlink.get_module("cache", attrs="set_guild_value") addons, get_enabled_addons = Bloxlink.get_module("addonsm", attrs=["addons", "get_enabled_addons"]) @Bloxlink.command class AddonsCommand(Bloxlink.Module): """enable/disable a server add-on""" def __init__(self): self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Administration" self.aliases = ["addon"] self.hidden = True self.developer = True self.arguments = [ { "prompt": "Would you like to **view** the available add-ons, or **change** (enable/disable) an add-on?", "name": "subcommand", "type": "choice", "choices": ["view", "change", "enable", "disable"] } ] async def __main__(self, CommandArgs): subcommand_choice = CommandArgs.parsed_args["subcommand"]
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module from discord import Embed from resources.exceptions import Message, RobloxNotFound # pylint: disable=import-error, no-name-in-module from resources.constants import ARROW # pylint: disable=import-error, no-name-in-module get_binds, get_group, count_binds = Bloxlink.get_module( "roblox", attrs=["get_binds", "get_group", "count_binds"]) @Bloxlink.command class ViewBindsCommand(Bloxlink.Module): """view your server bound roles""" def __init__(self): self.category = "Binds" self.aliases = ["binds", "view-binds"] self.slash_enabled = True async def __main__(self, CommandArgs): guild = CommandArgs.guild guild_data = CommandArgs.guild_data trello_board = CommandArgs.trello_board prefix = CommandArgs.prefix role_binds, group_ids, _ = await get_binds(guild_data=guild_data, trello_board=trello_board) if count_binds(guild_data, role_binds=role_binds, group_ids=group_ids) == 0: raise Message( f"You have no bounded roles! Please use `{CommandArgs.prefix}bind` "
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module from resources.exceptions import Error, RobloxNotFound # pylint: disable=import-error, no-name-in-module from resources.constants import NICKNAME_TEMPLATES # pylint: disable=import-error, no-name-in-module from aiotrello.exceptions import TrelloUnauthorized, TrelloNotFound, TrelloBadRequest get_group, parse_trello_binds = Bloxlink.get_module( "roblox", attrs=["get_group", "parse_trello_binds"]) @Bloxlink.command class GuestRoleCommand(Bloxlink.Module): """bind a discord role to non-group members""" def __init__(self): self.arguments = [{ "prompt": "Please specify the **Group ID** to integrate with. The group ID is the rightmost numbers on your Group URL.", "slash_desc": "Please enter your Group ID.", "name": "group_id", "type": "number", }, { "prompt": "Please specify the **role name** to bind non-group members. A role will be created if it doesn't already exist.", "slash_desc": "Please choose the role to bind to non-group members.", "name": "role", "type": "role" }, { "prompt": "Should these members be given a nickname different from the server-wide `!nickname`? Please specify a nickname, or " "say `skip` to skip this option and default to the server-wide nickname `!nickname` template.\n\nYou may use these templates:" f"```{NICKNAME_TEMPLATES}```",
from discord import Embed from resources.exceptions import Message, UserNotVerified, Error, RobloxNotFound, BloxlinkBypass, Blacklisted, PermissionError # pylint: disable=import-error from resources.constants import ( NICKNAME_TEMPLATES, GREEN_COLOR, BROWN_COLOR, ARROW, VERIFY_URL, # pylint: disable=import-error ACCOUNT_SETTINGS_URL, TRELLO) from aiotrello.exceptions import TrelloNotFound, TrelloUnauthorized, TrelloBadRequest verify_as, get_user, get_nickname, get_roblox_id, parse_accounts, unverify_member, format_update_embed, guild_obligations = Bloxlink.get_module( "roblox", attrs=[ "verify_as", "get_user", "get_nickname", "get_roblox_id", "parse_accounts", "unverify_member", "format_update_embed", "guild_obligations" ]) get_options = Bloxlink.get_module("trello", attrs="get_options") post_event = Bloxlink.get_module("utils", attrs=["post_event"]) class VerifyCommand(Bloxlink.Module): """link your Roblox account to your Discord account and get your server roles""" def __init__(self): self.examples = ["add", "unlink", "view", "blox_link"] self.category = "Account" self.cooldown = 5 self.dm_allowed = True self.slash_enabled = True
import re from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import PermissionError, Error, RobloxNotFound, RobloxAPIError, Message, CancelCommand # pylint: disable=import-error from resources.constants import NICKNAME_TEMPLATES, ARROW, LIMITS, BLURPLE_COLOR # pylint: disable=import-error from discord import Embed, Object from discord.errors import Forbidden, NotFound, HTTPException from discord.utils import find from aiotrello.exceptions import TrelloUnauthorized, TrelloNotFound, TrelloBadRequest bind_num_range = re.compile(r"([0-9]+)\-([0-9]+)") roblox_group_regex = re.compile(r"roblox.com/groups/(\d+)/") get_group, parse_trello_binds, count_binds, get_binds = Bloxlink.get_module("roblox", attrs=["get_group", "parse_trello_binds", "count_binds", "get_binds"]) fetch, post_event = Bloxlink.get_module("utils", attrs=["fetch", "post_event"]) get_features = Bloxlink.get_module("premium", attrs=["get_features"]) clear_guild_data = Bloxlink.get_module("cache", attrs=["clear_guild_data"]) API_URL = "https://api.roblox.com" FREE_BIND_COUNT, PREM_BIND_COUNT = LIMITS["BINDS"]["FREE"], LIMITS["BINDS"]["PREMIUM"] @Bloxlink.command class BindCommand(Bloxlink.Module): """bind a discord role to a roblox group, asset, or badge""" def __init__(self): self.aliases = ["newbind"] self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Binds" self.slash_enabled = True @staticmethod
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module from resources.constants import DEFAULTS, BROWN_COLOR # pylint: disable=import-error, no-name-in-module post_event = Bloxlink.get_module("utils", attrs=["post_event"]) @Bloxlink.command class DynamicRolesCommand(Bloxlink.Module): """automatically create missing group roles. by default, this is ENABLED.""" def __init__(self): self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Administration" self.hidden = True async def __main__(self, CommandArgs): response = CommandArgs.response author = CommandArgs.author guild = CommandArgs.guild guild_data = CommandArgs.guild_data toggle = not guild_data.get("dynamicRoles", DEFAULTS.get("dynamicRoles")) guild_data["dynamicRoles"] = toggle await self.r.table("guilds").insert(guild_data, conflict="update").run() if toggle:
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import Error, Message, UserNotVerified, BloxlinkBypass, Blacklisted # pylint: disable=import-error from resources.constants import DEFAULTS, GREEN_COLOR, VERIFY_URL, SELF_HOST # pylint: disable=import-error from discord.errors import Forbidden, NotFound, HTTPException from discord.utils import find get_options, get_board = Bloxlink.get_module("trello", attrs=["get_options", "get_board"]) get_user, verify_as, parse_accounts, update_member, get_nickname, verify_member, count_binds, get_binds = Bloxlink.get_module("roblox", attrs=["get_user", "verify_as", "parse_accounts", "update_member", "get_nickname", "verify_member", "count_binds", "get_binds"]) post_event = Bloxlink.get_module("utils", attrs=["post_event"]) class SwitchUserCommand(Bloxlink.Module): """change your linked Roblox account in a server""" def __init__(self): self.category = "Account" self.slash_enabled = True @staticmethod async def validate_server(message, content): content = content.lower() if content in ("skip", "next"): return message.guild if not content.isdigit(): return None, "A server ID must be a number." try: guild = await Bloxlink.fetch_guild(int(content))
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module from resources.exceptions import Error, UserNotVerified, Message, BloxlinkBypass, CancelCommand, PermissionError, Blacklisted # pylint: disable=import-error, no-name-in-module from config import REACTIONS # pylint: disable=import-error, no-name-in-module from resources.constants import RELEASE # pylint: disable=import-error, no-name-in-module from discord import User from discord.errors import NotFound import math guild_obligations, format_update_embed = Bloxlink.get_module( "roblox", attrs=["guild_obligations", "format_update_embed"]) has_premium = Bloxlink.get_module("premium", attrs="has_premium") class UpdateCommand(Bloxlink.Module): """force update user(s) with roles and nicknames""" def __init__(self): permissions = Bloxlink.Permissions().build("BLOXLINK_UPDATER") permissions.allow_bypass = True self.permissions = permissions self.aliases = ["update", "updateroles", "update-user"] self.arguments = [{ "prompt": "Please select the user to update.", "name": "user", "type": "user", "optional": True }, { "prompt": "Please select the role of members to update.", "name": "role", "type": "role", "optional": True
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.constants import ARROW, BROWN_COLOR, NICKNAME_TEMPLATES, TRELLO # pylint: disable=import-error from resources.exceptions import Error, RobloxNotFound, CancelCommand # pylint: disable=import-error from aiotrello.exceptions import TrelloNotFound, TrelloUnauthorized, TrelloBadRequest from discord.errors import Forbidden, HTTPException from discord import Embed from discord.utils import find import re NICKNAME_DEFAULT = "{roblox-name}" VERIFIED_DEFAULT = "Verified" get_group, generate_code = Bloxlink.get_module( "roblox", attrs=["get_group", "generate_code"]) trello = Bloxlink.get_module("trello", attrs=["trello"]) post_event = Bloxlink.get_module("utils", attrs=["post_event"]) clear_guild_data = Bloxlink.get_module("cache", attrs=["clear_guild_data"]) roblox_group_regex = re.compile(r"roblox.com/groups/(\d+)/") @Bloxlink.command class SetupCommand(Bloxlink.Module): """set-up your server with Bloxlink""" def __init__(self): self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Administration" @staticmethod async def validate_group(message, content): if content.lower() in ("skip", "next"):
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import Error, RobloxNotFound, RobloxAPIError, Message # pylint: disable=import-error from discord.errors import NotFound get_user, get_binds = Bloxlink.get_module("roblox", attrs=["get_user", "get_binds"]) parse_message = Bloxlink.get_module("commands", attrs=["parse_message"]) @Bloxlink.command class RobloxSearchCommand(Bloxlink.Module): """retrieve the Roblox information of a user""" def __init__(self): self.aliases = ["rs", "search", "roblox-search"] self.arguments = [{ "prompt": "Please specify either a username or Roblox ID. If the person's name is all numbers, " "then attach a `--username` flag to this command. Example: `!getinfo 1234 --username` will " "search for a user with a Roblox username of '1234' instead of a Roblox ID.", "slash_desc": "Please enter a Roblox username or Roblox ID.", "type": "string", "name": "roblox_name" }] self.examples = ["roblox", "569422833", "569422833 --username"] self.cooldown = 5 self.dm_allowed = True self.slash_enabled = True
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module, no-name-in-module from resources.constants import ARROW, BROWN_COLOR, MAGIC_ROLES # pylint: disable=import-error, no-name-in-module, no-name-in-module from resources.exceptions import Error # pylint: disable=import-error, no-name-in-module, no-name-in-module import discord post_event = Bloxlink.get_module("utils", attrs=["post_event"]) set_guild_value, get_guild_value = Bloxlink.get_module("cache", attrs=["set_guild_value", "get_guild_value"]) has_premium = Bloxlink.get_module("premium", attrs=["has_premium"]) @Bloxlink.command class MagicRolesCommand(Bloxlink.Module): """add/view/remove magic roles""" def __init__(self): self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.category = "Premium" self.hidden = True self.aliases = ["magicrole", "magicroles", "magic-roles"] self.free_to_use = True async def __main__(self, CommandArgs): await CommandArgs.response.send("You can modify your magic roles from our dashboard: https://blox.link/dashboard")
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error, no-name-in-module from resources.exceptions import Error, RobloxNotFound # pylint: disable=import-error, no-name-in-module from discord import Embed from discord.errors import NotFound get_user = Bloxlink.get_module("roblox", attrs=["get_user"]) get_db_value = Bloxlink.get_module("cache", attrs=["get_db_value"]) @Bloxlink.command class ReverseSearchCommand(Bloxlink.Module): """find Discord IDs in your server that are linked to a certain Roblox ID""" def __init__(self): self.examples = ["1", "569422833", "blox_link"] self.arguments = [{ "prompt": "Please specify either a username or Roblox ID. If the person's name is all numbers, " "then attach a `--username` flag to this command. Example: `!getinfo 1234 --username` will " "search for a user with a Roblox username of '1234' instead of a Roblox ID.", "slash_desc": "Please specify either a Roblox username or ID.", "name": "target" }] self.category = "Administration" self.permissions = Bloxlink.Permissions().build("BLOXLINK_MANAGER") self.aliases = ["reverse-search"] self.slash_enabled = True @Bloxlink.flags async def __main__(self, CommandArgs): guild = CommandArgs.guild target = CommandArgs.parsed_args["target"]
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import UserNotVerified, Message, Error # pylint: disable=import-error from discord import Embed get_user, get_binds = Bloxlink.get_module("roblox", attrs=["get_user", "get_binds"]) class GetinfoCommand(Bloxlink.Module): """retrieve the Roblox information for a member""" def __init__(self): self.aliases = ["whois"] self.arguments = [{ "prompt": "Please specify the user.", "type": "user", "name": "user", "optional": True }] self.examples = [ "justin", "@justin", "84117866944663552", "@justin --avatar", "@justin --avatar --groups" ] self.cooldown = 5 self.dm_allowed = True self.slash_enabled = True @Bloxlink.flags async def __main__(self, CommandArgs): target = CommandArgs.parsed_args["user"] or CommandArgs.author flags = CommandArgs.flags
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.constants import GOLD_COLOR # pylint: disable=import-error from discord import Embed get_features = Bloxlink.get_module("premium", attrs=["get_features"]) @Bloxlink.command class StatusCommand(Bloxlink.Module): """view your Bloxlink premium status""" def __init__(self): self.examples = ["@justin"] self.arguments = [{ "prompt": "Please specify the user to view the status of.", "name": "user", "type": "user", "optional": True }] self.category = "Premium" self.free_to_use = True self.dm_allowed = True self.slash_enabled = True async def __main__(self, CommandArgs): user = CommandArgs.parsed_args.get("user") or CommandArgs.author guild = CommandArgs.guild response = CommandArgs.response embed = Embed()
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import PermissionError # pylint: disable=import-error from resources.constants import BROWN_COLOR, RELEASE, TRELLO # pylint: disable=import-error from aiotrello.exceptions import TrelloUnauthorized, TrelloNotFound, TrelloBadRequest get_prefix, post_event = Bloxlink.get_module("utils", attrs=["get_prefix", "post_event"]) set_guild_value = Bloxlink.get_module("cache", attrs=["set_guild_value"]) @Bloxlink.command class PrefixCommand(Bloxlink.Module): """change your prefix, or view your prefix""" def __init__(self): self.arguments = [ { "prompt": "Please specify a new prefix.", "name": "new_prefix", "max": 10, "optional": True } ] self.examples = ["?"] permission = Bloxlink.Permissions().build("BLOXLINK_MANAGER") permission.allow_bypass = True self.permissions = permission self.category = "Administration" self.slash_enabled = True
from resources.structures.Bloxlink import Bloxlink # pylint: disable=import-error from resources.exceptions import PermissionError, Error, RobloxNotFound, Message # pylint: disable=import-error from resources.constants import BROWN_COLOR # pylint: disable=import-error from discord import Embed, Object import re post_event = Bloxlink.get_module("utils", attrs=["post_event"]) get_group = Bloxlink.get_module("roblox", attrs=["get_group"]) get_features = Bloxlink.get_module("premium", attrs=["get_features"]) roblox_group_regex = re.compile(r"roblox.com/groups/(\d+)/") @Bloxlink.command class GroupLockCommand(Bloxlink.Module): """lock your server to group members""" @staticmethod async def validate_group(message, content): regex_search = roblox_group_regex.search(content) if regex_search: group_id = regex_search.group(1) else: group_id = content try: group = await get_group(group_id) except RobloxNotFound: return None, "No group was found with this ID. Please try again." return group