2019-03-02 18:00:55 +00:00
|
|
|
import discord
|
|
|
|
from discord.ext import commands
|
|
|
|
from discord.ext.commands import Cog
|
2023-03-09 22:01:10 +00:00
|
|
|
|
|
|
|
from robocop_ng.helpers.checks import check_if_staff
|
|
|
|
from robocop_ng.helpers.userlogs import setwatch
|
2019-03-02 18:00:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ModWatch(Cog):
|
|
|
|
def __init__(self, bot):
|
|
|
|
self.bot = bot
|
|
|
|
|
|
|
|
@commands.guild_only()
|
|
|
|
@commands.check(check_if_staff)
|
|
|
|
@commands.command()
|
|
|
|
async def watch(self, ctx, target: discord.Member, *, note: str = ""):
|
|
|
|
"""Puts a user under watch, staff only."""
|
2023-04-05 10:10:18 +00:00
|
|
|
setwatch(self.bot, target.id, ctx.author, True, target.name)
|
2019-03-02 18:00:55 +00:00
|
|
|
await ctx.send(f"{ctx.author.mention}: user is now on watch.")
|
|
|
|
|
|
|
|
@commands.guild_only()
|
|
|
|
@commands.check(check_if_staff)
|
|
|
|
@commands.command()
|
|
|
|
async def watchid(self, ctx, target: int, *, note: str = ""):
|
|
|
|
"""Puts a user under watch by userid, staff only."""
|
2023-04-05 10:10:18 +00:00
|
|
|
setwatch(self.bot, target, ctx.author, True, target.name)
|
2019-03-02 18:00:55 +00:00
|
|
|
await ctx.send(f"{target.mention}: user is now on watch.")
|
|
|
|
|
|
|
|
@commands.guild_only()
|
|
|
|
@commands.check(check_if_staff)
|
|
|
|
@commands.command()
|
|
|
|
async def unwatch(self, ctx, target: discord.Member, *, note: str = ""):
|
|
|
|
"""Removes a user from watch, staff only."""
|
2023-04-05 10:10:18 +00:00
|
|
|
setwatch(self.bot, target.id, ctx.author, False, target.name)
|
2019-03-02 18:00:55 +00:00
|
|
|
await ctx.send(f"{ctx.author.mention}: user is now not on watch.")
|
|
|
|
|
|
|
|
@commands.guild_only()
|
|
|
|
@commands.check(check_if_staff)
|
|
|
|
@commands.command()
|
|
|
|
async def unwatchid(self, ctx, target: int, *, note: str = ""):
|
|
|
|
"""Removes a user from watch by userid, staff only."""
|
2023-04-05 10:10:18 +00:00
|
|
|
setwatch(self.bot, target, ctx.author, False, target.name)
|
2019-03-02 18:00:55 +00:00
|
|
|
await ctx.send(f"{target.mention}: user is now not on watch.")
|
|
|
|
|
|
|
|
|
2022-05-24 18:35:42 +00:00
|
|
|
async def setup(bot):
|
|
|
|
await bot.add_cog(ModWatch(bot))
|