playing: Add playing
Also this commit includes DRAM optimization (aka I sneakily cleaned tomGER's code a bit)~
This commit is contained in:
parent
b67ddda4f1
commit
5d54ac7aec
4 changed files with 34 additions and 18 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
22
cogs/err.py
22
cogs/err.py
|
@ -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,26 +13,27 @@ 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):
|
||||
"""Searches for Nintendo 3DS, Switch and Wii U error codes!
|
||||
Usage: .serr/.nxerr/.nin_err/.err <Error Code>"""
|
||||
|
||||
if self.dds_re.match(err): # 3DS - dds -> Drei DS -> Three DS
|
||||
if self.dds_re.match(err): # 3DS - dds -> Drei DS -> Three DS
|
||||
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
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
elif err.startswith("0x"): # These are not similar to the other errors apperently ... ?
|
||||
elif err.startswith("0x"): # These are not similar to the other errors apperently ... ?
|
||||
derr = err[2:]
|
||||
derr = derr.strip()
|
||||
rc = int(derr, 16)
|
||||
|
@ -51,8 +53,8 @@ class Err:
|
|||
await ctx.send(embed=embed)
|
||||
return
|
||||
|
||||
elif self.wiiu_re.match(err): # Wii U
|
||||
module = err[2:3] # Is that even true, idk just guessing
|
||||
elif self.wiiu_re.match(err): # Wii U
|
||||
module = err[2:3] # Is that even true, idk just guessing
|
||||
desc = err[5:8]
|
||||
if err in wii_u_errors:
|
||||
err_description = wii_u_errors[err]
|
||||
|
@ -68,7 +70,7 @@ class Err:
|
|||
# Send message, crazy
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
if self.switch_re.match(err) or err.startswith("0x"): # Switch
|
||||
if self.switch_re.match(err) or err.startswith("0x"): # Switch
|
||||
|
||||
if err.startswith("0x"):
|
||||
err = err[2:]
|
||||
|
@ -109,8 +111,8 @@ class Err:
|
|||
# Send message, crazy
|
||||
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(":")
|
||||
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(":")
|
||||
|
||||
embed = discord.Embed(title=err, url="https://www.youtube.com/watch?v=x3yXlomPCmU", description=desc)
|
||||
embed.set_footer(text="Console: Switch")
|
||||
|
|
14
cogs/mod.py
14
cogs/mod.py
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue