コード例 #1
0
ファイル: cr.py プロジェクト: itzbananauwu/dat-banana-bot
 def __init__(self, bot):
     self.bot = bot
     with open('data/apikeys.json') as f:
         lol = json.load(f)
         self.token = lol['crapi']
     self.client = clashroyale.Client(token=self.token, is_async=True)
     self.cards = [
         'Ice Wizard', 'Hunter', 'Dart Goblin', 'Balloon', 'Skeleton Army',
         'Royal Giant', 'Battle Ram', 'Minions', 'Bandit', 'Arrows',
         'Mega Knight', 'Baby Dragon', 'Heal', 'Witch', 'Archers',
         'Barbarians', 'Wizard', 'Rage', 'Guards', 'Giant Skeleton',
         'Skeletons', 'Inferno Tower', 'Spear Goblins', 'Furnace',
         'Cannon Cart', 'P.E.K.K.A', 'Bomber', 'Sparky', 'Ice Golem',
         'Graveyard', 'Clone', 'Poison', 'Lightning', 'Cannon', 'Knight',
         'Royal Ghost', 'Tesla', 'Dark Prince', 'Bomb Tower',
         'Skeleton Barrel', 'Prince', 'Electro Wizard', 'Mega Minion',
         'Musketeer', 'Giant', 'Mirror', 'Bowler', 'Mortar', 'Lava Hound',
         'Rocket', 'Tornado', 'Night Witch', 'Goblin Hut', 'Fire Spirits',
         'Tombstone', 'Princess', 'Barbarian Hut', 'Goblins', 'Valkyrie',
         'The Log', 'Freeze', 'Inferno Dragon', 'Goblin Barrel',
         'Lumberjack', 'Three Musketeers', 'Miner', 'X-Bow', 'Ice Spirit',
         'Flying Machine', 'Executioner', 'Zappies', 'Elixir Collector',
         'Golem', 'Magic Archer', 'Barbarian Barrel', 'Rascals',
         'Mini P.E.K.K.A', 'Hog Rider', 'Minion Horde', 'Fireball',
         'Goblin Gang', 'Elite Barbarians', 'Bats', 'Zap'
     ]
コード例 #2
0
ファイル: clashroyale.py プロジェクト: oriolwonga/RemixBot
 def __init__(self, bot):
     self.bot = bot
     self.client = clashroyale.Client(
         # token=bot.auth.get('CR-API'),
         token=os.environ.get('cr-api'),
         is_async=True,
         cache_fp='cache.db')
コード例 #3
0
ファイル: clashroyale.py プロジェクト: NyanPikachu/RemixBot
 def __init__(self, bot):
     self.bot = bot
     with open('./data/auths.json') as f:
         auth = json.load(f)
         self.token = auth.get('CR-API')
     self.client = clashroyale.Client(token=self.token,
                                      is_async=True,
                                      cache_fp='cache.db')
コード例 #4
0
ファイル: clashroyale.py プロジェクト: jwilde35/selfbot.py
 def __init__(self, bot):
     self.bot = bot
     with open('data/options.json') as f:
         options = json.load(f)
         if 'CR_TAG' not in options:
             self.tag = None
         else:
             self.tag = options['CR_TAG']
     self.client = clashroyale.Client()
コード例 #5
0
ファイル: profile.py プロジェクト: Right3r/selfstats
 def __init__(self, bot):
     self.bot = bot
     with open('data/config.json') as f:
         config = json.load(f)
         if 'TAG' not in config:
             tag = None
         else:
             tag = config['TAG']
     self.tag = os.environ.get('TAG') or tag
     self.client = clashroyale.Client("0ef94cfa74974bd5bf8ba09c809df0d313d562607da64482b85761dfbc7babec", is_async=True)
コード例 #6
0
ファイル: cr.py プロジェクト: IslaWoof/PikaBot
 async def crprofile(self, ctx, tag: str=None):
     '''Gets your Clash Royale Profile using Tag!'''
     if not tag:
         return await ctx.send('Please provide a tag for this command to work `Usage : $crprofile [tag]`. saving tags will be implemented soon')
     token = os.environ.get("CRTOKEN")
     client = clashroyale.Client(token, is_async=True)
     profile = await client.get_player(tag)
     clan = await profile.get_clan()
     em = discord.Embed(color=discord.Color.gold())
     em.title = profile.name
     em.description = f'{tag}\'s info'
     await profile.refresh()
     em.add_field(name='Favourite card:', value=profile.stats.favorite_card.name)
     await ctx.send(embed=em)
コード例 #7
0
ファイル: async.py プロジェクト: sayeghr/clashroyale
async def main():
    client = clashroyale.Client(token, is_async=True)  # is_async=True argument
    # EVERYTHING IS THE SAME, BUT WITH await's
    profile = await client.get_player('CY8G8VVQ')
    print(repr(profile))
    print(profile.name)
    print(profile.league_statistics)
    await profile.refresh()
    print(profile.stats.favorite_card.name)
    clan = await profile.get_clan()
    print(clan)
    print(clan.clan_chest)
    await clan.refresh()
    member = clan.members[0]
    assert member.clan is clan
    assert member.rank == 1
    full_player = await member.get_profile()
    clans = await client.get_clans('2CCCP',
                                   '2U2GGQJ')  # indefinite amount of arguments
    for clan in clans:
        print(clan.members[0])
    client.close()
コード例 #8
0
 def __init__(self, bot):
     self.bot = bot
     with open('data/apikeys.json') as f:
         lol = json.load(f)
         self.token = lol['crapi']
     self.client = clashroyale.Client(token=self.token, is_async=True)
コード例 #9
0
ファイル: cr.py プロジェクト: my-rep/kala
 def __init__(self, bot):
     self.bot = bot
     self.token = os.environ.get('CRAPI')
     self.client = clashroyale.Client(token=self.token, is_async=True)
コード例 #10
0
ファイル: cache.py プロジェクト: sayeghr/clashroyale
import clashroyale
import os

c = clashroyale.Client(
    token=os.getenv('crtoken'),
    cache_fp='cache.db',
    cache_expires=10 # Seconds before client should request from api again.
    )

for _ in range(100):
    model = c.get_top_clans()
    print(model, 
          model.cached, # Bool indicating whether or not the data is cached.
          model.last_updated) # Datetime for the time the data was last updated from the API.

# Finished very quickly due to caching!
コード例 #11
0
 def __init__(self, bot):
     self.client = clashroyale.Client(os.environ['CR_TOKEN'], is_async=True)
コード例 #12
0
 def __init__(self, *args, **kwargs):
     self.clashroyale_client = clashroyale.Client(TOKEN, timeout=5)
     super().__init__(*args, **kwargs)
コード例 #13
0
 def __init__(self, bot):
     self.bot = bot
     self.client = clashroyale.Client(
         "49c21c37d3da47ea89deaa90528322730c4343230e6b4184a707af262d386d74",
         is_async=True)
コード例 #14
0
ファイル: cr.py プロジェクト: itzbananauwu/datbananabotheroku
 def __init__(self, bot):
     self.bot = bot
     self.client = clashroyale.Client(token=os.environ.get('crapi'),
                                      is_async=True)
     self.db = self.bot.db