Add Nick Commands

This commit is contained in:
deathbybandaid 2019-05-04 08:55:39 -04:00
parent 01bff54b98
commit ea30f8c3dd
9 changed files with 166 additions and 0 deletions

View File

@ -0,0 +1,23 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
from sopel.tools import stderr
import spicemanip
def configure(config):
pass
def setup(bot):
pass
@sopel.module.rule(r'(?i)(hi|hello|hey),? $nickname[ \t]*$')
def bot_command_hello(bot, trigger):
hello = spicemanip.main(['Hi', 'Hey', 'Hello'], "random")
punctuation = spicemanip.main(['', '!', '?'], "random")
bot.osd(hello + ' ' + trigger.nick + punctuation)

View File

@ -0,0 +1,8 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
from .FriendlyBot import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'
__version__ = '0.1.1'

View File

@ -0,0 +1,21 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
from sopel.tools import stderr
import spicemanip
def configure(config):
pass
def setup(bot):
pass
@sopel.module.nickname_commands('gender')
def bot_command_gender(bot, trigger):
bot.osd("If societal genders are binary, my gender is female")

View File

@ -0,0 +1,8 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
from .Gender import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'
__version__ = '0.1.1'

View File

@ -0,0 +1,28 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
from sopel.tools import stderr
import spicemanip
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, command_permissions_check, inlist, inlist_match
def configure(config):
pass
def setup(bot):
pass
@sopel.module.rule(r'(?i)(Fuck|Screw) (you|off),? $nickname[ \t]*$')
def bot_command_srewyou(bot, trigger):
bot.osd("Watch your mouth, " + trigger.nick + ", or I'll tell your mother!")
@sopel.module.rule(r'(?i)(Damnit|Lazy)? $nickname[ \t]*$')
def bot_command_damnlazy(bot, trigger):
bot.osd("I do not tell you how to do your job, " + trigger.nick + "!!!")

View File

@ -0,0 +1,8 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
from .InsultHandler import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'
__version__ = '0.1.1'

View File

@ -87,6 +87,42 @@ def command_permissions_check(bot, trigger, privslist):
return True
"""
Time
"""
def humanized_time(countdownseconds):
time = float(countdownseconds)
if time == 0:
return "just now"
year = time // (365 * 24 * 3600)
time = time % (365 * 24 * 3600)
day = time // (24 * 3600)
time = time % (24 * 3600)
time = time % (24 * 3600)
hour = time // 3600
time %= 3600
minute = time // 60
time %= 60
second = time
displaymsg = None
timearray = ['year', 'day', 'hour', 'minute', 'second']
for x in timearray:
currenttimevar = eval(x)
if currenttimevar >= 1:
timetype = x
if currenttimevar > 1:
timetype = str(x+"s")
if displaymsg:
displaymsg = str(displaymsg + " " + str(int(currenttimevar)) + " " + timetype)
else:
displaymsg = str(str(int(currenttimevar)) + " " + timetype)
if not displaymsg:
return "just now"
return displaymsg
"""List Manipulation Functions"""

View File

@ -0,0 +1,26 @@
# coding=utf-8
from __future__ import unicode_literals, absolute_import, division, print_function
import sopel.module
from sopel.tools import stderr
import spicemanip
import time
from sopel_modules.SpiceBot_SBTools import humanized_time
def configure(config):
pass
def setup(bot):
bot.memory["SpiceBot_Uptime"] = time.time()
@sopel.module.nickname_commands('uptime')
def bot_command_srewyou(bot, trigger):
timesince = str(humanized_time(time.time() - bot.memory["SpiceBot_Uptime"])) + " ago."
bot.osd("I have been running since " + timesince)

View File

@ -0,0 +1,8 @@
# coding=utf8
from __future__ import unicode_literals, absolute_import, division, print_function
from .Uptime import *
__author__ = 'Sam Zick'
__email__ = 'sam@deathbybandaid.net'
__version__ = '0.1.1'