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 riotwatcher import ApiError
|
||||||
from emoji import demojize
|
from emoji import demojize
|
||||||
from twitch import TwitchClient
|
from twitch import TwitchClient
|
||||||
import gc
|
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix='$')
|
bot = commands.Bot(command_prefix='$')
|
||||||
twitch_client = TwitchClient(client_id = id_twitch, oauth_token = token_twitch)
|
twitch_client = TwitchClient(client_id = id_twitch, oauth_token = token_twitch)
|
||||||
@@ -51,9 +50,12 @@ class ChatObj(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@twitch.after_loop
|
@twitch.after_loop
|
||||||
async def after_slow_count():
|
async def after_twitch():
|
||||||
self.sock.shutdown(1)
|
self.sock.shutdown(1)
|
||||||
|
try:
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
def check_user(name):
|
def check_user(name):
|
||||||
user = twitch_client.users.translate_usernames_to_ids([name])
|
user = twitch_client.users.translate_usernames_to_ids([name])
|
||||||
@@ -89,9 +91,10 @@ async def chat_stop(ctx):
|
|||||||
if chan in list(chats):
|
if chan in list(chats):
|
||||||
chats[chan].twitch.stop()
|
chats[chan].twitch.stop()
|
||||||
del chats[chan]
|
del chats[chan]
|
||||||
await ctx.send('```The chat was successfully stopped !```')
|
message = '```The chat was successfully stopped !```'
|
||||||
else:
|
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()
|
@bot.command()
|
||||||
async def rank(ctx, arg, argF=None):
|
async def rank(ctx, arg, argF=None):
|
||||||
@@ -126,7 +129,7 @@ async def issou(ctx, arg1:discord.User=None):
|
|||||||
voice_channel = None
|
voice_channel = None
|
||||||
|
|
||||||
channel = None
|
channel = None
|
||||||
if voice_channel != None:
|
if voice_channel is not None:
|
||||||
channel = voice_channel.name
|
channel = voice_channel.name
|
||||||
vc = await voice_channel.connect()
|
vc = await voice_channel.connect()
|
||||||
vc.play(discord.FFmpegPCMAudio('issou.mp3'))
|
vc.play(discord.FFmpegPCMAudio('issou.mp3'))
|
||||||
|
|||||||
+2
-2
@@ -1,15 +1,15 @@
|
|||||||
from riotwatcher import LolWatcher
|
from riotwatcher import LolWatcher
|
||||||
from private import token_riot
|
from private import token_riot
|
||||||
# import pandas as pd
|
|
||||||
|
|
||||||
watcher = LolWatcher(token_riot)
|
watcher = LolWatcher(token_riot)
|
||||||
region = 'EUW1'
|
region = 'EUW1'
|
||||||
|
|
||||||
def rank_track(player):
|
def rank_track(player):
|
||||||
ranked_stats = watcher.league.by_summoner(region, player['id'])
|
ranked_stats = watcher.league.by_summoner(region, player['id'])
|
||||||
|
|
||||||
if not ranked_stats:
|
if not ranked_stats:
|
||||||
return 'Unranked cette saison.'
|
return 'Unranked cette saison.'
|
||||||
else:
|
|
||||||
liste = []
|
liste = []
|
||||||
for infos in ranked_stats:
|
for infos in ranked_stats:
|
||||||
if infos['queueType'] == 'RANKED_SOLO_5x5':
|
if infos['queueType'] == 'RANKED_SOLO_5x5':
|
||||||
|
|||||||
Reference in New Issue
Block a user