Add force_spawn_duck for admin ducklaunch - fixes missing method error

This commit is contained in:
3nd3r
2025-12-28 16:51:26 -06:00
parent dd06c9377f
commit 90b604ba72

View File

@@ -165,6 +165,52 @@ class DuckGame:
self.ducks[channel].append(duck)
self.bot.send_message(channel, message)
async def force_spawn_duck(self, channel, duck_type='normal'):
"""Force spawn a specific duck type (admin command)"""
if channel not in self.ducks:
self.ducks[channel] = []
# Validate duck type
duck_type = (duck_type or 'normal').lower()
if duck_type not in ['normal', 'golden', 'fast']:
duck_type = 'normal'
# Create the specified duck type
if duck_type == 'golden':
min_hp = self.bot.get_config('golden_duck_min_hp', 3)
max_hp = self.bot.get_config('golden_duck_max_hp', 5)
hp = random.randint(min_hp, max_hp)
duck = {
'id': f"golden_duck_{int(time.time())}_{random.randint(1000, 9999)}",
'spawn_time': time.time(),
'channel': channel,
'duck_type': 'golden',
'max_hp': hp,
'current_hp': hp
}
elif duck_type == 'fast':
duck = {
'id': f"fast_duck_{int(time.time())}_{random.randint(1000, 9999)}",
'spawn_time': time.time(),
'channel': channel,
'duck_type': 'fast',
'max_hp': 1,
'current_hp': 1
}
else: # normal
duck = {
'id': f"duck_{int(time.time())}_{random.randint(1000, 9999)}",
'spawn_time': time.time(),
'channel': channel,
'duck_type': 'normal',
'max_hp': 1,
'current_hp': 1
}
self.ducks[channel].append(duck)
message = self.bot.messages.get('duck_spawn')
self.bot.send_message(channel, message)
def shoot_duck(self, nick, channel, player):
"""Handle shooting at a duck"""
# Check if gun is confiscated