🎨 - Some cleaning

This commit is contained in:
Florian SYLVAIN
2021-02-04 17:00:46 +01:00
parent 30c86facf1
commit 94ada7b487
2 changed files with 4 additions and 8 deletions
+3 -7
View File
@@ -1,8 +1,4 @@
import asyncio import asyncio, socket, re, discord
import socket
import re
import discord
from time import sleep
from discord.ext import tasks, commands from discord.ext import tasks, commands
from private import * from private import *
from riot_api import rank_track, watcher, region from riot_api import rank_track, watcher, region
@@ -39,7 +35,7 @@ def chat_init(twitch_chan):
def get_msg(): def get_msg():
try: try:
resp = SOCK.recv(2048).decode('utf-8') resp = SOCK.recv(2048).decode('utf-8')
except: except socket.error:
resp = '' resp = ''
if resp.startswith('PING'): if resp.startswith('PING'):
@@ -69,7 +65,7 @@ async def rank(ctx, arg, argF=None):
if argF is None: if argF is None:
try: try:
player = watcher.summoner.by_name(region, arg) player = watcher.summoner.by_name(region, arg)
ranks = rank_track(arg, player) ranks = rank_track(player)
embed = discord.Embed(title = arg, url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ") embed = discord.Embed(title = arg, url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ")
embed.set_thumbnail(url = "http://ddragon.leagueoflegends.com/cdn/11.2.1/img/profileicon/" + str(player['profileIconId']) + ".png") embed.set_thumbnail(url = "http://ddragon.leagueoflegends.com/cdn/11.2.1/img/profileicon/" + str(player['profileIconId']) + ".png")
if type(ranks) is list: if type(ranks) is list:
+1 -1
View File
@@ -5,7 +5,7 @@ from private import token_riot
watcher = LolWatcher(token_riot) watcher = LolWatcher(token_riot)
region = 'EUW1' region = 'EUW1'
def rank_track(nickname, 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.'