mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2024-12-23 06:15:31 +00:00
Add .mywarns
This commit is contained in:
parent
fef08b1dbf
commit
5dbe7a43f7
|
@ -6,7 +6,7 @@ import re
|
|||
from cogs.checks import check_if_bot_manager
|
||||
|
||||
|
||||
class AdminCog:
|
||||
class Admin:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
self.last_eval_result = None
|
||||
|
@ -14,7 +14,7 @@ class AdminCog:
|
|||
|
||||
@commands.guild_only()
|
||||
@commands.check(check_if_bot_manager)
|
||||
@commands.command(name='exit', hidden=True)
|
||||
@commands.command(name='exit')
|
||||
async def _exit(self, ctx):
|
||||
"""Shuts down the bot, bot manager only."""
|
||||
await ctx.send(":wave: Goodbye!")
|
||||
|
@ -22,7 +22,7 @@ class AdminCog:
|
|||
|
||||
@commands.guild_only()
|
||||
@commands.check(check_if_bot_manager)
|
||||
@commands.command(hidden=True)
|
||||
@commands.command()
|
||||
async def load(self, ctx, ext: str):
|
||||
"""Loads a cog, bot manager only."""
|
||||
try:
|
||||
|
@ -36,7 +36,7 @@ class AdminCog:
|
|||
|
||||
@commands.guild_only()
|
||||
@commands.check(check_if_bot_manager)
|
||||
@commands.command(hidden=True)
|
||||
@commands.command()
|
||||
async def fetchlog(self, ctx):
|
||||
"""Returns log"""
|
||||
await ctx.send("This is currently broken.")
|
||||
|
@ -45,7 +45,7 @@ class AdminCog:
|
|||
|
||||
@commands.guild_only()
|
||||
@commands.check(check_if_bot_manager)
|
||||
@commands.command(name='eval', hidden=True)
|
||||
@commands.command(name='eval')
|
||||
async def _eval(self, ctx, *, code: str):
|
||||
"""Evaluates some code, bot manager only."""
|
||||
try:
|
||||
|
@ -99,7 +99,7 @@ class AdminCog:
|
|||
|
||||
@commands.guild_only()
|
||||
@commands.check(check_if_bot_manager)
|
||||
@commands.command(hidden=True)
|
||||
@commands.command()
|
||||
async def pull(self, ctx, auto=False):
|
||||
"""Does a git pull, bot manager only."""
|
||||
tmp = await ctx.send('Pulling...')
|
||||
|
@ -121,7 +121,7 @@ class AdminCog:
|
|||
|
||||
@commands.guild_only()
|
||||
@commands.check(check_if_bot_manager)
|
||||
@commands.command(hidden=True)
|
||||
@commands.command()
|
||||
async def unload(self, ctx, ext: str):
|
||||
"""Unloads a cog, bot manager only."""
|
||||
self.bot.unload_extension("cogs." + ext)
|
||||
|
@ -129,7 +129,7 @@ class AdminCog:
|
|||
await ctx.send(f':white_check_mark: `{ext}` successfully unloaded.')
|
||||
|
||||
@commands.check(check_if_bot_manager)
|
||||
@commands.command(hidden=True)
|
||||
@commands.command()
|
||||
async def reload(self, ctx, ext="_"):
|
||||
"""Reloads a cog, bot manager only."""
|
||||
if ext == "_":
|
||||
|
@ -149,4 +149,4 @@ class AdminCog:
|
|||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(AdminCog(bot))
|
||||
bot.add_cog(Admin(bot))
|
||||
|
|
19
cogs/meme.py
19
cogs/meme.py
|
@ -25,13 +25,30 @@ class Meme:
|
|||
@commands.command(hidden=True, name="warm")
|
||||
async def warm_member(self, ctx, user: discord.Member):
|
||||
"""Warms a user :3"""
|
||||
celsius = random.randint(0, 100)
|
||||
celsius = random.randint(15, 100)
|
||||
fahrenheit = self.c_to_f(celsius)
|
||||
kelvin = self.c_to_k(celsius)
|
||||
await ctx.send(f"{user.mention} warmed."
|
||||
f" User is now {celsius}°C "
|
||||
f"({fahrenheit}°F, {kelvin}K).")
|
||||
|
||||
@commands.check(check_if_staff_or_ot)
|
||||
@commands.command(hidden=True, name="chill", aliases=["cold"])
|
||||
async def chill_member(self, ctx, user: discord.Member):
|
||||
"""Chills a user >:3"""
|
||||
celsius = random.randint(-50, 15)
|
||||
fahrenheit = self.c_to_f(celsius)
|
||||
kelvin = self.c_to_k(celsius)
|
||||
await ctx.send(f"{user.mention} chilled."
|
||||
f" User is now {celsius}°C "
|
||||
f"({fahrenheit}°F, {kelvin}K).")
|
||||
|
||||
@commands.check(check_if_staff_or_ot)
|
||||
@commands.command(hidden=True)
|
||||
async def yahaha(self, ctx):
|
||||
"""secret command"""
|
||||
await ctx.send(f"🍂 you found me 🍂")
|
||||
|
||||
@commands.check(check_if_staff_or_ot)
|
||||
@commands.command(hidden=True, name="bam")
|
||||
async def bam_member(self, ctx, user: discord.Member):
|
||||
|
|
47
cogs/mod.py
47
cogs/mod.py
|
@ -6,7 +6,7 @@ import time
|
|||
from cogs.checks import check_if_staff
|
||||
|
||||
|
||||
class ModCog:
|
||||
class Mod:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
|
@ -287,7 +287,7 @@ class ModCog:
|
|||
@commands.command()
|
||||
async def approve(self, ctx, target: discord.Member,
|
||||
role: str = "community"):
|
||||
"""Add a role to a user (default: community). Staff only."""
|
||||
"""Add a role to a user (default: community), staff only."""
|
||||
if role not in config.named_roles:
|
||||
return await ctx.send("No such role! Available roles: " +
|
||||
','.join(config.named_roles))
|
||||
|
@ -310,7 +310,7 @@ class ModCog:
|
|||
@commands.command(aliases=["unapprove"])
|
||||
async def revoke(self, ctx, target: discord.Member,
|
||||
role: str = "community"):
|
||||
"""Remove a role from a user (default: community). Staff only."""
|
||||
"""Remove a role from a user (default: community), staff only."""
|
||||
if role not in config.named_roles:
|
||||
return await ctx.send("No such role! Available roles: " +
|
||||
','.join(config.named_roles))
|
||||
|
@ -376,7 +376,7 @@ class ModCog:
|
|||
@commands.check(check_if_staff)
|
||||
@commands.command(aliases=["clear"])
|
||||
async def purge(self, ctx, limit: int, channel: discord.TextChannel = None):
|
||||
"""Clears a given number of messages. Staff only."""
|
||||
"""Clears a given number of messages, staff only."""
|
||||
log_channel = self.bot.get_channel(config.log_channel)
|
||||
if not channel:
|
||||
channel = ctx.channel
|
||||
|
@ -389,7 +389,7 @@ class ModCog:
|
|||
@commands.check(check_if_staff)
|
||||
@commands.command()
|
||||
async def warn(self, ctx, target: discord.Member, *, reason: str = ""):
|
||||
"""Warn a user. Staff only."""
|
||||
"""Warns a user, staff only."""
|
||||
# Hedge-proofing the code
|
||||
if target == ctx.author:
|
||||
return await ctx.send("You can't do mod actions on yourself.")
|
||||
|
@ -516,15 +516,38 @@ class ModCog:
|
|||
@commands.check(check_if_staff)
|
||||
@commands.command()
|
||||
async def listwarns(self, ctx, target: discord.Member):
|
||||
"""List warns for a user. Staff only."""
|
||||
"""Lists warns for a user, staff only."""
|
||||
embed = self.get_warns_embed_for_id(str(target.id), str(target))
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.command()
|
||||
async def mywarns(self, ctx):
|
||||
"""Lists your warns."""
|
||||
embed = discord.Embed(color=discord.Color.dark_red())
|
||||
uid = str(ctx.author.id)
|
||||
embed.set_author(name=f"{ctx.author.name}'s warns")
|
||||
with open("data/warnsv2.json", "r") as f:
|
||||
warns = json.load(f)
|
||||
try:
|
||||
if len(warns[uid]["warns"]):
|
||||
for idx, warn in enumerate(warns[uid]["warns"]):
|
||||
embed.add_field(name=f"{idx + 1}: {warn['timestamp']}",
|
||||
value=f"Reason: {warn['reason']}")
|
||||
else:
|
||||
embed.description = "There are none! Good for you."
|
||||
embed.color = discord.Color.green()
|
||||
except KeyError: # if the user is not in the file
|
||||
embed.description = "ID doesn't exist in saved "\
|
||||
"warns (there likely aren't any warns)."
|
||||
embed.color = discord.Color.green()
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
@commands.guild_only()
|
||||
@commands.check(check_if_staff)
|
||||
@commands.command()
|
||||
async def listwarnsid(self, ctx, target: int):
|
||||
"""List warns for a user by ID. Staff only."""
|
||||
"""Lists warns for a user by ID, staff only."""
|
||||
embed = self.get_warns_embed_for_id(str(target), str(target))
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
|
@ -532,7 +555,7 @@ class ModCog:
|
|||
@commands.check(check_if_staff)
|
||||
@commands.command()
|
||||
async def clearwarns(self, ctx, target: discord.Member):
|
||||
"""Clear all warns for a user. Staff only."""
|
||||
"""Clears all warns for a user, staff only."""
|
||||
log_channel = self.bot.get_channel(config.log_channel)
|
||||
msg = self.clear_warns_from_id(str(target.id))
|
||||
await ctx.send(msg)
|
||||
|
@ -545,7 +568,7 @@ class ModCog:
|
|||
@commands.check(check_if_staff)
|
||||
@commands.command()
|
||||
async def clearwarnsid(self, ctx, target: int):
|
||||
"""Clear all warns for a user from their userid. Staff only."""
|
||||
"""Clears all warns for a user from their userid, staff only."""
|
||||
log_channel = self.bot.get_channel(config.log_channel)
|
||||
msg = self.clear_warns_from_id(str(target))
|
||||
await ctx.send(msg)
|
||||
|
@ -557,7 +580,7 @@ class ModCog:
|
|||
@commands.check(check_if_staff)
|
||||
@commands.command()
|
||||
async def delwarn(self, ctx, target: discord.Member, idx: int):
|
||||
"""Remove a specific warn from a user. Staff only."""
|
||||
"""Removes a specific warn from a user, staff only."""
|
||||
log_channel = self.bot.get_channel(config.log_channel)
|
||||
del_warn = self.delete_warns_from_id(str(target.id), idx)
|
||||
# This is hell.
|
||||
|
@ -574,7 +597,7 @@ class ModCog:
|
|||
@commands.check(check_if_staff)
|
||||
@commands.command()
|
||||
async def delwarnid(self, ctx, target: int, idx: int):
|
||||
"""Remove a specific warn from a user. Staff only."""
|
||||
"""Removes a specific warn from a user, staff only."""
|
||||
log_channel = self.bot.get_channel(config.log_channel)
|
||||
del_warn = self.delete_warns_from_id(str(target), idx)
|
||||
# This is hell.
|
||||
|
@ -588,4 +611,4 @@ class ModCog:
|
|||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(ModCog(bot))
|
||||
bot.add_cog(Mod(bot))
|
||||
|
|
Loading…
Reference in a new issue