mirror of
https://github.com/Floriansylvain/Risitas_BOT.git
synced 2026-08-19 11:43:16 +02:00
🥅 - Commands errors are now treaded in a better way.
This commit is contained in:
+55
-73
@@ -11,86 +11,68 @@ class LolCmds(commands.Cog, name='League of Legend commands'):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(ignore_extra=False)
|
||||||
@commands.cooldown(1, 2, commands.BucketType.user)
|
@commands.cooldown(1, 2, commands.BucketType.user)
|
||||||
async def lol_rank(self, ctx, invocator_name, x=None):
|
async def lol_rank(self, ctx, invocator_name):
|
||||||
global CD_LOLRANK
|
player = what_player(invocator_name)
|
||||||
CD_LOLRANK = 0
|
if player != 0:
|
||||||
if x is None:
|
ranks = rank_track(player)
|
||||||
player = what_player(invocator_name)
|
embed = discord.Embed(title=invocator_name, url='https://bit.ly/3biTekM')
|
||||||
if player != 0:
|
embed.set_thumbnail(url='http://ddragon.leagueoflegends.com/cdn/11.2.1/img/profileicon/' + str(
|
||||||
ranks = rank_track(player)
|
player['profileIconId']) + '.png')
|
||||||
embed = discord.Embed(title=invocator_name, url='https://bit.ly/3biTekM')
|
embed.set_author(name='League Of Legend - Rank', url='https://euw.leagueoflegends.com/en-gb/',
|
||||||
embed.set_thumbnail(url='http://ddragon.leagueoflegends.com/cdn/11.2.1/img/profileicon/' + str(
|
icon_url='https://static.wikia.nocookie.net/leagueoflegends/images/0/07/' +
|
||||||
player['profileIconId']) + '.png')
|
'League_of_Legends_icon.png/revision/latest?cb=20191018194326')
|
||||||
embed.set_author(name='League Of Legend - Rank', url='https://euw.leagueoflegends.com/en-gb/',
|
if isinstance(ranks, list):
|
||||||
icon_url='https://static.wikia.nocookie.net/leagueoflegends/images/0/07/' +
|
for rank_s in ranks:
|
||||||
'League_of_Legends_icon.png/revision/latest?cb=20191018194326')
|
embed.add_field(name=rank_s[0], value=str(rank_s[1]) + ' ' + str(rank_s[2]) + ' ' + str(
|
||||||
if isinstance(ranks, list):
|
rank_s[3]) + ' LP' + '\n' + str(rank_s[4]) + 'W/' + str(rank_s[5]) + 'L', inline=False)
|
||||||
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:
|
else:
|
||||||
await ctx.send('The username you entered is unknown.')
|
embed.description = ranks
|
||||||
|
await ctx.send(embed=embed)
|
||||||
else:
|
else:
|
||||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
await ctx.send('The username you entered is unknown.')
|
||||||
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(ignore_extra=False)
|
||||||
async def lol_lastgame(self, ctx, invocator_name, x=None):
|
async def lol_lastgame(self, ctx, invocator_name):
|
||||||
if x is None:
|
player = what_player(invocator_name)
|
||||||
player = what_player(invocator_name)
|
if player != 0:
|
||||||
if player != 0:
|
lst = last_match(player)
|
||||||
lst = last_match(player)
|
lst_p = lst[0]
|
||||||
lst_p = lst[0]
|
maximum = lst_p[0][1]
|
||||||
maximum = lst_p[0][1]
|
for stat in lst_p:
|
||||||
for stat in lst_p:
|
if stat[1] > maximum:
|
||||||
if stat[1] > maximum:
|
maximum = stat[1]
|
||||||
maximum = stat[1]
|
tab, players, kda = [], [], []
|
||||||
tab, players, kda = [], [], []
|
for stat in lst_p:
|
||||||
for stat in lst_p:
|
pourcent = round(100*stat[1]/maximum)
|
||||||
pourcent = round(100*stat[1]/maximum)
|
equals = int(round(float(pourcent)/3.3))
|
||||||
equals = int(round(float(pourcent)/3.3))
|
hyphen = 30 - equals
|
||||||
hyphen = 30 - equals
|
tab.append('[' + '='*equals + ' '*hyphen +']\n')
|
||||||
tab.append('[' + '='*equals + ' '*hyphen +']\n')
|
players.append(stat[0][:15] + '\n')
|
||||||
players.append(stat[0][:15] + '\n')
|
kda.append(str(stat[2]) + '/' + str(stat[3]) + '/' + str(stat[4]) + '\n')
|
||||||
kda.append(str(stat[2]) + '/' + str(stat[3]) + '/' + str(stat[4]) + '\n')
|
embed = discord.Embed(title=invocator_name, url='https://bit.ly/3biTekM',
|
||||||
embed = discord.Embed(title=invocator_name, url='https://bit.ly/3biTekM',
|
description='Date: ' + lst[2] + '\nLength: ' + lst[3])
|
||||||
description='Date: ' + lst[2] + '\nLength: ' + lst[3])
|
embed.set_author(name='League Of Legend - Last Game', url='https://euw.leagueoflegends.com/en-gb/',
|
||||||
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/' +
|
||||||
icon_url='https://static.wikia.nocookie.net/leagueoflegends/images/0/07/' +
|
'League_of_Legends_icon.png/revision/latest?cb=20191018194326')
|
||||||
'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)
|
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.')
|
|
||||||
else:
|
else:
|
||||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
await ctx.send('The username you entered is unknown.')
|
||||||
|
|
||||||
|
|
||||||
@lol_rank.error
|
|
||||||
async def lolrank_error(self, ctx, error):
|
|
||||||
global CD_LOLRANK
|
|
||||||
if isinstance(error, commands.CommandOnCooldown) and not CD_LOLRANK:
|
|
||||||
await ctx.send(f'Please wait at least 2 seconds between each $lol_rank.')
|
|
||||||
CD_LOLRANK = 1
|
|
||||||
elif isinstance(error, commands.MissingRequiredArgument):
|
|
||||||
await ctx.send(f'Please enter an invocator name (EUW) after $lol_rank.')
|
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|||||||
+57
-66
@@ -8,79 +8,70 @@ class OsuCmds(commands.Cog, name='Osu! commands'):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(ignore_extra=False)
|
||||||
async def osu_profile(self, ctx, username, x=None):
|
async def osu_profile(self, ctx, username):
|
||||||
if x is None:
|
lst = await ask_osu_profile(username)
|
||||||
lst = await ask_osu_profile(username)
|
if lst == 1:
|
||||||
if lst == 1:
|
await ctx.send('The username you entered is unknown.')
|
||||||
await ctx.send('The username you entered is unknown.')
|
|
||||||
else:
|
|
||||||
embed = discord.Embed(title=username, url='https://osu.ppy.sh/users/' + str(lst[0]))
|
|
||||||
embed.set_author(name='Osu! - Profile', url='https://osu.ppy.sh/home',
|
|
||||||
icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png')
|
|
||||||
embed.set_thumbnail(url='https://a.ppy.sh/' + str(lst[0]))
|
|
||||||
embed.add_field(name='Global Ranking', value='#'+str('{:,}'.format(lst[8])))
|
|
||||||
embed.add_field(name='Total Play Time', value=
|
|
||||||
str("%.0f" % ((lst[6] % (86400 * 30)) / 86400))+'d '+
|
|
||||||
str("%.0f" % ((lst[6] % 86400) / 3600))+'h '+
|
|
||||||
str("%.0f" % ((lst[6] % 3600) / 60))+'m ')
|
|
||||||
embed.add_field(name='|', value='|')
|
|
||||||
embed.add_field(name='Level', value=str("%.0f" % lst[7]))
|
|
||||||
embed.add_field(name='Ranked Score', value=str('{:,}'.format(lst[1])))
|
|
||||||
embed.add_field(name='Hit Accuracy', value=str("%.2f" % lst[2])+'%')
|
|
||||||
embed.add_field(name='Play Count', value=str('{:,}'.format(lst[3])))
|
|
||||||
embed.add_field(name='Total Score', value=str('{:,}'.format(lst[4])))
|
|
||||||
embed.add_field(name='Total Hits', value=str('{:,}'.format(lst[5])))
|
|
||||||
await ctx.send(embed=embed)
|
|
||||||
else:
|
else:
|
||||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
embed = discord.Embed(title=username, url='https://osu.ppy.sh/users/' + str(lst[0]))
|
||||||
|
embed.set_author(name='Osu! - Profile', url='https://osu.ppy.sh/home',
|
||||||
|
icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png')
|
||||||
|
embed.set_thumbnail(url='https://a.ppy.sh/' + str(lst[0]))
|
||||||
|
embed.add_field(name='Global Ranking', value='#'+str('{:,}'.format(lst[8])))
|
||||||
|
embed.add_field(name='Total Play Time', value=
|
||||||
|
str("%.0f" % ((lst[6] % (86400 * 30)) / 86400))+'d '+
|
||||||
|
str("%.0f" % ((lst[6] % 86400) / 3600))+'h '+
|
||||||
|
str("%.0f" % ((lst[6] % 3600) / 60))+'m ')
|
||||||
|
embed.add_field(name='|', value='|')
|
||||||
|
embed.add_field(name='Level', value=str("%.0f" % lst[7]))
|
||||||
|
embed.add_field(name='Ranked Score', value=str('{:,}'.format(lst[1])))
|
||||||
|
embed.add_field(name='Hit Accuracy', value=str("%.2f" % lst[2])+'%')
|
||||||
|
embed.add_field(name='Play Count', value=str('{:,}'.format(lst[3])))
|
||||||
|
embed.add_field(name='Total Score', value=str('{:,}'.format(lst[4])))
|
||||||
|
embed.add_field(name='Total Hits', value=str('{:,}'.format(lst[5])))
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(ignore_extra=False)
|
||||||
async def osu_lastgame(self, ctx, username, x=None):
|
async def osu_lastgame(self, ctx, username):
|
||||||
if x is None:
|
lst = await ask_osu_last_game(username)
|
||||||
lst = await ask_osu_last_game(username)
|
if lst == 1:
|
||||||
if lst == 1:
|
await ctx.send('The player you entered is unknown or didn\'t played any game recently.')
|
||||||
await ctx.send('The player you entered is unknown or didn\'t played any game recently.')
|
|
||||||
else:
|
|
||||||
embed = discord.Embed(title=str(lst[1]) + ' by ' + str(lst[2]), url='https://osu.ppy.sh/beatmapsets/' + str(lst[0]),
|
|
||||||
description='BPM: ' + str("%.0f" % lst[3]) + ' ; Stars: ' + str("%.1f" % lst[4]) +
|
|
||||||
' ; CS: ' + str(lst[5]) + ' ; AR: ' + str(lst[7]) +
|
|
||||||
' ; OD: ' + str(lst[6]) + ' ; HP: ' + str(lst[8]))
|
|
||||||
embed.set_author(name='Osu! - Last game', url='https://osu.ppy.sh/home',
|
|
||||||
icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png')
|
|
||||||
embed.set_thumbnail(url='https://b.ppy.sh/thumb/' + str(lst[0]) + 'l.jpg')
|
|
||||||
embed.add_field(name='Rank', value=str(lst[11]))
|
|
||||||
embed.add_field(name='Score', value=str('{:,}'.format(lst[9])))
|
|
||||||
embed.add_field(name='Max Combo', value=str(lst[10]))
|
|
||||||
embed.add_field(name='300', value=str(lst[12]))
|
|
||||||
embed.add_field(name='Geki', value=str(lst[17]))
|
|
||||||
embed.add_field(name='Accuracy',
|
|
||||||
value=str("%.2f" % (((lst[12]*300)+(lst[13]*100)+(lst[14]*50))/(sum(lst[12:16])*300)*100) + '%'))
|
|
||||||
embed.add_field(name='100', value=str(lst[13]))
|
|
||||||
embed.add_field(name='Katu', value=str(lst[16]))
|
|
||||||
embed.add_field(name='Player :', value=str(username))
|
|
||||||
embed.add_field(name='50', value=str(lst[14]))
|
|
||||||
embed.add_field(name='Miss', value=str(lst[15]))
|
|
||||||
embed.add_field(name='|', value='|')
|
|
||||||
await ctx.send(embed=embed)
|
|
||||||
else:
|
else:
|
||||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
embed = discord.Embed(title=str(lst[1]) + ' by ' + str(lst[2]), url='https://osu.ppy.sh/beatmapsets/' + str(lst[0]),
|
||||||
|
description='BPM: ' + str("%.0f" % lst[3]) + ' ; Stars: ' + str("%.1f" % lst[4]) +
|
||||||
|
' ; CS: ' + str(lst[5]) + ' ; AR: ' + str(lst[7]) +
|
||||||
|
' ; OD: ' + str(lst[6]) + ' ; HP: ' + str(lst[8]))
|
||||||
|
embed.set_author(name='Osu! - Last game', url='https://osu.ppy.sh/home',
|
||||||
|
icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png')
|
||||||
|
embed.set_thumbnail(url='https://b.ppy.sh/thumb/' + str(lst[0]) + 'l.jpg')
|
||||||
|
embed.add_field(name='Rank', value=str(lst[11]))
|
||||||
|
embed.add_field(name='Score', value=str('{:,}'.format(lst[9])))
|
||||||
|
embed.add_field(name='Max Combo', value=str(lst[10]))
|
||||||
|
embed.add_field(name='300', value=str(lst[12]))
|
||||||
|
embed.add_field(name='Geki', value=str(lst[17]))
|
||||||
|
embed.add_field(name='Accuracy',
|
||||||
|
value=str("%.2f" % (((lst[12]*300)+(lst[13]*100)+(lst[14]*50))/(sum(lst[12:16])*300)*100) + '%'))
|
||||||
|
embed.add_field(name='100', value=str(lst[13]))
|
||||||
|
embed.add_field(name='Katu', value=str(lst[16]))
|
||||||
|
embed.add_field(name='Player :', value=str(username))
|
||||||
|
embed.add_field(name='50', value=str(lst[14]))
|
||||||
|
embed.add_field(name='Miss', value=str(lst[15]))
|
||||||
|
embed.add_field(name='|', value='|')
|
||||||
|
await ctx.send(embed=embed)
|
||||||
|
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(ignore_extra=False)
|
||||||
async def osu_acc(self, ctx, username, x=None):
|
async def osu_acc(self, ctx, username):
|
||||||
if x is None:
|
test_acc = await ask_osu_acc(username)
|
||||||
test_acc = await ask_osu_acc(username)
|
if test_acc:
|
||||||
if test_acc:
|
embed = discord.Embed()
|
||||||
embed = discord.Embed()
|
embed.set_author(name='Osu! - Accuracy', icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png')
|
||||||
embed.set_author(name='Osu! - Accuracy', icon_url=r'https://upload.wikimedia.org/wikipedia/commons/4/44/Osu%21Logo_%282019%29.png')
|
embed.set_image(url="attachment://acc.jpeg")
|
||||||
embed.set_image(url="attachment://acc.jpeg")
|
await ctx.send(embed=embed, file=discord.File('acc.jpeg'))
|
||||||
await ctx.send(embed=embed, file=discord.File('acc.jpeg'))
|
|
||||||
else:
|
|
||||||
await ctx.send('The player you entered is unknown or didn\'t played any game recently.')
|
|
||||||
else:
|
else:
|
||||||
await ctx.send('If you are trying to use a username with spaces, please surround it with quotes.')
|
await ctx.send('The player you entered is unknown or didn\'t played any game recently.')
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|||||||
+1
-12
@@ -3,13 +3,12 @@ import asyncio
|
|||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.ext.commands.cooldowns import BucketType
|
from discord.ext.commands.cooldowns import BucketType
|
||||||
|
|
||||||
CD_ISSOU = 0
|
|
||||||
|
|
||||||
class OtherCmds(commands.Cog, name='Other commands'):
|
class OtherCmds(commands.Cog, name='Other commands'):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(ignore_extra=False)
|
||||||
@commands.cooldown(1, 2, commands.BucketType.guild)
|
@commands.cooldown(1, 2, commands.BucketType.guild)
|
||||||
async def issou(self, ctx, username: discord.User = None):
|
async def issou(self, ctx, username: discord.User = None):
|
||||||
if username is not None:
|
if username is not None:
|
||||||
@@ -31,19 +30,9 @@ class OtherCmds(commands.Cog, name='Other commands'):
|
|||||||
if voice.is_playing():
|
if voice.is_playing():
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
await voice.disconnect()
|
await voice.disconnect()
|
||||||
global CD_ISSOU
|
|
||||||
CD_ISSOU = 0
|
|
||||||
else:
|
else:
|
||||||
await ctx.send('You or the targeted person are not connected to any channel.')
|
await ctx.send('You or the targeted person are not connected to any channel.')
|
||||||
|
|
||||||
|
|
||||||
@issou.error
|
|
||||||
async def issou_error(self, ctx, error):
|
|
||||||
global CD_ISSOU
|
|
||||||
if isinstance(error, commands.CommandOnCooldown) and not CD_ISSOU:
|
|
||||||
await ctx.send(f'Please wait at least 2 seconds between each $issou.')
|
|
||||||
CD_ISSOU = 1
|
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
bot.add_cog(OtherCmds(bot))
|
bot.add_cog(OtherCmds(bot))
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class TwitchCmds(commands.Cog, name='Twitch commands'):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
|
|
||||||
@commands.command()
|
@commands.command(ignore_extra=False)
|
||||||
async def chat_set(self, ctx, channel_name):
|
async def chat_set(self, ctx, channel_name):
|
||||||
try:
|
try:
|
||||||
await ctx.message.delete()
|
await ctx.message.delete()
|
||||||
|
|||||||
+15
-21
@@ -1,13 +1,16 @@
|
|||||||
from private import TOKEN_BOT
|
from private import TOKEN_BOT
|
||||||
from time import time
|
from time import time
|
||||||
|
from datetime import datetime
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
|
|
||||||
bot = commands.Bot(command_prefix='$')
|
bot = commands.Bot(command_prefix='$')
|
||||||
startup_extensions = ["cmd_other", "cmd_lol", "cmd_osu", "cmd_twitch"]
|
startup_extensions = ["cmd_other", "cmd_lol", "cmd_osu", "cmd_twitch"]
|
||||||
time_s = time()
|
time_s = time()
|
||||||
print('Loading started')
|
print('Loading started')
|
||||||
|
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
default_activity = discord.Activity(type=discord.ActivityType.listening, name='$help')
|
default_activity = discord.Activity(type=discord.ActivityType.listening, name='$help')
|
||||||
@@ -16,33 +19,24 @@ async def on_ready():
|
|||||||
' in ' + str(round(time() - time_s, 2)) + 's.')
|
' in ' + str(round(time() - time_s, 2)) + 's.')
|
||||||
|
|
||||||
|
|
||||||
@bot.command(hidden=True)
|
@bot.event
|
||||||
|
async def on_command_error(ctx, error):
|
||||||
|
print(datetime.now().strftime("[%H:%M:%S]") + ' \'' + str(error) + '\' from ' + str(ctx.author) + ' on ' + ctx.message.guild.name + '.')
|
||||||
|
await ctx.send(error)
|
||||||
|
|
||||||
|
|
||||||
|
@bot.command(hidden=True, ignore_extra=False)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def loadext(ctx, extension):
|
async def loadext(ctx, extension):
|
||||||
try:
|
bot.load_extension(extension)
|
||||||
bot.load_extension(extension)
|
await ctx.send("Extension loaded.")
|
||||||
await ctx.send(str(extension) + ' successfully loaded.')
|
|
||||||
except discord.ext.commands.ExtensionNotFound:
|
|
||||||
await ctx.send('Extension not found.')
|
|
||||||
except discord.ext.commands.ExtensionAlreadyLoaded:
|
|
||||||
await ctx.send('Extension already loaded.')
|
|
||||||
except discord.ext.commands.NoEntryPointError as a:
|
|
||||||
await ctx.send(a)
|
|
||||||
except ExtensionFailed as b:
|
|
||||||
await ctx.send(b)
|
|
||||||
|
|
||||||
|
|
||||||
@bot.command(hidden=True)
|
@bot.command(hidden=True, ignore_extra=False)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
async def unloadext(ctx, extension):
|
async def unloadext(ctx, extension):
|
||||||
try:
|
bot.unload_extension(extension)
|
||||||
bot.unload_extension(extension)
|
await ctx.send("Extension unloaded.")
|
||||||
await ctx.send(str(extension) + ' successfully unloaded.')
|
|
||||||
except discord.ext.commands.ExtensionNotFound:
|
|
||||||
await ctx.send('Extension not found.')
|
|
||||||
except discord.ext.commands.ExtensionNotLoaded:
|
|
||||||
await ctx.send('Extension not loaded.')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
for extension in startup_extensions:
|
for extension in startup_extensions:
|
||||||
|
|||||||
Reference in New Issue
Block a user