Пример #1
0
 async def initialize(self):
     ofcbsapikey = await self.bot.get_shared_api_tokens("ofcbsapi")
     if ofcbsapikey["api_key"] is None:
         raise ValueError(
             "The Official Brawl Stars API key has not been set.")
     self.ofcbsapi = brawlstats.Client(ofcbsapikey["api_key"],
                                       is_async=True)
Пример #2
0
 def __init__(self, bot):
     self.bot = bot
     self.client = brawlstats.Client(
         token=bot.config.bsapi,
         session=bot.session,
         is_async=True
     )
Пример #3
0
 async def setUp(self):
     self.player_tag = '#GGJVJLU2'
     self.club_tag = '#QCGV8PG'
     self.client = brawlstats.Client(TOKEN,
                                     is_async=True,
                                     base_url=URL,
                                     timeout=30)
Пример #4
0
    async def setUp(self):
        session = aiohttp.ClientSession(loop=self.loop)

        self.client = brawlstats.Client(os.getenv('token'),
                                        base_url=os.getenv('base_url'),
                                        is_async=True,
                                        session=session)
Пример #5
0
 def __init__(self, client):
     print('Loading BSVerification Data')
     self.client = client
     self.basic_club_role = 727782320165355523
     self.family_role = 843442036111573003
     self.loading_emj = '<a:loading:848756850458361876>'
     self.failed_emj = '<a:failed:848757026418851840>'
     self.success_emj = '<a:success:848756404797964288>'
     with open('secrets.json') as f:
         bs_token = json.load(f)['bs_api_token']
     self.tag_dict = {
         i['_id']: i['player_tag']
         for i in self.client.bs_data.find()
     }
     self.club_role_dict = {
         j['club_tag']: {
             'club_name': j['club_name'],
             'role_id': j['_id']
         }
         for j in self.client.club_roles_data.find()
     }
     self.position_role_dict = {
         "member": 841908832007487488,
         "senior": 841908822653534229,
         "vicepresident": 842630288143417364,
         "president": 698419850082779196
     }
     self.bs_client = brawlstats.Client(is_async=True, token=bs_token)
     print("Done.")
Пример #6
0
 def setUp(self):
     self.player_tag = 'GGJVJLU2'
     self.club_tag = 'QCGV8PG'
     self.client = brawlstats.Client(TOKEN,
                                     is_async=False,
                                     timeout=30,
                                     debug=True)
     logging.basicConfig(level=logging.DEBUG)
Пример #7
0
 async def initialize(self):
     bsapikey = await self.bot.db.api_tokens.get_raw(
         "bsapi", default={"api_key": None})
     if bsapikey["api_key"] is None:
         raise ValueError(
             "The Brawl Stars API key has not been set. Use [p]set api bsapi api_key,YOURAPIKEY"
         )
     self.bsapi = brawlstats.Client(bsapikey["api_key"], is_async=True)
Пример #8
0
 def __init__(self, bot):
     self.bot = bot
     self.CRregex = re.compile(r"<?(https?:\/\/)?(www\.)?(link\.clashroyale\.com\/invite\/friend)\b([-a-zA-Z0-9/]*)>?")
     self.BSregex = re.compile(r"<?(https?:\/\/)?(www\.)?(link\.brawlstars\.com\/invite\/friend)\b([-a-zA-Z0-9/]*)>?")
     self.auth = self.bot.get_cog('crtools').auth
     self.tags = self.bot.get_cog('crtools').tags
     self.constants = self.bot.get_cog('crtools').constants
     self.clash = clashroyale.OfficialAPI(self.auth.getOfficialToken(), is_async=True)
     self.brawl = brawlstats.Client(self.auth.getBSToken(), is_async=False)
