def _add_event(self, name, command, dest_server, dest_channel,
author, timedelta, repeat=False):
if isinstance(dest_server, discord.Server):
dest_server = dest_server.id
if isinstance(dest_channel, discord.Channel):
dest_channel = dest_channel.id
if isinstance(author, discord.User):
author = author.id
if dest_server not in self.events:
self.events[dest_server] = {}
event_dict = {'name': name,
'channel': dest_channel,
'author': author,
'command': command,
'timedelta': timedelta,
'repeat': repeat}
log.debug('event dict:\n\t{}'.format(event_dict))
now = int(time.time())
event_dict['starttime'] = now
self.events[dest_server][name] = event_dict.copy()
event_dict['server'] = dest_server
e = Event(event_dict.copy())
await self._put_event(e)
self.save_events()
评论列表
文章目录