def heartbeat(self, ctx):
"""Write to the console and attempt to send a message (owner only)."""
author = ctx.message.author
server = ctx.message.server
channel = ctx.message.channel
try:
owner = self.settings.serverDict['Owner']
except KeyError:
owner = None
if owner == None:
# No previous owner, let's set them
msg = 'I cannot adjust debugging until I have an owner.'
await self.bot.send_message(channel, msg)
return
if not author.id == owner:
# Not the owner
msg = 'You are not the *true* owner of me. Only the rightful owner can change this setting.'
await self.bot.send_message(channel, msg)
return
timeStamp = datetime.today().strftime("%Y-%m-%d %H.%M")
print('Heartbeat tested at {}.'.format(timeStamp))
# Message send
message = await self.bot.send_message(ctx.message.channel, 'Heartbeat tested at {}.'.format(timeStamp))
if message:
print('Message:\n{}'.format(message))
else:
print('No message returned.')
评论列表
文章目录