Пример #9
0
    async def handle(self, params, message, client):
        # 'params' is a list that contains the parameters that the command
        # expects to receive, t is guaranteed to have AT LEAST as many
        # parameters as specified in __init__
        # 'message' is the discord.py Message object for the command to handle
        # 'client' is the bot Client object
        message_author = str(message.author)
        brawl_database = database.SQL_Server()
        mentioned_channel = message.channel_mentions[0]

        # Get member object
        brawl_client = brawlstats.Client(self.brawl_api)
        activeServers = list(client.guilds)[0]
        list_members = activeServers.members
        member_object = activeServers.get_member_named(message_author)

        role = find(lambda r: r.name == 'Moderator', activeServers.roles)
        role_owner = find(lambda r: r.name == 'Owner', activeServers.roles)

        if role not in member_object.roles:
            if role_owner not in member_object.roles:
                await message.channel.send(
                    "You are not authorized to execute this command")
                return

        load_variables = open(os.path.join('storage_files', 'saved_id.pkl'),
                              'rb')
        id_message = pickle.load(load_variables)
        vote_message = await mentioned_channel.fetch_message(id_message)
        participants = []
        participantsIds = []
        list_reactions = await (vote_message.reactions[0]).users().flatten()

        for individual_participant in list_reactions:
            participantsIds.append([str(individual_participant.id)])
            participants.append([str(individual_participant)])

        for index in range(len(participants)):
            if brawl_database.information_present(participantsIds[index][0]):
                player_info = (brawl_client.get_player(
                    brawl_database.view_information_user(
                        participantsIds[index][0])))
                participants[index].append(player_info.name)
                participants[index].append(str(player_info.trophies))
            else:
                participants[index].append(participants[index][0])
                participants[index].append("UnKnown")

        with open(os.path.join("storage_files", "listParticipants.csv"),
                  "w",
                  newline="") as f:
            writer = csv.writer(f)
            writer.writerows(participants)

        await message.channel.send(
            f"{len(participants) - 1} people have signed up for the tournament!!!"
        )
Пример #10
0
    async def run(self, client):
        activeServers = list(client.servers)[0]
        list_members = activeServers.members
        brawl_database = database.SQL_Server()
        print("Start Task")

        warning_channel = get_channel(client, "warnings")
        brawl_database = database.SQL_Server()

        if "ClubTag" not in brawl_database.return_allUsers():
            msg = "@everyone Club Tag not added to the database"
            await client.send_message(warning_channel, msg)
        else:
            for member in list_members:

                member = (str(member))
                member_object = activeServers.get_member_named(member)
                role = [get(member_object.server.roles, name="member")]

                if member_object.bot or get(member_object.roles, name="owner"):
                    pass

                elif brawl_database.return_userWarning(
                        member) >= self.allowed_userWarning and get(
                            member_object.roles, name="member"):
                    msg = " removed from server since they did not insert player information in database"
                    await client.send_message(warning_channel,
                                              member_object.mention + msg)
                    await client.remove_roles(member_object, *role)

                elif member not in brawl_database.return_allUsers():
                    brawl_database.insert_user_warning(member)
                    msg = " did not insert player information in database"
                    await client.send_message(warning_channel,
                                              member_object.mention + msg)

                elif not brawl_database.information_present(member):
                    brawl_database.append_user_warning(member)
                    msg = " did not insert player information in database"
                    await client.send_message(warning_channel,
                                              member_object.mention + msg)

                elif get(member_object.roles, name="member"):
                    brawl_client = brawlstats.Client(self.brawl_api)
                    with open('tags.txt', 'r') as f:
                        brawl_tag = f.read().splitlines()
                    list_users = []
                    list_users.extend(
                        brawl_client.get_club_members(
                            brawl_database.view_information_user("ClubTag")))
                    for tag in brawl_tag:
                        list_users.extend(brawl_client.get_club_members(tag))
                    if member not in list_users:
                        msg = " removed from server since they are not part of the club"
                        await client.send_message(warning_channel,
                                                  member_object.mention + msg)
                        await client.remove_roles(member_object, *role)
Пример #11
0
 def __init__(self, bot):
     self.bot = bot
     self.user_history = {}
     self.joined = []
     self.welcome = dataIO.load_json('data/legendbs/welcome.json')
     self.auth = self.bot.get_cog('crtools').auth
     self.tags = self.bot.get_cog('crtools').tags
     self.clubs = self.bot.get_cog('crtools').clubs
     self.brawl = brawlstats.Client(self.auth.getBSToken(), is_async=False)
Пример #12
0
def connect():
    # Load API Token
    with open('BrawlStars/token.txt', 'r') as tokenfile:
        token = tokenfile.read()

    # Initialize connection with Brawl Stars API
    print("Connecting to Brawl Stars API...")
    client = brawlstats.Client(token)
    print("Connected!")
    return client
Пример #13
0
async def init(app, loop):
    app.session = aiohttp.ClientSession(loop=loop)
    app.brawl_client = brawlstats.Client(token=app.config.BRAWLSTATS_TOKEN,
                                         session=app.session,
                                         is_async=True)
    app.oauth = Oauth2(
        app.config.DISCORD_CLIENT_ID,
        app.config.DISCORD_CLIENT_SECRET,
        scope='identify',
        redirect_uri=
        f"http{'s' if not app.config.DEV else ''}://{app.config.DOMAIN}/callback",
        session=app.session)
