mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 06:59:53 -05:00
commit
0136d1691d
22
sopel_modules/SpiceBot_Docs/Docs.py
Normal file
22
sopel_modules/SpiceBot_Docs/Docs.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# coding=utf-8
|
||||||
|
|
||||||
|
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||||
|
|
||||||
|
import sopel.module
|
||||||
|
|
||||||
|
import spicemanip
|
||||||
|
|
||||||
|
from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, bot_privs, github_dict
|
||||||
|
|
||||||
|
|
||||||
|
def configure(config):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def setup(bot):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@sopel.module.nickname_commands('help', 'docs', 'wiki')
|
||||||
|
def bot_command_owners(bot, trigger):
|
||||||
|
bot.osd(["IRC Modules Repository", str(github_dict["url_main"] + github_dict["repo_owner"] + "/" + github_dict["repo_name"] + github_dict["url_path_wiki"])])
|
||||||
8
sopel_modules/SpiceBot_Docs/__init__.py
Normal file
8
sopel_modules/SpiceBot_Docs/__init__.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# coding=utf8
|
||||||
|
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||||
|
|
||||||
|
from .Docs import *
|
||||||
|
|
||||||
|
__author__ = 'Sam Zick'
|
||||||
|
__email__ = 'sam@deathbybandaid.net'
|
||||||
|
__version__ = '0.1.1'
|
||||||
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'
|
||||||
57
sopel_modules/SpiceBot_Logs/Logs.py
Normal file
57
sopel_modules/SpiceBot_Logs/Logs.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# 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):
|
||||||
|
stderr("[SpiceBot_Logs] Starting Setup Procedure")
|
||||||
|
bot.memory['SpiceBot_Logs'] = {}
|
||||||
|
|
||||||
|
|
||||||
|
@sopel.module.nickname_commands('logs')
|
||||||
|
def bot_command_action(bot, trigger):
|
||||||
|
|
||||||
|
if not command_permissions_check(bot, trigger, ['admins', 'owner']):
|
||||||
|
bot.say("I was unable to process this Bot Nick command due to privilege issues.")
|
||||||
|
return
|
||||||
|
|
||||||
|
triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command')
|
||||||
|
|
||||||
|
logtype = spicemanip.main(triggerargs, 1) or None
|
||||||
|
if not logtype or not inlist(bot, logtype, bot.memory['SpiceBot_Logs'].keys()):
|
||||||
|
bot.osd("Current valid log(s) include: " + spicemanip.main(bot.memory['SpiceBot_Logs'].keys(), 'andlist'), trigger.sender, 'action')
|
||||||
|
return
|
||||||
|
|
||||||
|
logtype = inlist_match(bot, logtype, bot.memory['SpiceBot_Logs'].keys())
|
||||||
|
|
||||||
|
if len(bot.memory['SpiceBot_Logs'][logtype]) == 0:
|
||||||
|
bot.osd("No logs found for " + str(logtype) + ".")
|
||||||
|
return
|
||||||
|
|
||||||
|
bot.osd("Is Examining " + str(logtype) + " log(s).")
|
||||||
|
for line in bot.memory['SpiceBot_Logs'][logtype]:
|
||||||
|
bot.osd(str(line), trigger.sender, 'action')
|
||||||
|
|
||||||
|
|
||||||
|
def bot_logging(bot, logtype, logentry):
|
||||||
|
|
||||||
|
if 'SpiceBot_Logs' not in bot.memory:
|
||||||
|
bot.memory['SpiceBot_Logs'] = {}
|
||||||
|
|
||||||
|
if logtype not in bot.memory['SpiceBot_Logs'].keys():
|
||||||
|
bot.memory['SpiceBot_Logs'][logtype] = []
|
||||||
|
|
||||||
|
bot.memory['SpiceBot_Logs'][logtype].append(logentry)
|
||||||
|
if len(bot.memory['SpiceBot_Logs'][logtype]) > 10:
|
||||||
|
del bot.memory['SpiceBot_Logs'][logtype][0]
|
||||||
8
sopel_modules/SpiceBot_Logs/__init__.py
Normal file
8
sopel_modules/SpiceBot_Logs/__init__.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# coding=utf8
|
||||||
|
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||||
|
|
||||||
|
from .Logs import *
|
||||||
|
|
||||||
|
__author__ = 'Sam Zick'
|
||||||
|
__email__ = 'sam@deathbybandaid.net'
|
||||||
|
__version__ = '0.1.1'
|
||||||
@ -15,6 +15,18 @@ import codecs
|
|||||||
|
|
||||||
import spicemanip
|
import spicemanip
|
||||||
|
|
||||||
|
"""Variable References"""
|
||||||
|
|
||||||
|
github_dict = {
|
||||||
|
"url_main": "https://github.com/",
|
||||||
|
"url_api": "https://api.github.com/repos/",
|
||||||
|
"url_raw": "https://raw.githubusercontent.com/",
|
||||||
|
"url_path_wiki": "/wiki",
|
||||||
|
"url_path_issues": "/issues",
|
||||||
|
"repo_owner": "SpiceBot",
|
||||||
|
"repo_name": "SpiceBot",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
"""Sopel Wrapping Tools"""
|
"""Sopel Wrapping Tools"""
|
||||||
|
|
||||||
@ -75,6 +87,42 @@ def command_permissions_check(bot, trigger, privslist):
|
|||||||
return True
|
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"""
|
"""List Manipulation Functions"""
|
||||||
|
|
||||||
|
|
||||||
@ -99,6 +147,26 @@ def inlist(bot, searchterm, searchlist):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def inlist_match(bot, searchterm, searchlist):
|
||||||
|
# verify we are searching a list
|
||||||
|
if isinstance(searchlist, collections.abc.KeysView) or isinstance(searchlist, dict):
|
||||||
|
searchlist = [x for x in searchlist]
|
||||||
|
if not isinstance(searchlist, list):
|
||||||
|
searchlist = [searchlist]
|
||||||
|
rebuildlist = []
|
||||||
|
for searchitem in searchlist:
|
||||||
|
rebuildlist.append(str(searchitem))
|
||||||
|
|
||||||
|
searchterm = str(searchterm)
|
||||||
|
if searchterm in rebuildlist:
|
||||||
|
return searchterm
|
||||||
|
else:
|
||||||
|
for searching in rebuildlist:
|
||||||
|
if searching.lower() == searchterm.lower():
|
||||||
|
return searching
|
||||||
|
return searchterm
|
||||||
|
|
||||||
|
|
||||||
"""Channel Functions"""
|
"""Channel 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