44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
from discord.ext import commands
|
|
from services.torn_api import update_enemy_faction, update_friendly_faction
|
|
|
|
|
|
class HitCommands(commands.Cog):
|
|
def __init__(self, bot, enrolled_attackers, enemy_queue):
|
|
self.bot = bot
|
|
self.enrolled_attackers = enrolled_attackers
|
|
self.enemy_queue = enemy_queue
|
|
|
|
@commands.command()
|
|
async def enroll(self, ctx):
|
|
user_id = ctx.author.id
|
|
if user_id in self.enrolled_attackers:
|
|
await ctx.send("You are already enrolled.")
|
|
return
|
|
self.enrolled_attackers.append(user_id)
|
|
await ctx.send(f"{ctx.author.mention} has been enrolled in the hit rotation!")
|
|
|
|
@commands.command()
|
|
async def drop(self, ctx):
|
|
user_id = ctx.author.id
|
|
if user_id not in self.enrolled_attackers:
|
|
await ctx.send("You are not enrolled.")
|
|
return
|
|
self.enrolled_attackers.remove(user_id)
|
|
await ctx.send(f"{ctx.author.mention} has been removed from the rotation.")
|
|
|
|
|
|
@commands.command()
|
|
async def update_enemy(self, ctx):
|
|
success = await update_enemy_faction()
|
|
if success:
|
|
await ctx.send("Enemy faction data updated with estimated stats!")
|
|
else:
|
|
await ctx.send("Failed to update enemy faction data.")
|
|
|
|
@commands.command()
|
|
async def update_friendly(self, ctx):
|
|
success = await update_friendly_faction()
|
|
if success:
|
|
await ctx.send("Friendly faction data updated with estimated stats!")
|
|
else:
|
|
await ctx.send("Failed to update friendly faction data.") |