Пример #14
0
 def __init__(self, bot):
     self.bot = bot
     self.auth = self.bot.get_cog('crtools').auth
     self.clans = self.bot.get_cog('crtools').clans
     self.clubs = self.bot.get_cog('crtools').clubs
     self.tags = self.bot.get_cog('crtools').tags
     self.clash = clashroyale.OfficialAPI(self.auth.getOfficialToken(), is_async=True)
     self.brawl = brawlstats.Client(self.auth.getBSToken(), is_async=False)
     self.member_log = dataIO.load_json('data/clanlog/member_log.json')
     self.bs_member_log = dataIO.load_json('data/clanlog/bs_member_log.json')
     self.discord_log = dataIO.load_json('data/clanlog/discord_log.json')
     self.last_count = 0
     self.bs_last_count = 0
Пример #15
0
 async def api_init(self):
     """"Initializes the api, don't call this."""
     token = await self.bot.get_shared_api_tokens(
         "brawlstars"
     )  # todo check here if it's not saved, just make sure to save it using !set api brawlstars,token
     if token['token'] is None:
         print(
             "Brawl Stars token is not set, use [p]set api brawlstars token,YOURAPITOKEN"
         )
         raise ValueError
     self.brawl = brawlstats.Client(
         token['token'], is_async=False
     )  # Yes defining class attrs (self) outside __init__ is not a good practice but this is to get around the async issues
Пример #16
0
    async def handle(self, params, message, client):
        # 'params' is a list that contains the parameters that the command
        # expects to receive, t is guaranteed to have AT LEAST as many
        # parameters as specified in __init__
        # 'message' is the discord.py Message object for the command to handle
        # 'client' is the bot Client object
        user_name = str(message.author)
        player_id = str(params[0])
        brawl_client = brawlstats.Client(self.brawl_api)
        list_clubs = [
            line.rstrip()
            for line in open(os.path.join('config_files', 'tags.txt'))
        ]
        print(list_clubs)

        activeServers = list(client.guilds)[0]
        member_object = activeServers.get_member_named(user_name)
        variable_set = False

        for i in range(len(list_clubs)):
            if variable_set:
                break

            club = brawl_client.get_club((list_clubs[i]).upper())
            club_name = club.name
            club_info = club.members
            embed_msg = Embed(title=f'{club_name} Member', color=0x00ff00)

            for member in club_info:
                if player_id.lower() in (member.name.replace(" ", "")).lower():
                    embed_msg.add_field(name="Player Name",
                                        value=member.name,
                                        inline=True)
                    embed_msg.add_field(name="Player Tag",
                                        value=member.tag,
                                        inline=True)
                    embed_msg.add_field(name="Player Trophies",
                                        value=member.trophies,
                                        inline=True)
                    embed_msg.set_footer(text=user_name,
                                         icon_url=member_object.avatar_url)
                    variable_set = True
                    break

        if variable_set:
            await message.channel.send(embed=embed_msg)
        else:
            msg = f" The User {player_id} does not exist in the clubs"
            await message.channel.send(msg)
Пример #17
0
    async def handle(self, params, message, client):
        # 'params' is a list that contains the parameters that the command
        # expects to receive, t is guaranteed to have AT LEAST as many
        # parameters as specified in __init__
        # 'message' is the discord.py Message object for the command to handle
        # 'client' is the bot Client object
        user_name = str(message.author)
        activeServers = list(client.guilds)[0]
        member_object = activeServers.get_member_named(user_name)

        brawl_client = brawlstats.Client(self.brawl_api)
        brawl_database = database.SQL_Server()
        role = find(lambda r: r.name == 'Moderator', activeServers.roles)
        role_owner = find(lambda r: r.name == 'Owner', activeServers.roles)

        if role not in member_object.roles:
            if role_owner not in member_object.roles:
                await message.channel.send(
                    "You are not authorized to execute this command")
                return
        try:
            discord_id = str(message.mentions[0].id)
            message_author = str(message.author)
            mentioned_object = activeServers.get_member_named(message_author)
        except Exception:
            await message.channel.send(
                "Please, provide valid Discord Id")
            return

        if not brawl_database.information_present(discord_id):
            player_club = False
        else:
            player_info = brawl_client.get_player((brawl_database.view_information_user(discord_id)).upper())
            player_club = player_info.club.name

        embed_msg = Embed(title='User Information', color=0x00ff00)
        embed_msg.add_field(name="User Tag", value=brawl_database.view_information_user(discord_id), inline=False)
        embed_msg.add_field(name="User Club", value=player_club, inline=False)
        embed_msg.add_field(name="User Warning", value=brawl_database.return_userWarning(discord_id), inline=False)
        embed_msg.set_footer(text=discord_id, icon_url=mentioned_object.avatar_url)

        await message.channel.send(embed=embed_msg)
