From c3a0d7dfe29d4310c0de5173048af0248d45ecff Mon Sep 17 00:00:00 2001 From: EEKIM10 Date: Thu, 6 Oct 2022 09:48:43 +0100 Subject: [PATCH] Add rebind command --- cogs/verify.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cogs/verify.py b/cogs/verify.py index 39d5cef..f23f5fd 100644 --- a/cogs/verify.py +++ b/cogs/verify.py @@ -2,7 +2,7 @@ import discord import orm import re from discord.ext import commands -from utils import VerifyCode, Student, VerifyView +from utils import VerifyCode, Student, VerifyView, get_or_none import config @@ -72,6 +72,17 @@ class VerifyCog(commands.Cog): allowed_mentions=discord.AllowedMentions.none() ) + @commands.command(name="rebind") + @commands.is_owner() + async def rebind_code(self, ctx: commands.Context, b_number: str, *, user: discord.Member): + # noinspection GrazieInspection + """Changes which account a B number is bound to""" + student = await get_or_none(Student, id=b_number.upper()) + if student: + await student.update(user_id=user.id) + return await ctx.message.add_reaction("\N{white heavy check mark}") + await ctx.message.add_reaction("\N{cross mark}") + def setup(bot): bot.add_cog(VerifyCog(bot))