maple/storage/bot/plugins/datetime_plugin.py

75 lines
3.0 KiB
Python
Raw Normal View History

2023-03-15 17:24:49 +00:00
# -*- coding: utf-8 -*- ############################################################### SOF
###########################################################################################
from irc3.plugins.command import command
import irc3
from datetime import datetime as dt
2023-03-26 20:46:52 +00:00
from tool_colors_plugin import colorform as print
2023-03-15 17:24:49 +00:00
###########################################################################################
###########################################################################################
@irc3.plugin
class Plugin:
#######################################################################################
#######################################################################################
def __init__(self, bot):
2023-03-26 20:46:52 +00:00
print('[ loaded ]')
self.bot = bot
2023-03-15 17:24:49 +00:00
#######################################################################################
#######################################################################################
@classmethod
def reload(cls, old):
return cls(old.bot)
#######################################################################################
#######################################################################################
def before_reload(self):
pass
#######################################################################################
2023-03-15 21:21:19 +00:00
#######################################################################################
def after_reload(self):
pass
#######################################################################################
#######################################################################################
@classmethod
def reload(cls, old):
return cls(old.bot)
#######################################################################################
#######################################################################################
def before_reload(self):
pass
#######################################################################################
2023-03-15 17:24:49 +00:00
#######################################################################################
def after_reload(self):
pass
#######################################################################################
#######################################################################################
@command(permission='view')
def time(self, mask, target, args):
"""Show local server datetime info
%%time
"""
msg = "LOCAL SERVER TIME: {HOUR}:{MINUTE} {MONTH}/{DAY}/{YEAR}"
TIME = dt.now()
msg = msg.format(HOUR=TIME.hour,MINUTE=TIME.minute,MONTH=TIME.month,DAY=TIME.day,YEAR=TIME.year)
self.bot.privmsg(target,self.bot.emo(msg))
###########################################################################################
####################################################################################### EOF