Пример #18
0
    async def handle(self, params, message, client):
        # 'params' is a list that contains the parameters that the command
        # expects to receive, t is guaranteed to have AT LEAST as many
        # parameters as specified in __init__
        # 'message' is the discord.py Message object for the command to handle
        # 'client' is the bot Client object
        brawl_client = brawlstats.Client(self.brawl_api)
        try:
            player_tag = str(params[0])
            print(player_tag)
            if player_tag[:1] != "#":
                raise Exception("Incorrect Player Tag. Be sure to add #")
            specific_user = brawl_client.get_profile(player_tag)
        except Exception:
            await client.send_message(message.channel,
                                      "Please, provide valid player tag")
            return

        brawl_database = database.SQL_Server()
        user_name = str(message.author)
        if user_name in brawl_database.return_allUsers(
        ) and brawl_database.information_present(user_name):
            await client.send_message(
                message.channel,
                "The User has already been linked to an account")
            return

        if player_tag in brawl_database.return_allPlayers():
            await client.send_message(
                message.channel,
                "The Tag has already been linked to other user")
            return

        brawl_database.insert_user(user_name, player_tag)
        brawl_database.save_database()
        msg = get_emoji(
            ":ok_hand:"
        ) + f" The User {player_tag} has been linked to {user_name} in the database!"

        await client.send_message(message.channel, msg)
Пример #19
0
    async def handle(self, params, message, client):
        # 'params' is a list that contains the parameters that the command
        # expects to receive, t is guaranteed to have AT LEAST as many
        # parameters as specified in __init__
        # 'message' is the discord.py Message object for the command to handle
        # 'client' is the bot Client object
        user_name = str(message.author)
        club_id = str(params[0])
        brawl_client = brawlstats.Client(self.brawl_api)
        list_clubs = [line.rstrip() for line in open(os.path.join('config_files', 'tags.txt'))]

        if "#" in club_id:
            club = brawl_client.get_club(club_id.upper())
            club_name = club.name
            club_info = club.members
        elif int(club_id) in range(len(list_clubs)):
            club_id = int(club_id) - 1
            club = brawl_client.get_club((list_clubs[club_id]).upper())
            club_name = club.name
            club_info = club.members

        activeServers = list(client.guilds)[0]
        member_object = activeServers.get_member_named(user_name)

        embed_msg = Embed(title=f'{club_name} Club List', color=0x00ff00)

        for i in range(5):
            try:
                embed_msg.add_field(name="Player Name", value=club_info[i].name, inline=True)
                embed_msg.add_field(name="Player Tag", value=club_info[i].tag, inline=True)
                embed_msg.add_field(name="Player Trophies", value=club_info[i].trophies, inline=True)
            except Exception:
                break

        embed_msg.set_footer(text=user_name, icon_url=member_object.avatar_url)

        await message.channel.send(embed=embed_msg)
Пример #20
0
    async def handle(self, params, message, client):
        # 'params' is a list that contains the parameters that the command
        # expects to receive, t is guaranteed to have AT LEAST as many
        # parameters as specified in __init__
        # 'message' is the discord.py Message object for the command to handle
        # 'client' is the bot Client object
        user_name = str(message.mentions[0].id)
        message_author = str(message.author)
        brawl_client = brawlstats.Client(self.brawl_api)
        brawl_database = database.SQL_Server()

        activeServers = list(client.guilds)[0]
        member_object = activeServers.get_member_named(message_author)

        if not brawl_database.information_present(user_name):
            await message.channel.send(
                                      "The User did not insert player tag")
            return

        brawl_tag = brawl_database.view_information_user(user_name)
        player_info = brawl_client.get_player(brawl_tag.upper())

        embed_msg = Embed(title='Brawl Stars Statistics', color=0x00ff00)
        embed_msg.add_field(name="Player Name", value=player_info.name, inline=False)
        embed_msg.add_field(name="Player Club", value=player_info.club.name, inline=False)
        embed_msg.add_field(name="Player Trophies", value=player_info.trophies, inline=False)
        embed_msg.add_field(name="Player PP Points", value=player_info.power_play_points, inline=False)

        embed_msg.add_field(name="3v3 Victories", value=player_info.x3vs3_victories, inline=False)
        embed_msg.add_field(name="Duo Victories", value=player_info.duo_victories, inline=False)
        embed_msg.add_field(name="Solo Victories", value=player_info.solo_victories, inline=False)
        embed_msg.add_field(name="Robo Rumble Time", value=player_info.best_robo_rumble_time, inline=False)
        embed_msg.add_field(name="Big Brawler Time", value=player_info.best_time_as_big_brawler, inline=False)

        embed_msg.set_footer(text=user_name, icon_url=member_object.avatar_url)

        await message.channel.send(embed=embed_msg)
