From b787589ef75056d8a149b95bb602aebeffdc941c Mon Sep 17 00:00:00 2001 From: Ave Ozkal Date: Sun, 23 Dec 2018 18:07:59 +0300 Subject: [PATCH] Add userinfo, extend TODO --- README.md | 36 ++++++++++++++++++++++++++++++------ Robocop.py | 1 + cogs/mod.py | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 cogs/mod.py diff --git a/README.md b/README.md index 0ad4cd6..6ac72ff 100755 --- a/README.md +++ b/README.md @@ -12,13 +12,37 @@ Based on https://gitlab.com/ao/dpybotbase - [x] .py configs - [x] membercount command - [ ] Verification (and reset) -- [ ] Logging joins, leaves, role changes, deletes, bans, kicks -- [ ] Moderation commands (ban, kick, userinfo, approve-revoke, addhacker-removehacker, lock-softlock-timelock-unlock, mute-mutetime-unmute, playing, botnickname, nickname, clear, probate-unprobate) -- [ ] Warns system (warn, delwarnid-delwarn, listwarns-listwarnsid, clearwarns-clearwarnsid) -- [ ] User notes -- [x] Meme commands and pegaswitch (honestly the easiest part) +- [ ] Logging: joins +- [ ] Logging: leaves +- [ ] Logging: role changes +- [ ] Logging: message edits +- [ ] Logging: message deletes +- [ ] Logging: bans +- [ ] Logging: kicks +- [ ] Moderation: ban +- [ ] Moderation: kick +- [x] Moderation: userinfo +- [ ] Moderation: approve-revoke (community) +- [ ] Moderation: addhacker-removehacker +- [ ] Moderation: lock-soft-unlock (channel lockdown) +- [ ] Moderation: timelock (channel lockdown with time) +- [ ] Moderation: mute-unmute +- [ ] Moderation: mutetime +- [ ] Moderation: playing +- [ ] Moderation: botnickname +- [ ] Moderation: nickname +- [ ] Moderation: clear/purge +- [ ] Moderation: probate-unprobate +- [ ] Moderation: watch-unwatch +- [ ] Warns: warn +- [ ] Warns: delwarnid-delwarn +- [ ] Warns: listwarns-listwarnsid +- [ ] Warns: clearwarns-clearwarnsid +- [ ] Modmail +- [ ] Moderation: User notes - [ ] .serr and .err +- [x] Meme commands and pegaswitch (honestly the easiest part) - [x] source command - [ ] robocop command -- [ ] eval and sh might need to be removed +- [ ] eval and sh might need to be removed at end of development diff --git a/Robocop.py b/Robocop.py index 61f84dc..a3fa067 100755 --- a/Robocop.py +++ b/Robocop.py @@ -41,6 +41,7 @@ initial_extensions = ['cogs.common', 'cogs.admin', 'cogs.basic', 'cogs.links', + 'cogs.mod', 'cogs.meme'] bot = commands.Bot(command_prefix=get_prefix, diff --git a/cogs/mod.py b/cogs/mod.py new file mode 100644 index 0000000..9e96e8c --- /dev/null +++ b/cogs/mod.py @@ -0,0 +1,33 @@ +import discord +from discord.ext import commands +import config + + +class AdminCog: + def __init__(self, bot): + self.bot = bot + + def check_if_staff(ctx): + return any(r.id in config.staff_role_ids for r in ctx.author.roles) + + @commands.check(check_if_staff) + @commands.command() + async def userinfo(self, ctx, *, user: discord.Member): + """Gets user info, staff only.""" + role = user.top_role.name + if role == "@everyone": + role = "@ everyone" + await ctx.send(f"user = {user}\n" + f"id = {user.id}\n" + f"avatar = {user.avatar_url}\n" + f"bot = {user.bot}\n" + f"created_at = {user.created_at}\n" + f"display_name = {user.display_name}\n" + f"joined_at = {user.joined_at}\n" + f"activities = `{user.activities}`\n" + f"color = {user.colour}\n" + f"top_role = {role}\n") + + +def setup(bot): + bot.add_cog(AdminCog(bot))