76 lines
2.6 KiB
Python
Executable File
76 lines
2.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import discord
|
|
import roll
|
|
import utils
|
|
from students import *
|
|
|
|
|
|
bot = discord.Bot()
|
|
|
|
|
|
@bot.event
|
|
async def on_ready():
|
|
print(f"{bot.user} is ready and online!")
|
|
|
|
|
|
@bot.slash_command(name="banner-list", description="List current banners")
|
|
async def banner_list(ctx: discord.ApplicationContext):
|
|
message = """Available banners:
|
|
1. Standard
|
|
"""
|
|
for i in range(len(CURRENT_BANNER)):
|
|
line = f"{i+1}. {CURRENT_BANNER[i]['SSR']}\n"
|
|
message += line
|
|
|
|
await ctx.respond(message)
|
|
|
|
|
|
@bot.slash_command(name="single-pull", description="Single pull in a banner")
|
|
async def single_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
|
if not utils.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:
|
|
student_get = roll.regular()
|
|
else:
|
|
student_get = roll.rate_up(CURRENT_BANNER[banner_number-2]['SSR'], False, CURRENT_BANNER[banner_number-2]['SR'])
|
|
await ctx.respond(utils.generate_student_roll_string(student_get))
|
|
|
|
|
|
@bot.slash_command(name="multi-pull", description="Multi pull in a banner")
|
|
async def multi_pull(ctx: discord.ApplicationContext, banner_number: discord.Option(int)):
|
|
if not utils.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:
|
|
student_get = roll.regular_multi()
|
|
else:
|
|
student_get = roll.rate_up_multi(CURRENT_BANNER[banner_number-2]['SSR'], CURRENT_BANNER[banner_number-2]['SR'])
|
|
await ctx.respond(utils.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 utils.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(utils.generate_spark_summary_string(student_get))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
bot.run(os.environ.get("BOT_TOKEN"))
|