Пример #21
0
    async def handle(self, params, message, client):
        # 'params' is a list that contains the parameters that the command
        # expects to receive, t is guaranteed to have AT LEAST as many
        # parameters as specified in __init__
        # 'message' is the discord.py Message object for the command to handle
        # 'client' is the bot Client object
        user_name = str(message.mentions[0].id)
        message_author = str(message.author)
        brawl_database = database.SQL_Server()

        # Get member object
        brawl_client = brawlstats.Client(self.brawl_api)
        activeServers = list(client.guilds)[0]
        member_object = activeServers.get_member_named(message_author)

        role = find(lambda r: r.name == 'Moderator', activeServers.roles)
        role_owner = find(lambda r: r.name == 'Owner', activeServers.roles)

        if role not in member_object.roles:
            if role_owner not in member_object.roles:
                await message.channel.send(
                    "You are not authorized to execute this command")
                return

        try:
            player_tag = str(params[0])
            if player_tag[:1] != "#":
                raise Exception("Incorrect Player Tag. Be sure to add #")
            specific_user = brawl_client.get_profile(player_tag)
        except Exception:
            await message.channel.send("Please, provide valid player tag")
            return

        if user_name in brawl_database.return_allUsers(
        ) and brawl_database.information_present(user_name):
            await message.channel.send(
                "The User has already been linked to an account")
            return

        if player_tag.upper() in brawl_database.return_allPlayers():
            await message.channel.send(
                "The Tag has already been linked to other user")
            return

        brawl_database.insert_user(user_name, player_tag)
        brawl_database.save_database()
        msg = get_emoji(
            ":ok_hand:"
        ) + f" The User {player_tag} has been linked to {str(message.mentions[0])} in the database!"

        member_object = activeServers.get_member_named(str(
            message.mentions[0]))
        name_club = specific_user.club.name.split()[-1]
        name_role = f"{name_club} Member"
        list_roles = []
        for role in activeServers.roles:
            list_roles.append(role.name)

        if name_role not in list_roles:
            role_permissions = Permissions(send_messages=False,
                                           read_messages=True)
            await member_object.guild.create_role(name=name_role,
                                                  permissions=role_permissions,
                                                  hoist=True,
                                                  colour=discord.Colour.blue())

        club_role = get(member_object.guild.roles, name=name_role)
        member_role = get(member_object.guild.roles, name="Member")
        unverified_role = [get(member_object.guild.roles, name="Unverified")]

        await member_object.add_roles(club_role)
        await member_object.add_roles(member_role)
        await member_object.remove_roles(*unverified_role)

        # Set nickname
        printable = set(string.printable)
        clean_name = ''.join(
            filter(lambda x: x in printable, specific_user.name))

        if member_object.name != clean_name or member_object.nick != clean_name:
            try:
                await member_object.edit(nick=clean_name)
            except errors.Forbidden:
                pass

        await message.channel.send(msg)
Пример #22
0
import brawlstats

client = brawlstats.Client('token')
# Do not post your token on a public github

player = client.get_profile('GGJVJLU2')
print(player.trophies)  # access attributes using dot.notation
print(player.solo_showdown_victories)  # access using snake_case instead of camelCase

club = player.get_club()
print(club.tag)
best_players = club.members[0:3]  # members sorted by trophies, gets best 3 players
for player in best_players:
    print(player.name, player.trophies)  # prints name and trophies

leaderboard = client.get_leaderboard('players', count=5)  # gets top 5 players
for player in leaderboard:
    print(player.name, player.position)

events = client.get_events()
print(events.current[0].map_name)

misc = client.get_misc()
print(misc.time_until_season_ends)

