Skip to content

Commit 451413c

Browse files
committed
Allow specifying event time on createsidequick
1 parent fd46317 commit 451413c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

commandListener.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,30 @@ async def createside(self, ctx: Context, date: EventDateTime, force=None):
232232
@command(aliases=['csq'])
233233
async def createsidequick(self, ctx: Context, date: EventDateTime,
234234
terrain: str, faction: str, zeus: Member,
235-
force=None):
235+
time: str = None):
236236
"""
237237
Create and pre-fill a side op event.
238238
239239
Use the `force` argument to create past events.
240240
241+
Accepted formats for the optional `time` argument: HH:MM and HHMM. Default time: 18:45
242+
241243
Example: createsidequick 2019-01-01 Altis USMC Stroker
242-
createsidequick 2019-01-01 Altis USMC Stroker force
243-
"""
244+
createsidequick 2019-01-01 Altis USMC Stroker 17:45
245+
""" # NOQA
246+
force = False
247+
if time is not None:
248+
try:
249+
hour = int(time[0:2])
250+
minute = int(time[-2:])
251+
except ValueError:
252+
raise BadArgument(
253+
"Bad time format {}. "
254+
"Accepted time formats are HH:MM and HHMM"
255+
.format(time))
256+
date = date.replace(hour=hour, minute=minute)
257+
force = True
258+
244259
event = await self._create_event(
245260
ctx, date, sideop=True, force=force, batch=True)
246261
message = await msgFnc.createEventMessage(

0 commit comments

Comments
 (0)