mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-10 21:50:59 -05:00
Add Nick Commands
This commit is contained in:
parent
01bff54b98
commit
ea30f8c3dd
23
sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py
Normal file
23
sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py
Normal 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)
|
||||
8
sopel_modules/SpiceBot_FriendlyBot/__init__.py
Normal file
8
sopel_modules/SpiceBot_FriendlyBot/__init__.py
Normal 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'
|
||||
21
sopel_modules/SpiceBot_Gender/Gender.py
Normal file
21
sopel_modules/SpiceBot_Gender/Gender.py
Normal 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")
|
||||
8
sopel_modules/SpiceBot_Gender/__init__.py
Normal file
8
sopel_modules/SpiceBot_Gender/__init__.py
Normal 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'
|
||||
28
sopel_modules/SpiceBot_InsultHandler/InsultHandler.py
Normal file
28
sopel_modules/SpiceBot_InsultHandler/InsultHandler.py
Normal 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 + "!!!")
|
||||
8
sopel_modules/SpiceBot_InsultHandler/__init__.py
Normal file
8
sopel_modules/SpiceBot_InsultHandler/__init__.py
Normal 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'
|
||||
@ -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"""
|
||||
|
||||
|
||||
|
||||
26
sopel_modules/SpiceBot_Uptime/Uptime.py
Normal file
26
sopel_modules/SpiceBot_Uptime/Uptime.py
Normal 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)
|
||||
8
sopel_modules/SpiceBot_Uptime/__init__.py
Normal file
8
sopel_modules/SpiceBot_Uptime/__init__.py
Normal 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'
|
||||
Loading…
Reference in New Issue
Block a user