mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Fix force verify command
This commit is contained in:
parent
6f0e07807b
commit
cd17bc39cc
1 changed files with 9 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
import discord
|
||||
import orm
|
||||
from discord.ext import commands
|
||||
from utils import VerifyCode, Student, VerifyView, get_or_none
|
||||
from utils import VerifyCode, Student, VerifyView, get_or_none, console
|
||||
|
||||
|
||||
class VerifyCog(commands.Cog):
|
||||
|
@ -59,11 +59,15 @@ class VerifyCog(commands.Cog):
|
|||
@commands.guild_only()
|
||||
async def verification_force(self, ctx: commands.Context, user: discord.Member, _id: str, name: str):
|
||||
"""Manually verifies someone"""
|
||||
await Student.objects.create(id=_id, user_id=user.id, name=name)
|
||||
existing = await Student.objects.create(id=_id, user_id=user.id, name=name)
|
||||
role = discord.utils.find(lambda r: r.name.lower() == "verified", ctx.guild.roles)
|
||||
if role and role < ctx.me.top_role:
|
||||
member = await ctx.guild.fetch_member(ctx.author.id)
|
||||
await member.add_roles(role, reason="Verified")
|
||||
if role and role < ctx.guild.me.top_role:
|
||||
await user.add_roles(role, reason="Verified")
|
||||
try:
|
||||
await user.edit(nick=f"{existing.name}", reason="Verified")
|
||||
except discord.HTTPException:
|
||||
pass
|
||||
console.log(f"[green]{ctx.author} verified {user} ({user.id}/{existing.student_id})")
|
||||
await ctx.message.delete(delay=10)
|
||||
return await ctx.reply(
|
||||
"\N{white heavy check mark} Verification complete!",
|
||||
|
|
Loading…
Reference in a new issue