ryuko-ng/cogs/mod_note.py
noirscape b9255215c1 This implements the latest breaking changes to cogs from d.py rewrite.
They're all syntax changes and renames. I've checked twice to make sure
I didn't miss any listeners or classes.

For future reference:
- Do `from discord.ext.commands import Cog` in all new cogs.
- Subclass the new class to Cog.
- New listeners should get the `@Cog.listener()` decorator.

Conveniently, there weren't any pre-execution methods that have been
renamed.
2019-02-28 23:10:30 +01:00

32 lines
1,007 B
Python

import discord
from discord.ext import commands
from discord.ext.commands import Cog
from helpers.checks import check_if_staff
from helpers.userlogs import userlog
class ModNote(Cog):
def __init__(self, bot):
self.bot = bot
@commands.guild_only()
@commands.check(check_if_staff)
@commands.command(aliases=["addnote"])
async def note(self, ctx, target: discord.Member, *, note: str = ""):
"""Adds a note to a user, staff only."""
userlog(target.id, ctx.author, note,
"notes", target.name)
await ctx.send(f"{ctx.author.mention}: noted!")
@commands.guild_only()
@commands.check(check_if_staff)
@commands.command(aliases=["addnoteid"])
async def noteid(self, ctx, target: int, *, note: str = ""):
"""Adds a note to a user by userid, staff only."""
userlog(target, ctx.author, note,
"notes")
await ctx.send(f"{target.mention}: noted!")
def setup(bot):
bot.add_cog(ModNote(bot))