mirror of
https://github.com/uhIgnacio/EmoteManager.git
synced 2024-08-15 02:23:13 +00:00
update the success emotes
This commit is contained in:
parent
8f170d7f13
commit
ecefefb4c9
6 changed files with 29 additions and 10 deletions
11
bot.py
11
bot.py
|
@ -21,9 +21,20 @@ class Bot(commands.AutoShardedBot):
|
|||
description=self.config.get('description', ''),
|
||||
**kwargs)
|
||||
|
||||
self._setup_success_emojis()
|
||||
|
||||
for cog in self.config['cogs']:
|
||||
self.load_extension(cog)
|
||||
|
||||
def _setup_success_emojis(self):
|
||||
"""Load the emojis from the config to be used when a command fails or succeeds
|
||||
We do it this way so that they can be used anywhere instead of requiring a bot instance.
|
||||
"""
|
||||
import utils.misc
|
||||
default = ('❌', '✅')
|
||||
utils.SUCCESS_EMOJIS = utils.misc.SUCCESS_EMOJIS = (
|
||||
self.config.get('response_emojis', {}).get('success', default))
|
||||
|
||||
def run(self):
|
||||
super().run(self.config['tokens'].pop('discord'))
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class Emotes:
|
|||
|
||||
if isinstance(error, commands.NoPrivateMessage):
|
||||
await context.send(
|
||||
f'{utils.SUCCESS_EMOTES[False]} Sorry, this command may only be used in a server.')
|
||||
f'{utils.SUCCESS_EMOJIS[False]} Sorry, this command may only be used in a server.')
|
||||
|
||||
@commands.command()
|
||||
async def add(self, context, *args):
|
||||
|
@ -220,7 +220,7 @@ class Emotes:
|
|||
for emote in emotes:
|
||||
await context.invoke(self.remove, emote)
|
||||
with contextlib.suppress(discord.HTTPException):
|
||||
await context.message.add_reaction('✅')
|
||||
await context.message.add_reaction(utils.SUCCESS_EMOJIS[True])
|
||||
|
||||
@commands.command(aliases=('mv',))
|
||||
async def rename(self, context, old, new_name):
|
||||
|
|
|
@ -32,10 +32,10 @@ class Meta:
|
|||
try:
|
||||
await context.author.send(self.bot.config['support_server_invite'])
|
||||
with contextlib.suppress(discord.HTTPException):
|
||||
await context.message.add_reaction('📬')
|
||||
await context.message.add_reaction('📬') # TODO make this emoji configurable too
|
||||
except discord.Forbidden:
|
||||
with contextlib.suppress(discord.HTTPException):
|
||||
await context.message.add_reaction('❌')
|
||||
await context.message.add_reaction(utils.SUCCESS_EMOJIS[True])
|
||||
await context.send('Unable to send invite in DMs. Please allow DMs from server members.')
|
||||
|
||||
def setup(bot):
|
||||
|
|
|
@ -27,4 +27,17 @@
|
|||
'user_agent': 'EmojiManagerBot (https://github.com/bmintz/emoji-manager-bot)',
|
||||
|
||||
'ec_api_url': 'https://emoji-connoisseur.python-for.life/api/v0',
|
||||
|
||||
# emotes that the bot may use to respond to you
|
||||
# If not provided, the bot will use ('❌', '✅') instead.
|
||||
#
|
||||
# You can obtain these ones from the discordbots.org server under the name "tickNo" and "tickYes"
|
||||
# but I uploaded them to my test server
|
||||
# so that both the staging and the stable versions of the bot can use them
|
||||
'response_emotes': {
|
||||
'success': { # emotes used to indicate success or failure
|
||||
False: '<:error:478164511879069707>',
|
||||
True: '<:success:478164452261363712>'
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class MissingManageEmojisPermission(commands.MissingPermissions):
|
|||
|
||||
def __init__(self):
|
||||
super(Exception, self).__init__(
|
||||
f'{utils.SUCCESS_EMOTES[False]} '
|
||||
f'{utils.SUCCESS_EMOJIS[False]} '
|
||||
"Sorry, you don't have enough permissions to run this command. "
|
||||
'You and I both need the Manage Emojis permission.')
|
||||
|
||||
|
|
|
@ -5,11 +5,6 @@ import discord
|
|||
|
||||
"""various utilities for use within the bot"""
|
||||
|
||||
"""Emotes used to indicate success/failure. You can obtain these from the discordbots.org guild,
|
||||
but I uploaded them to my test server
|
||||
so that both the staging and the stable versions of the bot can use them"""
|
||||
SUCCESS_EMOTES = ('<:error:416845770239508512>', '<:success:416845760810844160>')
|
||||
|
||||
def format_user(bot, id, *, mention=False):
|
||||
"""Format a user ID for human readable display."""
|
||||
user = bot.get_user(id)
|
||||
|
|
Loading…
Reference in a new issue