Add B number fetch

This commit is contained in:
EEKIM10 2022-10-04 15:06:43 +01:00
parent 2f59a787a7
commit 6cf0d77ef7
2 changed files with 17 additions and 1 deletions

View file

@ -114,6 +114,22 @@ class VerifyCog(commands.Cog):
"\N{white heavy check mark} Verification complete!", "\N{white heavy check mark} Verification complete!",
) )
@commands.user_command(name="B Number")
@discord.guild_only()
async def get_b_number(self, ctx: discord.ApplicationContext, member: discord.Member):
try:
student: Student = await Student.objects.get(user_id=ctx.author.id)
return await ctx.respond(
f"{member.mention}'s B number is saved as {student.id!r}.",
allowed_mentions=discord.AllowedMentions.none()
)
except orm.NoMatch:
pass
return await ctx.respond(
f"{member.mention} has no saved B number.",
allowed_mentions=discord.AllowedMentions.none()
)
def setup(bot): def setup(bot):
bot.add_cog(VerifyCog(bot)) bot.add_cog(VerifyCog(bot))

View file

@ -13,7 +13,7 @@ async def send_verification_code(user: discord.User, student_number: str, **kwar
"""Sends a verification code, returning said verification code, to the student.""" """Sends a verification code, returning said verification code, to the student."""
code = secrets.token_hex(16) code = secrets.token_hex(16)
text = ( text = (
f"Hey {user} ({student_number})! The code to join the hi^5 code is '{code}' - use " f"Hey {user} ({student_number})! The code to join the Unscrupulous Nonsense is '{code}' - use "
f"'/verify {code}' in the bot's DMs to continue \N{dancer}\n\n~nex" f"'/verify {code}' in the bot's DMs to continue \N{dancer}\n\n~nex"
) )
msg = EmailMessage() msg = EmailMessage()