search = client.search_club('Cactus Bandits')
print(search[0].tag)
Пример #23
0
 def __init__(self, bot):
     self.bot = bot
     self.client = brawlstats.Client('token', is_async=True)
Пример #24
0
import asyncio

import brawlstats

# Do not post your token on a public github!
client = brawlstats.Client('token', is_async=True)


# await only works in an async loop
async def main():
    player = await client.get_profile('V2LQY9UY')
    print(player.trophies)  # access attributes using dot.notation
    print(player.solo_victories)  # use snake_case instead of camelCase

    club = await player.get_club()
    if club is not None:  # check if the player is in a club
        print(club.tag)
        members = await club.get_members()  # members sorted by trophies

        # gets best 5 players or returns all members if the club has less than 5 members
        index = max(5, len(members))
        best_players = members[:index]
        for player in best_players:
            print(player.name, player.trophies)  # prints name and trophies

    # get top 5 players in the world
    ranking = await client.get_rankings(ranking='players', limit=5)
    for player in ranking:
        print(player.name, player.rank)

    # get top 5 mortis players in the US
Пример #25
0
from os import getenv
import brawlstats
from jinja2 import Template

client = brawlstats.Client(getenv('BS_TOKEN'))

player = client.get_profile(getenv('PLAYER_TAG')) # get profile

brawlers = len(player.brawlers)

template = Template(open('sketch_template.ino', 'r').read()).render(
    player=player,
    brawlers=brawlers
) # render the jinja template with the data inside

open('sketch/sketch.ino', 'w+').write(template) # write to the file to be uploaded
Пример #26
0
import discord
from discord.ext import commands
import brawlstats
#client = discord.Client()
client= commands.Bot(command_prefix="!")
clientbs = brawlstats.Client('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiIsImtpZCI6IjI4YTMxOGY3LTAwMDAtYTFlYi03ZmExLTJjNzQzM2M2Y2NhNSJ9.eyJpc3MiOiJzdXBlcmNlbGwiLCJhdWQiOiJzdXBlcmNlbGw6Z2FtZWFwaSIsImp0aSI6IjM1NzBhODRjLTAxODctNGJjZi05YThiLWFlNDI0MWE0NmQ3YiIsImlhdCI6MTU5NzU5Mzk1MSwic3ViIjoiZGV2ZWxvcGVyLzhiMDgyMTJhLWVmYTItMGE2Mi0yMmQyLTY4YjgxYmY1MGUxOSIsInNjb3BlcyI6WyJicmF3bHN0YXJzIl0sImxpbWl0cyI6W3sidGllciI6ImRldmVsb3Blci9zaWx2ZXIiLCJ0eXBlIjoidGhyb3R0bGluZyJ9LHsiY2lkcnMiOlsiMTkwLjUyLjE5Ni4xODciLCI1NC44NC4xMzguNjAiLCI1NC44NC42Ni4xMDkiXSwidHlwZSI6ImNsaWVudCJ9XX0.h3vYdN8RYmzxGyblskngtplQ8_quNyddvMB6xJUGqkezlN-QAJ_QpMbnFcYiIgV0Bmf72ixEB6J-juJCp_OtzA')
lista=list()
contador=list()
contador.append(1)
@client.event
async def on_ready():
    print('We have logged in as {0.user}'.format(client))

@client.event
async def on_message(message):
    if message.author == client.user:
        return
    mytext = message.content
    myex = re.compile(r"(!torneo| )")
    final_str = re.sub(myex, '', mytext)
    x = final_str.split(",", 3)

    player1 = clientbs.get_profile(x[0])
    player2 = clientbs.get_profile(x[1])
    player3 = clientbs.get_profile(x[2])
    print(x)
    nlista = str(len(contador))

    if x[0] in lista:
        print('duplicado')
        await message.channel.send( player1.tag + "|  " + player1.name + " ya se encuentra en otro equipo")
Пример #27
0
 def __init__(self, token_path, tag):
     self.token = open(Path(token_path)).read().strip()
     self.client = brawlstats.Client(self.token)
     self.tag = tag
Пример #28
0
 def setUp(self):
     self.player_tag = 'GGJVJLU2'
     self.band_tag = 'QCGV8PG'
     self.client = brawlstats.Client(TOKEN, is_async=False, timeout=30)
Пример #29
0
 def __init__(self, bot):
     self.bot = bot
     self.client = brawlstats.Client(bot.config.bsapi, is_async=True)
Пример #30
0
 def __init__(self, token: str):
     self.client = brawlstats.Client(token, is_async=True)