playing: Add playing

Also this commit includes DRAM optimization (aka I sneakily cleaned
tomGER's code a bit)~
This commit is contained in:
Ave Ozkal 2018-12-23 20:36:40 +03:00
parent b67ddda4f1
commit 5d54ac7aec
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
4 changed files with 34 additions and 18 deletions

View file

@ -31,7 +31,7 @@ Based on https://gitlab.com/ao/dpybotbase
- [ ] Moderation: timelock (channel lockdown with time)
- [ ] Moderation: mute-unmute
- [ ] Moderation: mutetime
- [ ] Moderation: playing
- [x] Moderation: playing
- [ ] Moderation: botnickname
- [ ] Moderation: nickname
- [ ] Moderation: clear/purge

View file

@ -47,7 +47,7 @@ initial_extensions = ['cogs.common',
'cogs.meme']
bot = commands.Bot(command_prefix=get_prefix,
description=config.bot_description, pm_help=None)
description=config.bot_description, pm_help=True)
bot.log = log
bot.config = config

View file

@ -4,6 +4,7 @@ import discord
from discord.ext import commands
from data.errcodes import *
class Err:
"Everything related to Nintendo 3DS, Wii U and Switch error codes"
@ -12,7 +13,6 @@ class Err:
self.dds_re = re.compile(r'0\d{2}\-\d{4}')
self.wiiu_re = re.compile(r'1\d{2}\-\d{4}')
self.switch_re = re.compile(r'2\d{3}\-\d{4}')
print("Err has been loaded!")
@commands.command(aliases=["nxerr", "serr", "nin_err"])
async def err(self, ctx, err: str):
@ -23,9 +23,11 @@ class Err:
if err in dds_errcodes:
err_description = dds_errcodes[err]
else:
err_description = "It seems like your error code is unknown. You should report relevant details to <@141532589725974528> so it can be added to the bot."
err_description = "It seems like your error code is unknown. You should report relevant details to <@141532589725974528> (tomGER) so it can be added to the bot."
# Make a nice Embed out of it
embed = discord.Embed(title=err, url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=err_description)
embed = discord.Embed(title=err,
url="https://www.youtube.com/watch?v=x3yXlomPCmU",
description=err_description)
embed.set_footer(text="Console: 3DS")
# Send message, crazy
@ -110,7 +112,7 @@ class Err:
await ctx.send(embed=embed)
elif err in switch_game_err: # Special Case Handling because Nintendo feels like its required to break their format lol
game,desc = switch_game_err[err].split(":")
game, desc = switch_game_err[err].split(":")
embed = discord.Embed(title=err, url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=desc)
embed.set_footer(text="Console: Switch")

View file

@ -92,6 +92,7 @@ class ModCog:
await modlog_channel.send(chan_message)
await ctx.send(f"{safe_name} is now b&. 👍")
@commands.guild_only()
@commands.bot_has_permissions(ban_members=True)
@commands.check(check_if_staff)
@commands.command()
@ -118,6 +119,7 @@ class ModCog:
modlog_channel = self.bot.get_channel(config.modlog_channel)
await modlog_channel.send(chan_message)
@commands.guild_only()
@commands.check(check_if_staff)
@commands.command()
async def userinfo(self, ctx, *, user: discord.Member):
@ -136,6 +138,18 @@ class ModCog:
f"color = {user.colour}\n"
f"top_role = {role}\n")
@commands.guild_only()
@commands.check(check_if_staff)
@commands.command(aliases=["setplaying", "setgame"])
async def playing(self, ctx, *, game: str = ""):
"""Sets the currently played game name, staff only.
Just send .playing to wipe the playing state."""
if game:
await self.bot.change_presence(activity=discord.Game(name=game))
else:
await self.bot.change_presence(activity=None)
def setup(bot):
bot.add_cog(ModCog(bot))