diff --git a/README.md b/README.md index 248b740..e4bb404 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Github Stars

->Risitas is a Discord bot that can connect your twitch chat to a discord channel in real time, make laugh your friends by playing the "Issou !" meme on command in a voice channel and even give you some League Of Legend stats. +>Risitas is a Discord bot that can connect your twitch chat to a discord channel in real time, make laugh your friends by playing the "Issou !" meme on command in a voice channel.
@@ -20,14 +20,6 @@
-![](assets/lol_rank.png) - -
- -![](assets/lol_lastgame.png) - -
- ![](assets/osu_profile.png)
@@ -58,23 +50,6 @@ $chat_stop This command allows you to stop the active twitch chat in the channel. -## League of Legend - - -### **lol_rank** -``` -$lol_rank {lol_username} -``` -This command will display a message with the current League of Legend rank of the EUW account you ask for. Make sure to use quotes if there is spaces in the LoL username. - - -### **lol_lastgame** -``` -$lol_lastgame {lol_username} -``` -This command will display a summary (which team won, players, damages, kda...) of the last League of Legend game of the EUW account you ask for. - - ## Osu! @@ -133,7 +108,7 @@ Socket related var : 👤 **Florian Sylvain** -* Website: https://andhefallen.site/ +* Website: https://floriansylvain.fr/ * Github: [@Floriansylvain](https://github.com/Floriansylvain)
diff --git a/assets/lol_lastgame.png b/assets/lol_lastgame.png deleted file mode 100644 index fc30a0d..0000000 Binary files a/assets/lol_lastgame.png and /dev/null differ diff --git a/assets/lol_rank.png b/assets/lol_rank.png deleted file mode 100644 index ad05fed..0000000 Binary files a/assets/lol_rank.png and /dev/null differ diff --git a/python/api_riot.py b/python/api_riot.py deleted file mode 100644 index 5c3aebe..0000000 --- a/python/api_riot.py +++ /dev/null @@ -1,56 +0,0 @@ -from datetime import datetime, timedelta -from riotwatcher import LolWatcher, ApiError -from private import TOKEN_RIOT - -WATCHER = LolWatcher(TOKEN_RIOT) -REGION = 'EUW1' - - -def what_player(name): - try: - return WATCHER.summoner.by_name(REGION, name) - except ApiError: - return 0 - - -def rank_track(player): - ranked_stats = WATCHER.league.by_summoner(REGION, player['id']) - if not ranked_stats: - return 'Unranked cette saison.' - liste = [] - for infos in ranked_stats: - if infos['queueType'] == 'RANKED_SOLO_5x5': - what_rank = 'Solo Queue' - elif infos['queueType'] == 'RANKED_FLEX_SR': - what_rank = 'Flexible' - liste.append([what_rank, infos['tier'], infos['rank'], - infos['leaguePoints'], infos['wins'], infos['losses']]) - return liste - - -def last_match(player): - matches = WATCHER.match.matchlist_by_account('EUW1', player['accountId']) - recent_match = matches['matches'][0] - match_detail = WATCHER.match.by_id('EUW1', recent_match['gameId']) - lst = [[], [[], [], [], []]] - for participants, details in zip(match_detail['participants'], - match_detail['participantIdentities']): - lst[0].append([details['player']['summonerName'], - participants['stats']['totalDamageDealtToChampions'], - participants['stats']['kills'], - participants['stats']['deaths'], - participants['stats']['assists']]) - - for team in match_detail['teams']: - lst[1][0].append(team['win']) - lst[1][1].append(team['firstBlood']) - lst[1][2].append(team['firstTower']) - lst[1][3].append(team['firstDragon']) - - time_stamp = str(match_detail['gameCreation'])[:-3] - date_time = datetime.fromtimestamp(int(time_stamp)).date() - - lst.append(str(date_time)) - lst.append(str(timedelta(seconds=match_detail['gameDuration']))) - - return lst diff --git a/python/ext/cmd_lol.py b/python/ext/cmd_lol.py deleted file mode 100644 index a78c19a..0000000 --- a/python/ext/cmd_lol.py +++ /dev/null @@ -1,77 +0,0 @@ -import discord -from discord.ext import commands -from api_riot import rank_track, what_player, last_match - -CD_LOLRANK = 0 - - -class LolCmds(commands.Cog, name='League of Legend commands'): - def __init__(self, bot): - self.bot = bot - - @commands.command(ignore_extra=False) - @commands.cooldown(1, 2, commands.BucketType.user) - async def lol_rank(self, ctx, invocator_name): - player = what_player(invocator_name) - if player != 0: - ranks = rank_track(player) - embed = discord.Embed(title=invocator_name, url='https://bit.ly/3biTekM') - embed.set_thumbnail(url='http://ddragon.leagueoflegends.com/cdn/11.2.1/img/profileicon/' + - str(player['profileIconId']) + '.png') - embed.set_author(name='League Of Legend - Rank', url='https://euw.leagueoflegends.com/en-gb/', - icon_url='https://static.wikia.nocookie.net/leagueoflegends/images/0/07/' + - 'League_of_Legends_icon.png/revision/latest?cb=20191018194326') - if isinstance(ranks, list): - for rank_s in ranks: - embed.add_field(name=rank_s[0], value=str(rank_s[1]) + ' ' + - str(rank_s[2]) + ' ' + str(rank_s[3]) + ' LP\n' + - str(rank_s[4]) + 'W/' + str(rank_s[5]) + - 'L', inline=False) - else: - embed.description = ranks - await ctx.send(embed=embed) - else: - await ctx.send('The username you entered is unknown.') - - @commands.command(ignore_extra=False) - @commands.cooldown(1, 2, commands.BucketType.user) - async def lol_lastgame(self, ctx, invocator_name): - player = what_player(invocator_name) - if player != 0: - lst = last_match(player) - maximum = lst[0][0][1] - for stat in lst[0]: - if stat[1] > maximum: - maximum = stat[1] - tab, players, kda = [], [], [] - for stat in lst[0]: - pourcent = round(100*stat[1]/maximum) - equals = int(round(float(pourcent)/3.3)) - tab.append('[' + '=' * equals + ' ' * (30 - equals) + ']\n') - players.append(stat[0][:15] + '\n') - kda.append(str(stat[2]) + '/' + str(stat[3]) + '/' + str(stat[4]) + '\n') - embed = discord.Embed(title=invocator_name, url='https://bit.ly/3biTekM', - description='Date: ' + lst[2] + '\nLength: ' + lst[3]) - embed.set_author(name='League Of Legend - Last Game', url='https://euw.leagueoflegends.com/en-gb/', - icon_url='https://static.wikia.nocookie.net/leagueoflegends/images/0/07/' + - 'League_of_Legends_icon.png/revision/latest?cb=20191018194326') - await ctx.send(embed=embed) - for i in range(0, -2, -1): - embed = discord.Embed(title='Team 1' if not i else 'Team 2', - colour=discord.Colour.green() if lst[1][0][i] == 'Win' else discord.Colour.red(), - description=(':drop_of_blood: First blood\n' if len(lst[1][1]) != 0 and lst[1][1][i] else '') + - (':tokyo_tower: First tower\n' if len(lst[1][2]) != 0 and lst[1][2][i] else '') + - (':dragon_face: First dragon\n' if len(lst[1][3]) != 0 and lst[1][3][i] else '')) - embed.add_field(name='Players', - value='```\n' + ''.join(players[:5] if not i else players[5:]) + '```') - embed.add_field(name='Total damage dealt to champions', - value='```\n' + ''.join(tab[:5] if not i else tab[5:]) + '```') - embed.add_field(name='K / D / A', - value='```\n' + ''.join(kda[:5] if not i else kda[5:]) + '```') - await ctx.send(embed=embed) - else: - await ctx.send('The username you entered is unknown.') - - -def setup(bot): - bot.add_cog(LolCmds(bot)) diff --git a/python/ext/cmd_other.py b/python/ext/cmd_other.py index 4cf21d7..e07f01d 100644 --- a/python/ext/cmd_other.py +++ b/python/ext/cmd_other.py @@ -1,7 +1,7 @@ import asyncio import discord from discord.ext import commands - +from miscellaneous import spellchecker class OtherCmds(commands.Cog, name='Other commands'): def __init__(self, bot): diff --git a/python/main.py b/python/main.py index 1c63aa9..68ff715 100644 --- a/python/main.py +++ b/python/main.py @@ -10,7 +10,7 @@ from errors import errors print('Loading started') bot = commands.Bot(command_prefix='$') -startup_extensions = ["cmd_other", "cmd_lol", "cmd_osu", "cmd_twitch", "cmd_owner"] +startup_extensions = ["cmd_other", "cmd_osu", "cmd_twitch", "cmd_owner"] startup_date = datetime.now() time_s = time()