mirror of
https://github.com/Floriansylvain/Risitas_BOT.git
synced 2026-08-19 11:43:16 +02:00
🎨 - Some cleaning here and there
This commit is contained in:
@@ -5,7 +5,6 @@ from riot_api import rank_track, watcher, region
|
||||
from riotwatcher import ApiError
|
||||
from emoji import demojize
|
||||
from twitch import TwitchClient
|
||||
import gc
|
||||
|
||||
bot = commands.Bot(command_prefix='$')
|
||||
twitch_client = TwitchClient(client_id = id_twitch, oauth_token = token_twitch)
|
||||
@@ -51,9 +50,12 @@ class ChatObj(object):
|
||||
pass
|
||||
|
||||
@twitch.after_loop
|
||||
async def after_slow_count():
|
||||
async def after_twitch():
|
||||
self.sock.shutdown(1)
|
||||
self.sock.close()
|
||||
try:
|
||||
self.sock.close()
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
def check_user(name):
|
||||
user = twitch_client.users.translate_usernames_to_ids([name])
|
||||
@@ -89,9 +91,10 @@ async def chat_stop(ctx):
|
||||
if chan in list(chats):
|
||||
chats[chan].twitch.stop()
|
||||
del chats[chan]
|
||||
await ctx.send('```The chat was successfully stopped !```')
|
||||
message = '```The chat was successfully stopped !```'
|
||||
else:
|
||||
await ctx.send('```There is no active chat in this channel.```')
|
||||
message = '```There is no active chat in this channel.```'
|
||||
await ctx.send(message)
|
||||
|
||||
@bot.command()
|
||||
async def rank(ctx, arg, argF=None):
|
||||
@@ -126,7 +129,7 @@ async def issou(ctx, arg1:discord.User=None):
|
||||
voice_channel = None
|
||||
|
||||
channel = None
|
||||
if voice_channel != None:
|
||||
if voice_channel is not None:
|
||||
channel = voice_channel.name
|
||||
vc = await voice_channel.connect()
|
||||
vc.play(discord.FFmpegPCMAudio('issou.mp3'))
|
||||
|
||||
+10
-10
@@ -1,20 +1,20 @@
|
||||
from riotwatcher import LolWatcher
|
||||
from private import token_riot
|
||||
# import pandas as pd
|
||||
|
||||
watcher = LolWatcher(token_riot)
|
||||
region = 'EUW1'
|
||||
|
||||
def rank_track(player):
|
||||
ranked_stats = watcher.league.by_summoner(region, player['id'])
|
||||
|
||||
if not ranked_stats:
|
||||
return 'Unranked cette saison.'
|
||||
else:
|
||||
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
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user