1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-25 14:47:29 +00:00

Added config option "playing"

This commit is contained in:
Myned 2017-10-16 14:07:10 -04:00
parent f610a341be
commit dabd472753
3 changed files with 19 additions and 13 deletions

View file

@ -437,8 +437,7 @@ class MsG:
raise exc.GoTo raise exc.GoTo
elif reaction.emoji == '' and reaction.message.content == paginator.content and (user is ctx.author or user.id == u.config['owner_id']): elif reaction.emoji == '' and reaction.message.content == paginator.content and (user is ctx.author or user.id == u.config['owner_id']):
raise exc.Right raise exc.Right
else: return False
return False
def on_message(msg): def on_message(msg):
with suppress(ValueError): with suppress(ValueError):
@ -611,8 +610,7 @@ class MsG:
raise exc.GoTo raise exc.GoTo
elif reaction.emoji == '' and reaction.message.content == paginator.content and (user is ctx.author or user.id == u.config['owner_id']): elif reaction.emoji == '' and reaction.message.content == paginator.content and (user is ctx.author or user.id == u.config['owner_id']):
raise exc.Right raise exc.Right
else: return False
return False
def on_message(msg): def on_message(msg):
with suppress(ValueError): with suppress(ValueError):

View file

@ -59,17 +59,20 @@ class Bot:
async def invite(self, ctx): async def invite(self, ctx):
await ctx.send('🔗 https://discordapp.com/oauth2/authorize?&client_id={}&scope=bot&permissions={}'.format(u.config['client_id'], u.config['permissions']), delete_after=10) await ctx.send('🔗 https://discordapp.com/oauth2/authorize?&client_id={}&scope=bot&permissions={}'.format(u.config['client_id'], u.config['permissions']), delete_after=10)
@commands.command(aliases=['presence', 'game'], hidden=True) @commands.command(name=',status', aliases=[',presence', ',game'], hidden=True)
@commands.is_owner() @commands.is_owner()
@checks.del_ctx() @checks.del_ctx()
async def status(self, ctx, game): async def status(self, ctx, *, game=None):
try: if game is not None:
if game is not None: await self.bot.change_presence(game=d.Game(name=game))
await self.bot.change_presence(game=d.Game(name=game)) u.config['playing'] = game
else: u.dump(u.config, 'config.json', json=True)
raise exc.NotFound else:
except exc.NotFound: await self.bot.change_presence(game=None)
await ctx.send('❌ **No game given.**', delete_after=10) u.config['playing'] = 'None'
u.dump(u.config, 'config.json', json=True)
await ctx.message.add_reaction('')
class Tools: class Tools:

View file

@ -34,6 +34,11 @@ async def on_ready():
# bot.loop.create_task(u.clear(booru.temp_urls, 30*60)) # bot.loop.create_task(u.clear(booru.temp_urls, 30*60))
if u.config['playing'] is not 'None':
await bot.change_presence(game=d.Game(name=u.config['playing']))
else:
await bot.change_presence(game=None)
if isinstance(bot.get_channel(u.config['startup_channel']), d.TextChannel): if isinstance(bot.get_channel(u.config['startup_channel']), d.TextChannel):
await bot.get_channel(u.config['startup_channel']).send('**Started** ☀️ .') await bot.get_channel(u.config['startup_channel']).send('**Started** ☀️ .')
print('\n\\ \\ \\ \\ \\ \\ \\ \\ \\\nC O N N E C T E D : {}\n/ / / / / / / / /\n'.format(bot.user.name)) print('\n\\ \\ \\ \\ \\ \\ \\ \\ \\\nC O N N E C T E D : {}\n/ / / / / / / / /\n'.format(bot.user.name))