Add 200-pull command

This commit is contained in:
Syahrial Agni Prasetya 2024-09-30 07:55:32 +00:00
parent 833d3eebbb
commit fa5c6ece7c
Signed by: lemniskett
GPG Key ID: 24260130A908EB5A

36
main.py
View File

@ -7,15 +7,13 @@ from students import *
bot = discord.Bot()
def generate_student_roll_string(student_get):
emojis = {
'R': '🟦',
'SR': '🟨',
'SSR': '🟪'
}
def generate_student_roll_string(student_get):
message = ""
for i in range(len(student_get)):
rate_up_message = ""
@ -27,6 +25,22 @@ def generate_student_roll_string(student_get):
return message
def generate_spark_summary_string(student_get):
message = ""
for ten_pulls in student_get:
line = ""
ssr_students = []
for student in ten_pulls:
line += emojis[student['rarity']]
if student['rarity'] == 'SSR':
rate_up_message = ""
if student['pickup']:
rate_up_message = " (Pick up!)"
ssr_students.append(student['name'] + rate_up_message)
message += line + " " + ", ".join(ssr_students) + "\n"
return message
def validate_banner_number(banner_number):
banner_amount = len(CURRENT_BANNER) + 1
return banner_number <= banner_amount
@ -77,5 +91,21 @@ async def multi_pull(ctx: discord.ApplicationContext, banner_number: discord.Opt
await ctx.respond(generate_student_roll_string(student_get))
@bot.slash_command(name="200-pull", description="200 pull in a banner")
async def two_hundred_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
if not validate_banner_number(banner_number):
await ctx.respond("Please respond with a valid banner number, use /banner-list to see current banners")
return'
student_get = []
if banner_number == 1:
for i in range(20):
student_get.append(roll.regular_multi())
else:
for i in range(20):
student_get.append(roll.rate_up_multi(CURRENT_BANNER[banner_number-2]['SSR'], CURRENT_BANNER[banner_number-2]['SR']))
await ctx.respond(generate_spark_summary_string(student_get))
if __name__ == '__main__':
bot.run(os.environ.get("BOT_TOKEN"))