mirror of
https://github.com/myned/modufur.git
synced 2024-12-24 22:27:28 +00:00
Converted commands module to use alias cmds
This commit is contained in:
parent
c651ce7a0a
commit
d23c05049e
6 changed files with 70 additions and 70 deletions
|
@ -11,7 +11,7 @@ from fractions import gcd
|
|||
import discord as d
|
||||
from discord import errors as err
|
||||
from discord import reaction
|
||||
from discord.ext import commands
|
||||
from discord.ext import commands as cmds
|
||||
from discord.ext.commands import errors as errext
|
||||
|
||||
from cogs import tools
|
||||
|
@ -113,7 +113,7 @@ class MsG:
|
|||
return 'https://emojipedia-us.s3.amazonaws.com/thumbs/320/twitter/103/sparkles_2728.png'
|
||||
return None
|
||||
|
||||
# @commands.command()
|
||||
# @cmds.command()
|
||||
# async def auto_post(self, ctx):
|
||||
# try:
|
||||
# if ctx.channel.id not in u.tasks['auto_post']:
|
||||
|
@ -133,7 +133,7 @@ class MsG:
|
|||
# await ctx.send('**Already auto-posting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7)
|
||||
# await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@commands.group(aliases=['tag', 't'], brief='e621 - Get info on tags', description='e621 | NSFW\nGroup command for obtaining info on tags', usage='[tags|tag|t]')
|
||||
@cmds.group(aliases=['tag', 't'], brief='e621 - Get info on tags', description='e621 | NSFW\nGroup command for obtaining info on tags', usage='[tags|tag|t]')
|
||||
async def tags(self, ctx):
|
||||
pass
|
||||
|
||||
|
@ -197,7 +197,7 @@ class MsG:
|
|||
if not c:
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@commands.group(aliases=['g'])
|
||||
@cmds.group(aliases=['g'])
|
||||
async def get(self, ctx):
|
||||
if not ctx.invoked_subcommand:
|
||||
await ctx.send('**Use a flag to get items.**\n*Type* `{}help get` *for more info.*'.format(ctx.prefix), delete_after=7)
|
||||
|
@ -313,7 +313,7 @@ class MsG:
|
|||
await e.message.edit(content='**Search aborted**', delete_after=7)
|
||||
|
||||
# Reverse image searches a linked image using the public iqdb
|
||||
@commands.command(name='reverse', aliases=['rev', 'ris'], brief='e621 Reverse image search', description='e621 | NSFW\nReverse-search an image with given URL')
|
||||
@cmds.command(name='reverse', aliases=['rev', 'ris'], brief='e621 Reverse image search', description='e621 | NSFW\nReverse-search an image with given URL')
|
||||
async def reverse(self, ctx, *args):
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
|
@ -357,7 +357,7 @@ class MsG:
|
|||
await ctx.send(f'`{e}` **too large.** Maximum is 8 MB', delete_after=7)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@commands.command(name='reversify', aliases=['revify', 'risify', 'rify'])
|
||||
@cmds.command(name='reversify', aliases=['revify', 'risify', 'rify'])
|
||||
async def reversify(self, ctx, *args):
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args, limit=self.HISTORY_LIMIT / 5)
|
||||
|
@ -500,8 +500,8 @@ class MsG:
|
|||
print('STOPPED : reversifying #{}'.format(channel.name))
|
||||
await channel.send('**Stopped queueing messages for reversification in** {}'.format(channel.mention), delete_after=5)
|
||||
|
||||
@commands.command(name='autoreversify', aliases=['autorev'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@cmds.command(name='autoreversify', aliases=['autorev'])
|
||||
@cmds.has_permissions(manage_channels=True)
|
||||
async def auto_reversify(self, ctx):
|
||||
if ctx.channel.id not in u.tasks['auto_rev']:
|
||||
u.tasks['auto_rev'].append(ctx.channel.id)
|
||||
|
@ -641,7 +641,7 @@ class MsG:
|
|||
raise exc.NotFound(formatter.tostring(tags))
|
||||
|
||||
# Creates reaction-based paginator for linked pools
|
||||
@commands.command(name='poolpage', aliases=['poolp', 'pp', 'e621pp', 'e6pp', '6pp'], brief='e621 pool paginator', description='e621 | NSFW\nShow pools in a page format')
|
||||
@cmds.command(name='poolpage', aliases=['poolp', 'pp', 'e621pp', 'e6pp', '6pp'], brief='e621 pool paginator', description='e621 | NSFW\nShow pools in a page format')
|
||||
async def pool_paginator(self, ctx, *args):
|
||||
def on_reaction(reaction, user):
|
||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
||||
|
@ -772,7 +772,7 @@ class MsG:
|
|||
|
||||
await ctx.author.send('`{} / {}`'.format(hearted.index(embed) + 1, len(hearted)), embed=embed)
|
||||
|
||||
@commands.command(name='e621page', aliases=['e621p', 'e6p', '6p'])
|
||||
@cmds.command(name='e621page', aliases=['e621p', 'e6p', '6p'])
|
||||
@checks.is_nsfw()
|
||||
async def e621_paginator(self, ctx, *args):
|
||||
def on_reaction(reaction, user):
|
||||
|
@ -932,7 +932,7 @@ class MsG:
|
|||
# await ctx.send('\N{NO ENTRY} {} **is not an NSFW channel**'.format(ctx.channel.mention), delete_after=7)
|
||||
# await ctx.message.add_reaction('\N{NO ENTRY}')
|
||||
|
||||
@commands.command(name='e926page', aliases=['e926p', 'e9p', '9p'])
|
||||
@cmds.command(name='e926page', aliases=['e926p', 'e9p', '9p'])
|
||||
async def e926_paginator(self, ctx, *args):
|
||||
def on_reaction(reaction, user):
|
||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
||||
|
@ -1086,7 +1086,7 @@ class MsG:
|
|||
await ctx.author.send('`{} / {}`'.format(hearted.index(embed) + 1, len(hearted)), embed=embed)
|
||||
|
||||
# Searches for and returns images from e621.net given tags when not blacklisted
|
||||
@commands.group(aliases=['e6', '6'], brief='e621 | NSFW', description='e621 | NSFW\nTag-based search for e621.net\n\nYou can only search 5 tags and 6 images at once for now.\ne6 [tags...] ([# of images])')
|
||||
@cmds.group(aliases=['e6', '6'], brief='e621 | NSFW', description='e621 | NSFW\nTag-based search for e621.net\n\nYou can only search 5 tags and 6 images at once for now.\ne6 [tags...] ([# of images])')
|
||||
@checks.is_nsfw()
|
||||
async def e621(self, ctx, *args):
|
||||
try:
|
||||
|
@ -1135,7 +1135,7 @@ class MsG:
|
|||
# await ctx.message.add_reaction('\N{NO ENTRY}')
|
||||
|
||||
# Searches for and returns images from e926.net given tags when not blacklisted
|
||||
@commands.command(aliases=['e9', '9'], brief='e926 | SFW', description='e926 | SFW\nTag-based search for e926.net\n\nYou can only search 5 tags and 6 images at once for now.\ne9 [tags...] ([# of images])')
|
||||
@cmds.command(aliases=['e9', '9'], brief='e926 | SFW', description='e926 | SFW\nTag-based search for e926.net\n\nYou can only search 5 tags and 6 images at once for now.\ne9 [tags...] ([# of images])')
|
||||
async def e926(self, ctx, *args):
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args, limit=3)
|
||||
|
@ -1176,7 +1176,7 @@ class MsG:
|
|||
await ctx.send('**Request timed out**')
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@commands.group(aliases=['fave', 'fav', 'f'])
|
||||
@cmds.group(aliases=['fave', 'fav', 'f'])
|
||||
async def favorite(self, ctx):
|
||||
if not ctx.invoked_subcommand:
|
||||
await ctx.send('**Use a flag to manage favorites.**\n*Type* `{}help fav` *for more info.*'.format(ctx.prefix), delete_after=7)
|
||||
|
@ -1286,7 +1286,7 @@ class MsG:
|
|||
pass
|
||||
|
||||
# Umbrella command structure to manage global, channel, and user blacklists
|
||||
@commands.group(aliases=['bl', 'b'], brief='Manage blacklists', description='Blacklist base command for managing blacklists\n\n`bl get [blacklist]` to show a blacklist\n`bl set [blacklist] [tags]` to replace a blacklist\n`bl clear [blacklist]` to clear a blacklist\n`bl add [blacklist] [tags]` to add tags to a blacklist\n`bl remove [blacklist] [tags]` to remove tags from a blacklist', usage='[flag] [blacklist] ([tags])')
|
||||
@cmds.group(aliases=['bl', 'b'], brief='Manage blacklists', description='Blacklist base command for managing blacklists\n\n`bl get [blacklist]` to show a blacklist\n`bl set [blacklist] [tags]` to replace a blacklist\n`bl clear [blacklist]` to clear a blacklist\n`bl add [blacklist] [tags]` to add tags to a blacklist\n`bl remove [blacklist] [tags]` to remove tags from a blacklist', usage='[flag] [blacklist] ([tags])')
|
||||
async def blacklist(self, ctx):
|
||||
if not ctx.invoked_subcommand:
|
||||
await ctx.send('**Use a flag to manage blacklists.**\n*Type* `{}help bl` *for more info.*'.format(ctx.prefix), delete_after=7)
|
||||
|
@ -1340,7 +1340,7 @@ class MsG:
|
|||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@__get_all_blacklists.command(name='guild', aliases=['g'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@cmds.has_permissions(manage_channels=True)
|
||||
async def ___get_all_guild_blacklists(self, ctx, *args):
|
||||
dest = u.get_kwargs(ctx, args)['destination']
|
||||
|
||||
|
@ -1350,7 +1350,7 @@ class MsG:
|
|||
await dest.send('\N{NO ENTRY SIGN} **__{} blacklists:__**\n\n{}'.format(guild.name, formatter.dict_tostring(self.blacklists['guild_blacklist'].get(guild.id, {}))))
|
||||
|
||||
@__get_all_blacklists.command(name='user', aliases=['u', 'member', 'm'])
|
||||
@commands.is_owner()
|
||||
@cmds.is_owner()
|
||||
async def ___get_all_user_blacklists(self, ctx, *args):
|
||||
dest = u.get_kwargs(ctx, args)['destination']
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ class MsG:
|
|||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@_add_tags.command(name='global', aliases=['gl', 'g'])
|
||||
@commands.is_owner()
|
||||
@cmds.is_owner()
|
||||
async def __add_global_tags(self, ctx, *args):
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
dest, tags = kwargs['destination'], kwargs['remaining']
|
||||
|
@ -1384,7 +1384,7 @@ class MsG:
|
|||
await dest.send('**Added to global blacklist:**\n```\n{}```'.format(formatter.tostring(tags)), delete_after=5)
|
||||
|
||||
@_add_tags.command(name='channel', aliases=['ch', 'c'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@cmds.has_permissions(manage_channels=True)
|
||||
async def __add_channel_tags(self, ctx, *args):
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
dest, tags = kwargs['destination'], kwargs['remaining']
|
||||
|
@ -1436,7 +1436,7 @@ class MsG:
|
|||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@_remove_tags.command(name='global', aliases=['gl', 'g'])
|
||||
@commands.is_owner()
|
||||
@cmds.is_owner()
|
||||
async def __remove_global_tags(self, ctx, *args):
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
|
@ -1458,7 +1458,7 @@ class MsG:
|
|||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@_remove_tags.command(name='channel', aliases=['ch', 'c'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@cmds.has_permissions(manage_channels=True)
|
||||
async def __remove_channel_tags(self, ctx, *args):
|
||||
try:
|
||||
kwargs = u.get_kwargs(ctx, args)
|
||||
|
@ -1512,7 +1512,7 @@ class MsG:
|
|||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@_clear_blacklist.command(name='global', aliases=['gl', 'g'])
|
||||
@commands.is_owner()
|
||||
@cmds.is_owner()
|
||||
async def __clear_global_blacklist(self, ctx, *args):
|
||||
dest = u.get_kwargs(ctx, args)['destination']
|
||||
|
||||
|
@ -1522,7 +1522,7 @@ class MsG:
|
|||
await dest.send('**Global blacklist cleared**', delete_after=5)
|
||||
|
||||
@_clear_blacklist.command(name='channel', aliases=['ch', 'c'])
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@cmds.has_permissions(manage_channels=True)
|
||||
async def __clear_channel_blacklist(self, ctx, *args):
|
||||
dest = u.get_kwargs(ctx, args)['destination']
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import asyncio
|
|||
import traceback as tb
|
||||
|
||||
import discord as d
|
||||
from discord.ext import commands
|
||||
from discord.ext import commands as cmds
|
||||
|
||||
from misc import exceptions as exc
|
||||
from utils import utils as u
|
||||
|
@ -13,7 +13,7 @@ class Info:
|
|||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
# @commands.command(name='helptest', aliases=['h'], hidden=True)
|
||||
# @cmds.command(name='helptest', aliases=['h'], hidden=True)
|
||||
# async def list_commands(self, ctx):
|
||||
# embed = d.Embed(title='All possible commands:', color=ctx.me.color)
|
||||
# embed.set_author(name=ctx.me.display_name, icon_url=ctx.me.avatar_url)
|
||||
|
@ -22,7 +22,7 @@ class Info:
|
|||
#
|
||||
# await ctx.send(embed=embed)
|
||||
|
||||
@commands.command(hidden=True)
|
||||
@cmds.command(hidden=True)
|
||||
async def hi(self, ctx, *args):
|
||||
dest = u.get_kwargs(ctx, args)
|
||||
|
||||
|
@ -35,7 +35,7 @@ class Info:
|
|||
hello = '{} **Mod** {}'.format(hello[:7], hello[7:])
|
||||
await dest.send(hello)
|
||||
|
||||
@commands.group(name='info', aliases=['i'])
|
||||
@cmds.group(name='info', aliases=['i'])
|
||||
async def info(self, ctx):
|
||||
if invoked_subcommand is None:
|
||||
await ctx.send('<embed>BOT INFO</embed>')
|
||||
|
|
|
@ -5,7 +5,7 @@ from datetime import datetime as dt
|
|||
|
||||
import discord as d
|
||||
from discord import errors as err
|
||||
from discord.ext import commands
|
||||
from discord.ext import commands as cmds
|
||||
|
||||
from misc import exceptions as exc
|
||||
from misc import checks
|
||||
|
@ -28,8 +28,8 @@ class Administration:
|
|||
self.deleting = True
|
||||
self.bot.loop.create_task(self.delete())
|
||||
|
||||
@commands.group(aliases=['pru', 'clear', 'cl'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.group(aliases=['pru', 'clear', 'cl'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def prune(self, ctx):
|
||||
pass
|
||||
|
||||
|
@ -38,7 +38,7 @@ class Administration:
|
|||
pass
|
||||
|
||||
@_prune_user.command(name='all', aliases=['a'], brief='Prune a user\'s messages from the guild', description='about flag centers on message 50 of 101 messages\n\npfg \{user id\} [before|after|about] [\{message id\}]\n\nExample:\npfg \{user id\} before \{message id\}', hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.is_owner()
|
||||
async def _prune_user_all(self, ctx, user, when=None, reference=None):
|
||||
def yes(msg):
|
||||
if msg.content.lower() == 'y' and msg.channel is ctx.channel and msg.author is ctx.author:
|
||||
|
@ -153,8 +153,8 @@ class Administration:
|
|||
print('STOPPED : deleting #{}'.format(channel.id))
|
||||
await channel.send('**Stopped queueing messages for deletion in** {}'.format(channel.mention), delete_after=5)
|
||||
|
||||
@commands.command(name='autodelete', aliases=['autodel'])
|
||||
@commands.has_permissions(administrator=True)
|
||||
@cmds.command(name='autodelete', aliases=['autodel'])
|
||||
@cmds.has_permissions(administrator=True)
|
||||
async def auto_delete(self, ctx):
|
||||
try:
|
||||
if ctx.channel.id not in u.tasks['auto_del']:
|
||||
|
@ -173,8 +173,8 @@ class Administration:
|
|||
await ctx.send('**Already auto-deleting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7)
|
||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
@commands.group(aliases=['setting', 'set', 's'])
|
||||
@commands.has_permissions(administrator=True)
|
||||
@cmds.group(aliases=['setting', 'set', 's'])
|
||||
@cmds.has_permissions(administrator=True)
|
||||
async def settings(self, ctx):
|
||||
pass
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from contextlib import redirect_stdout, suppress
|
|||
|
||||
import discord as d
|
||||
import pyrasite as pyr
|
||||
from discord.ext import commands
|
||||
from discord.ext import commands as cmds
|
||||
|
||||
from misc import exceptions as exc
|
||||
from misc import checks
|
||||
|
@ -22,8 +22,8 @@ class Bot:
|
|||
self.bot = bot
|
||||
|
||||
# Close connection to Discord - immediate offline
|
||||
@commands.command(name=',die', aliases=[',d'], brief='Kills the bot', description='BOT OWNER ONLY\nCloses the connection to Discord', hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',die', aliases=[',d'], brief='Kills the bot', description='BOT OWNER ONLY\nCloses the connection to Discord', hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def die(self, ctx):
|
||||
await ctx.message.add_reaction('\N{CRESCENT MOON}')
|
||||
|
||||
|
@ -41,8 +41,8 @@ class Bot:
|
|||
print('\n< < < < < < < < < < < <\nD I S C O N N E C T E D\n< < < < < < < < < < < <\n')
|
||||
# u.notify('D I S C O N N E C T E D')
|
||||
|
||||
@commands.command(name=',restart', aliases=[',res', ',r'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',restart', aliases=[',res', ',r'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def restart(self, ctx):
|
||||
await ctx.message.add_reaction('\N{SLEEPING SYMBOL}')
|
||||
|
||||
|
@ -62,15 +62,15 @@ class Bot:
|
|||
os.execl(sys.executable, 'python3', 'run.py')
|
||||
|
||||
# Invite bot to bot owner's server
|
||||
@commands.command(name=',invite', aliases=[',inv', ',link'], brief='Invite the bot', description='BOT OWNER ONLY\nInvite the bot to a server (Requires admin)', hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',invite', aliases=[',inv', ',link'], brief='Invite the bot', description='BOT OWNER ONLY\nInvite the bot to a server (Requires admin)', hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def invite(self, ctx):
|
||||
await ctx.message.add_reaction('\N{ENVELOPE}')
|
||||
|
||||
await ctx.send('https://discordapp.com/oauth2/authorize?&client_id={}&scope=bot&permissions={}'.format(u.config['client_id'], u.config['permissions']), delete_after=5)
|
||||
|
||||
@commands.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def change_status(self, ctx, *, game=None):
|
||||
if game:
|
||||
await self.bot.change_presence(game=d.Game(name=game))
|
||||
|
@ -83,8 +83,8 @@ class Bot:
|
|||
u.dump(u.config, 'config.json', json=True)
|
||||
await ctx.send('**Game changed to** ` `')
|
||||
|
||||
@commands.command(name=',username', aliases=[',user'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',username', aliases=[',user'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def change_username(self, ctx, *, username=None):
|
||||
if username:
|
||||
await self.bot.edit(username=username)
|
||||
|
@ -121,8 +121,8 @@ class Tools:
|
|||
async def refresh_err(self, m, o=''):
|
||||
await m.edit(content='```\n{}```'.format(o))
|
||||
|
||||
@commands.command(name=',console', aliases=[',con', ',c'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',console', aliases=[',con', ',c'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def console(self, ctx):
|
||||
def execute(msg):
|
||||
if msg.content.lower().startswith('exec ') and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||
|
@ -194,8 +194,8 @@ class Tools:
|
|||
sys.stderr = sys.__stderr__
|
||||
print('Reset sys output.')
|
||||
|
||||
@commands.command(name=',execute', aliases=[',exec'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',execute', aliases=[',exec'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def execute(self, ctx, *, exe):
|
||||
try:
|
||||
with io.StringIO() as buff, redirect_stdout(buff):
|
||||
|
@ -205,8 +205,8 @@ class Tools:
|
|||
except Exception:
|
||||
await self.generate(ctx, exe, f'\n{tb.format_exc()}')
|
||||
|
||||
@commands.command(name=',evaluate', aliases=[',eval'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.command(name=',evaluate', aliases=[',eval'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def evaluate(self, ctx, *, evl):
|
||||
try:
|
||||
with io.StringIO() as buff, redirect_stdout(buff):
|
||||
|
@ -216,8 +216,8 @@ class Tools:
|
|||
except Exception:
|
||||
await self.generate(ctx, evl, f'\n{tb.format_exc()}')
|
||||
|
||||
@commands.group(aliases=[',db'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.group(aliases=[',db'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def debug(self, ctx):
|
||||
console = await self.generate(ctx)
|
||||
|
||||
|
@ -229,6 +229,6 @@ class Tools:
|
|||
async def _inspect(self, ctx, *, input_):
|
||||
pass
|
||||
|
||||
# @commands.command(name='endpoint', aliases=['end'])
|
||||
# @cmds.command(name='endpoint', aliases=['end'])
|
||||
# async def get_endpoint(self, ctx, *args):
|
||||
# await ctx.send(f'```\n{await u.fetch(f"https://{args[0]}/{args[1]}/{args[2]}", params={args[3]: args[4], "limit": 1}, json=True)}```')
|
||||
|
|
|
@ -11,7 +11,7 @@ import httplib2
|
|||
import requests_oauthlib as ro
|
||||
from apiclient import http
|
||||
from apiclient.discovery import build
|
||||
from discord.ext import commands
|
||||
from discord.ext import commands as cmds
|
||||
from oauth2client.client import flow_from_clientsecrets
|
||||
|
||||
#from run import config
|
||||
|
@ -31,7 +31,7 @@ class Utils:
|
|||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.command(name='lastcommand', aliases=['last', 'l', ','], brief='Reinvokes last successful command', description='Executes last successfully executed command')
|
||||
@cmds.command(name='lastcommand', aliases=['last', 'l', ','], brief='Reinvokes last successful command', description='Executes last successfully executed command')
|
||||
async def last_command(self, ctx, arg='None'):
|
||||
try:
|
||||
context = u.last_commands[ctx.author.id]
|
||||
|
@ -46,17 +46,17 @@ class Utils:
|
|||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||
|
||||
# Displays latency
|
||||
@commands.command(aliases=['p'], brief='Pong!', description='Returns latency from bot to Discord servers, not to user')
|
||||
@cmds.command(aliases=['p'], brief='Pong!', description='Returns latency from bot to Discord servers, not to user')
|
||||
async def ping(self, ctx):
|
||||
await ctx.message.add_reaction('\N{TABLE TENNIS PADDLE AND BALL}')
|
||||
await ctx.send(ctx.author.mention + ' \N{TABLE TENNIS PADDLE AND BALL} `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
||||
|
||||
@commands.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
||||
@cmds.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
||||
async def prefix(self, ctx):
|
||||
await ctx.send('**Prefix:** `{}`'.format('` or `'.join(u.settings['prefixes'][ctx.guild.id] if ctx.guild.id in u.settings['prefixes'] else u.config['prefix'])))
|
||||
|
||||
@commands.group(name=',send', aliases=[',s'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.group(name=',send', aliases=[',s'], hidden=True)
|
||||
@cmds.is_owner()
|
||||
async def send(self, ctx):
|
||||
pass
|
||||
|
||||
|
@ -81,7 +81,7 @@ class Utils:
|
|||
async def send_user(self, ctx, user, *, message):
|
||||
await d.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
|
||||
|
||||
@commands.command(aliases=['authenticateupload', 'authupload', 'authup', 'auth'], hidden=True)
|
||||
@cmds.command(aliases=['authenticateupload', 'authupload', 'authup', 'auth'], hidden=True)
|
||||
async def authenticate_upload(self, ctx):
|
||||
global youtube
|
||||
flow = flow_from_clientsecrets('client_secrets.json', scope='https://www.googleapis.com/auth/youtube.upload',
|
||||
|
@ -92,8 +92,8 @@ class Utils:
|
|||
youtube = build('youtube', 'v3', http=credentials.authorize(http.build_http()))
|
||||
print('Service built.')
|
||||
|
||||
@commands.command(aliases=['up', 'u', 'vid', 'v'], hidden=True)
|
||||
@commands.has_permissions(administrator=True)
|
||||
@cmds.command(aliases=['up', 'u', 'vid', 'v'], hidden=True)
|
||||
@cmds.has_permissions(administrator=True)
|
||||
async def upload(self, ctx):
|
||||
global youtube
|
||||
attachments = ctx.message.attachments
|
||||
|
|
|
@ -13,7 +13,7 @@ from urllib.parse import urlparse
|
|||
import discord as d
|
||||
from discord import errors as err
|
||||
from discord import utils
|
||||
from discord.ext import commands
|
||||
from discord.ext import commands as cmds
|
||||
from discord.ext.commands import errors as errext
|
||||
|
||||
from misc import exceptions as exc
|
||||
|
@ -23,10 +23,10 @@ from utils import utils as u
|
|||
log.basicConfig(level=log.WARNING)
|
||||
|
||||
|
||||
# class HelpFormatter(commands.HelpFormatter):
|
||||
# class HelpFormatter(cmds.HelpFormatter):
|
||||
#
|
||||
# async def format(self):
|
||||
# self._paginator = commands.Paginator()
|
||||
# self._paginator = cmds.Paginator()
|
||||
#
|
||||
# # we need a padding of ~80 or so
|
||||
#
|
||||
|
@ -36,7 +36,7 @@ log.basicConfig(level=log.WARNING)
|
|||
# # <description> portion
|
||||
# self._paginator.add_line(description, empty=True)
|
||||
#
|
||||
# if isinstance(self.command, commands.Command):
|
||||
# if isinstance(self.command, cmds.Command):
|
||||
# # <signature portion>
|
||||
# signature = self.get_command_signature()
|
||||
# self._paginator.add_line(signature, empty=True)
|
||||
|
@ -56,7 +56,7 @@ log.basicConfig(level=log.WARNING)
|
|||
def get_prefix(bot, message):
|
||||
return u.settings['prefixes'].get(message.guild.id, u.config['prefix'])
|
||||
|
||||
bot = commands.Bot(command_prefix=get_prefix, formatter=commands.HelpFormatter(show_check_failure=True), description='Modumind - A booru bot with a side of management\n\nS for single command\nG for group command', help_attrs={'aliases': ['h']}, pm_help=None)
|
||||
bot = cmds.Bot(command_prefix=get_prefix, formatter=cmds.HelpFormatter(show_check_failure=True), description='Modumind - A booru bot with a side of management\n\nS for single command\nG for group command', help_attrs={'aliases': ['h']}, pm_help=None)
|
||||
|
||||
@bot.command(help='help', brief='brief', description='description', usage='usage')
|
||||
async def test(ctx):
|
||||
|
@ -170,7 +170,7 @@ def after(voice, error):
|
|||
|
||||
# suggested = u.setdefault('cogs/suggested.pkl', {'last_update': 'None', 'tags': {}, 'total': 0})
|
||||
@bot.command(name=',test', hidden=True)
|
||||
@commands.is_owner()
|
||||
@cmds.is_owner()
|
||||
async def test(ctx):
|
||||
post = await u.fetch('https://e621.net/post/show.json?id=1145042', json=True)
|
||||
|
||||
|
|
Loading…
Reference in a new issue