Skip to content

Commit

Permalink
switch api
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTheDev committed Dec 19, 2024
1 parent 1710c6d commit 9faee1b
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions classes/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ async def webhook_send(self, webhook: disnake.Webhook, **kwargs):

async def get_screenshot(self, player: coc.Player):
tag = player.tag.replace('#', '')
url = f'https://api.clashking.xyz/ss/{tag}/706149153431879760'
url = f'https://api.clashk.ing/ss/{tag}/706149153431879760'

async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=5 * 60)) as session:
async with session.get(url) as response:
Expand Down Expand Up @@ -564,7 +564,7 @@ async def get_players(
}
data = [f"players/{t.replace('#', '%23')}" for t in tag_set]
async with aiohttp.ClientSession() as session:
async with session.post('https://api.clashking.xyz/ck/bulk', json=data, headers=headers) as response:
async with session.post('https://api.clashk.ing/ck/bulk', json=data, headers=headers) as response:
data = await response.read()
player_data: dict = ujson.loads(data)
players.extend(
Expand Down
4 changes: 2 additions & 2 deletions classes/tickets.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async def send_log(
bytes_=io.BytesIO(transcript.encode()),
id=f'transcript-{thread_channel.id}',
)
link = f'https://api.clashking.xyz/renderhtml?url={link}'
link = f'https://api.clashk.ing/renderhtml?url={link}'
buttons = disnake.ui.ActionRow()
buttons.append_item(disnake.ui.Button(label=f'Thread Transcript', url=link))

Expand All @@ -151,7 +151,7 @@ async def send_log(
bytes_=io.BytesIO(transcript.encode()),
id=f'transcript-{ticket_channel.id}',
)
link = f'https://api.clashking.xyz/renderhtml?url={link}'
link = f'https://api.clashk.ing/renderhtml?url={link}'
buttons.append_item(disnake.ui.Button(label=f'Channel Transcript', url=link))
components = [buttons]

Expand Down
2 changes: 1 addition & 1 deletion commands/embeds/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def reverse_encoding(embed_dict: dict):


async def shorten_link(url: str):
api_url = 'https://api.clashking.xyz/shortner'
api_url = 'https://api.clashk.ing/shortner'
params = {'url': url}
async with aiohttp.ClientSession() as session:
async with session.get(api_url, params=params) as response:
Expand Down
2 changes: 1 addition & 1 deletion commands/leaderboards/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ async def image_board(
'title': re.sub('[*_`~/"#]', '', f'{(clan or server).name} Top {limit} {type.title()}'),
}
async with aiohttp.ClientSession(json_serialize=ujson.dumps) as session:
async with session.post('https://api.clashking.xyz/table', json=data) as response:
async with session.post('https://api.clashk.ing/table', json=data) as response:
link = await response.json()
await session.close()
return f'{link.get("link")}?t={int(pend.now(tz=pend.UTC).timestamp())}'
Expand Down
2 changes: 1 addition & 1 deletion commands/other/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ async def stat(self, ctx: disnake.ApplicationCommandInteraction):

async with aiohttp.ClientSession() as session:
try:
async with session.get("https://api.clashking.xyz/global/counts") as response:
async with session.get("https://api.clashk.ing/global/counts") as response:
if response.status == 200:
api_data = await response.json()
else:
Expand Down
4 changes: 2 additions & 2 deletions commands/rosters/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ async def roster_restrict(
base64_uuid = base64.urlsafe_b64encode(uuid_bytes).rstrip(b'=')
url_safe_uuid = base64_uuid.decode('utf-8')
await self.bot.rosters.update_one({'$and': [{'server_id': ctx.guild.id}, {'alias': roster}]}, {'$set': {'token': url_safe_uuid}})
await ctx.send(content=f'Edit your roster here -> https://api.clashking.xyz/roster/?token={url_safe_uuid}', ephemeral=True)
await ctx.send(content=f'Edit your roster here -> https://api.clashk.ing/roster/?token={url_safe_uuid}', ephemeral=True)

@roster.sub_command(name='list', description='List of rosters on this server')
@commands.check_any(commands.has_permissions(manage_guild=True), check_commands())
Expand Down Expand Up @@ -823,7 +823,7 @@ async def on_button_click(self, ctx: disnake.MessageInteraction):
base64_uuid = base64.urlsafe_b64encode(uuid_bytes).rstrip(b'=')
url_safe_uuid = base64_uuid.decode('utf-8')
await self.bot.rosters.update_one({'$and': [{'server_id': ctx.guild.id}, {'alias': roster.alias}]}, {'$set': {'token': url_safe_uuid}})
await ctx.send(content=f'Edit your roster here -> https://api.clashking.xyz/roster/?token={url_safe_uuid}', ephemeral=True)
await ctx.send(content=f'Edit your roster here -> https://api.clashk.ing/roster/?token={url_safe_uuid}', ephemeral=True)

elif 'Signup_' in str(ctx.data.custom_id):
alias = str(ctx.data.custom_id).split('_')[1]
Expand Down
2 changes: 1 addition & 1 deletion commands/ticketing/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ async def ticket_account_apply(
base64_uuid = base64.urlsafe_b64encode(uuid_bytes).rstrip(b'=')
url_safe_uuid = base64_uuid.decode('utf-8')
await self.bot.tickets.update_one({'$and': [{'server_id': ctx.guild.id}, {'name': ticket_panel}]}, {'$set': {'token': url_safe_uuid}})
await ctx.send(content=f'Edit your roster here -> https://api.clashking.xyz/ticketing?token={url_safe_uuid}', ephemeral=True)
await ctx.send(content=f'Edit your roster here -> https://api.clashk.ing/ticketing?token={url_safe_uuid}', ephemeral=True)

@ticket.sub_command(
name='apply-rules',
Expand Down
4 changes: 2 additions & 2 deletions commands/war/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ async def main_war_page(bot: CustomClient, war: coc.ClanWar, war_league=None, is
color = disnake.Color.green()

embed = disnake.Embed(description=f"[**{war.clan.name}**]({war.clan.share_link})", color=color)
time_line = f'[*View War Timeline*](https://api.clashking.xyz/timeline/{war.clan.tag.replace("#", "%23")}/{war.end_time.raw_time})\n'
time_line = f'[*View War Timeline*](https://api.clashk.ing/timeline/{war.clan.tag.replace("#", "%23")}/{war.end_time.raw_time})\n'
if not is_previous:
time_line = f'[*View War Timeline*](https://api.clashking.xyz/timeline/{war.clan.tag.replace("#", "%23")})\n'
time_line = f'[*View War Timeline*](https://api.clashk.ing/timeline/{war.clan.tag.replace("#", "%23")})\n'
embed.add_field(
name=f"**War Against**",
value=f"[**{war.opponent.name} ({war.opponent.tag})**]({war.opponent.share_link})\n­\n",
Expand Down
2 changes: 1 addition & 1 deletion utility/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def calculate_shard_distribution(total_shards, total_clusters):

def create_config() -> 'Config':
BOT_TOKEN = getenv('BOT_TOKEN')
bot_config_url = 'https://api.clashking.xyz/bot/config'
bot_config_url = 'https://api.clashk.ing/bot/config'
bot_config = requests.get(bot_config_url, timeout=5, headers={'bot-token': BOT_TOKEN}).json()
config = Config(remote_settings=bot_config)
config.bot_token = BOT_TOKEN
Expand Down

0 comments on commit 9faee1b

Please sign in to comment.