mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-19 18:16:34 +01:00
Add B number fetch
This commit is contained in:
parent
2f59a787a7
commit
6cf0d77ef7
2 changed files with 17 additions and 1 deletions
|
@ -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))
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue