mirror of
https://github.com/Floriansylvain/Risitas_BOT.git
synced 2026-08-19 11:43:16 +02:00
💩 - Removed commands related to a shitty game :D
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
<img alt="Github Stars" src="https://img.shields.io/github/stars/Floriansylvain/Risitas_BOT?style=social">
|
<img alt="Github Stars" src="https://img.shields.io/github/stars/Floriansylvain/Risitas_BOT?style=social">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
>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.
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -20,14 +20,6 @@
|
|||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
<br>
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -58,23 +50,6 @@ $chat_stop
|
|||||||
This command allows you to stop the active twitch chat in the channel.
|
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!
|
## Osu!
|
||||||
|
|
||||||
|
|
||||||
@@ -133,7 +108,7 @@ Socket related var :
|
|||||||
|
|
||||||
👤 **Florian Sylvain**
|
👤 **Florian Sylvain**
|
||||||
|
|
||||||
* Website: https://andhefallen.site/
|
* Website: https://floriansylvain.fr/
|
||||||
* Github: [@Floriansylvain](https://github.com/Floriansylvain)
|
* Github: [@Floriansylvain](https://github.com/Floriansylvain)
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 64 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 47 KiB |
@@ -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
|
|
||||||
@@ -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))
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import discord
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
from miscellaneous import spellchecker
|
||||||
|
|
||||||
class OtherCmds(commands.Cog, name='Other commands'):
|
class OtherCmds(commands.Cog, name='Other commands'):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ from errors import errors
|
|||||||
print('Loading started')
|
print('Loading started')
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix='$')
|
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()
|
startup_date = datetime.now()
|
||||||
time_s = time()
|
time_s = time()
|
||||||
|
|||||||
Reference in New Issue
Block a user