mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-12 06:29:54 -05:00
commit
2f79883429
22
setup.py
22
setup.py
@ -23,28 +23,6 @@ with open('requirements.txt') as requirements_file:
|
||||
with open('dev-requirements.txt') as dev_requirements_file:
|
||||
dev_requirements = [req for req in dev_requirements_file.readlines()]
|
||||
|
||||
pipcommand = "sudo pip3 install --upgrade"
|
||||
pipcommand += " --force-reinstall"
|
||||
pipcommand += " git+https://github.com/sopel-irc/sopel@master"
|
||||
|
||||
print('Running {} '.format(pipcommand), file=sys.stderr)
|
||||
for line in os.popen(pipcommand).read().split('\n'):
|
||||
print(line, file=sys.stderr)
|
||||
|
||||
import sopel
|
||||
|
||||
# Remove stock modules, if present
|
||||
main_sopel_dir = os.path.dirname(os.path.abspath(sopel.__file__))
|
||||
modules_dir = os.path.join(main_sopel_dir, 'modules')
|
||||
stockdir = os.path.join(modules_dir, "stock")
|
||||
if not os.path.exists(stockdir) or not os.path.isdir(stockdir):
|
||||
os.system("sudo mkdir " + stockdir)
|
||||
for pathname in os.listdir(modules_dir):
|
||||
path = os.path.join(modules_dir, pathname)
|
||||
if (os.path.isfile(path) and pathname.endswith('.py') and not pathname.startswith('_')):
|
||||
os.system("sudo mv " + path + " " + stockdir)
|
||||
|
||||
|
||||
setup(
|
||||
name='sopel_modules.SpiceBot',
|
||||
version='0.1.1',
|
||||
|
||||
@ -4,12 +4,14 @@ from __future__ import unicode_literals, absolute_import, division, print_functi
|
||||
This is the SpiceBot Channels system.
|
||||
"""
|
||||
import sopel
|
||||
from sopel.tools import Identifier
|
||||
from sopel.config.types import StaticSection, ValidatedAttribute, ListAttribute
|
||||
|
||||
import re
|
||||
import threading
|
||||
|
||||
from .Config import config as botconfig
|
||||
from .Database import db as botdb
|
||||
|
||||
|
||||
class SpiceBot_Channels_MainSection(StaticSection):
|
||||
@ -95,5 +97,100 @@ class BotChannels():
|
||||
else:
|
||||
bot.part(channel)
|
||||
|
||||
def whois_ident(self, nick):
|
||||
nick = Identifier(nick)
|
||||
nick_id = botdb.db.get_nick_id(nick, create=True)
|
||||
return nick_id
|
||||
|
||||
def add_to_channel(self, channel, nick, nick_id=None):
|
||||
if not nick_id:
|
||||
nick_id = self.whois_ident(nick)
|
||||
if channel.lower() not in self.dict['list'].keys():
|
||||
self.dict['list'][channel.lower()] = dict()
|
||||
if 'users' not in self.dict['list'][channel.lower()]:
|
||||
self.dict['list'][channel.lower()]['users'] = []
|
||||
if nick_id not in self.dict['list'][channel.lower()]['users']:
|
||||
self.dict['list'][channel.lower()]['users'].append(int(nick_id))
|
||||
|
||||
def remove_from_channel(self, channel, nick, nick_id=None):
|
||||
if not nick_id:
|
||||
nick_id = self.whois_ident(nick)
|
||||
if channel.lower() not in self.dict['list'].keys():
|
||||
self.dict['list'][channel.lower()] = dict()
|
||||
if 'users' not in self.dict['list'][channel.lower()]:
|
||||
self.dict['list'][channel.lower()]['users'] = []
|
||||
if nick_id in self.dict['list'][channel.lower()]['users']:
|
||||
self.dict['list'][channel.lower()]['users'].remove(nick_id)
|
||||
|
||||
def remove_all_from_channel(self, channel):
|
||||
if channel.lower() not in self.dict['list'].keys():
|
||||
self.dict['list'][channel.lower()] = dict()
|
||||
if 'users' not in self.dict['list'][channel.lower()]:
|
||||
self.dict['list'][channel.lower()]['users'] = []
|
||||
self.dict['list'][channel.lower()]['users'] = []
|
||||
|
||||
def channel_scan(self, bot):
|
||||
for channel in bot.channels.keys():
|
||||
for user in bot.channels[channel].privileges.keys():
|
||||
self.add_to_channel(channel, user)
|
||||
|
||||
def join(self, bot, trigger):
|
||||
# bot block
|
||||
if trigger.nick == bot.nick:
|
||||
for user in bot.channels[trigger.sender].privileges.keys():
|
||||
self.add_to_channel(trigger.sender, user)
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(trigger.nick)
|
||||
# Verify nick is in the channel list
|
||||
self.add_to_channel(trigger.sender, trigger.nick, nick_id)
|
||||
|
||||
def quit(self, bot, trigger):
|
||||
# bot block
|
||||
if trigger.nick == bot.nick:
|
||||
self.remove_all_from_channel(trigger.sender)
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(trigger.nick)
|
||||
# Verify nick is not in the channel list
|
||||
self.remove_from_channel(trigger.sender, trigger.nick, nick_id)
|
||||
|
||||
def part(self, bot, trigger):
|
||||
# bot block
|
||||
if trigger.nick == bot.nick:
|
||||
self.remove_all_from_channel(trigger.sender)
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(trigger.nick)
|
||||
# Verify nick is not in the channel list
|
||||
self.remove_from_channel(trigger.sender, trigger.nick, nick_id)
|
||||
|
||||
def kick(self, bot, trigger):
|
||||
targetnick = Identifier(str(trigger.args[1]))
|
||||
# bot block
|
||||
if targetnick == bot.nick:
|
||||
self.remove_all_from_channel(trigger.sender)
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(targetnick)
|
||||
# Verify nick is not in the channel list
|
||||
self.remove_from_channel(trigger.sender, targetnick, nick_id)
|
||||
|
||||
def nick(self, bot, trigger):
|
||||
newnick = Identifier(trigger)
|
||||
# bot block
|
||||
if trigger.nick == bot.nick or newnick == bot.nick:
|
||||
return
|
||||
# alias the nick
|
||||
if not botdb.check_nick_id(newnick):
|
||||
botdb.alias_nick(trigger.nick, newnick)
|
||||
# Identify
|
||||
nick_id = self.whois_ident(newnick)
|
||||
# Verify nick is in the channel list
|
||||
self.add_to_channel(trigger.sender, trigger.nick, nick_id)
|
||||
|
||||
def mode(self, bot, trigger):
|
||||
return
|
||||
|
||||
|
||||
channels = BotChannels()
|
||||
|
||||
@ -25,7 +25,7 @@ class NickIDs(BASE):
|
||||
"""
|
||||
NickIDs SQLAlchemy Class
|
||||
"""
|
||||
__tablename__ = 'nick_ids'
|
||||
__tablename__ = 'spice_nick_ids'
|
||||
nick_id = Column(Integer, primary_key=True)
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@ class Nicknames(BASE):
|
||||
"""
|
||||
Nicknames SQLAlchemy Class
|
||||
"""
|
||||
__tablename__ = 'nicknames'
|
||||
nick_id = Column(Integer, ForeignKey('nick_ids.nick_id'), primary_key=True)
|
||||
__tablename__ = 'spice_nicknames'
|
||||
nick_id = Column(Integer, ForeignKey('spice_nick_ids.nick_id'), primary_key=True)
|
||||
slug = Column(String(255), primary_key=True)
|
||||
canonical = Column(String(255))
|
||||
|
||||
@ -44,7 +44,7 @@ class NickValues(BASE):
|
||||
NickValues SQLAlchemy Class
|
||||
"""
|
||||
__tablename__ = 'spice_nick_values'
|
||||
nick_id = Column(Integer, ForeignKey('nick_ids.nick_id'), primary_key=True)
|
||||
nick_id = Column(Integer, ForeignKey('spice_nick_ids.nick_id'), primary_key=True)
|
||||
namespace = Column(String(255), primary_key=True)
|
||||
key = Column(String(255), primary_key=True)
|
||||
value = Column(Text())
|
||||
@ -496,6 +496,8 @@ class BotDatabase():
|
||||
|
||||
def __init__(self):
|
||||
|
||||
sopel.db.NickIDs = NickIDs
|
||||
sopel.db.Nicknames = Nicknames
|
||||
sopel.db.NickValues = NickValues
|
||||
SopelDB.get_nick_value = SpiceDB.get_nick_value
|
||||
SopelDB.set_nick_value = SpiceDB.set_nick_value
|
||||
@ -525,6 +527,16 @@ class BotDatabase():
|
||||
def get_nick_id(self, nick, create=True):
|
||||
return self.db.get_nick_id(nick, create)
|
||||
|
||||
def alias_nick(self, nick, alias):
|
||||
return self.alias_nick(nick, alias)
|
||||
|
||||
def check_nick_id(self, nick):
|
||||
try:
|
||||
self.db.get_nick_id(nick, create=False)
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
def get_nick_value(self, nick, key, namespace='default'):
|
||||
return self.db.get_nick_value(nick, key, namespace)
|
||||
|
||||
|
||||
@ -35,6 +35,17 @@ github_dict = {
|
||||
"repo_name": "SpiceBot",
|
||||
}
|
||||
|
||||
mode_dict_alias = {
|
||||
"+o": "OP", "-o": "deOP",
|
||||
"+v": "VOICE", "-v": "deVOICE",
|
||||
"+h": "HOP", "-h": "deHOP",
|
||||
"+a": "ADMIN", "-a": "deADMIN",
|
||||
"+q": "OWNER", "-q": "deOWNER",
|
||||
"+b": "BAN", "-b": "unBAN",
|
||||
"+c": "noCOLOR", "-c": "COLOR",
|
||||
# TODO add more user/channel modes
|
||||
}
|
||||
|
||||
|
||||
"""Sopel Wrapping Tools"""
|
||||
|
||||
|
||||
224
sopel_modules/SpiceBot/Users.py
Normal file
224
sopel_modules/SpiceBot/Users.py
Normal file
@ -0,0 +1,224 @@
|
||||
# coding=utf8
|
||||
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||
"""A way to track users"""
|
||||
|
||||
from sopel.tools import Identifier
|
||||
|
||||
from .Database import db as botdb
|
||||
|
||||
|
||||
class BotUsers():
|
||||
|
||||
def __init__(self):
|
||||
# TODO timestamp for new .seen
|
||||
self.all = botdb.get_bot_value('users') or dict()
|
||||
self.online = []
|
||||
self.offline = []
|
||||
for user_id in self.all.keys():
|
||||
self.offline.append(int(user_id))
|
||||
self.current = {}
|
||||
|
||||
def whois(self, nick):
|
||||
nick_id = self.whois_ident(nick)
|
||||
self.add_to_all(nick, nick_id)
|
||||
self.add_to_current(nick, nick_id)
|
||||
return self.current[nick_id]["nick"]
|
||||
|
||||
def whois_id(self, nick_id):
|
||||
if nick_id in self.current.keys():
|
||||
return self.current[nick_id]["nick"]
|
||||
elif nick_id in self.all.keys() and len(self.all[nick_id]):
|
||||
return self.all[nick_id][0]
|
||||
else:
|
||||
return None
|
||||
|
||||
def whois_nick(self, nick):
|
||||
nick_id = self.whois_ident(nick)
|
||||
self.add_to_all(nick, nick_id)
|
||||
self.add_to_current(nick, nick_id)
|
||||
return nick_id
|
||||
|
||||
def whois_ident(self, nick):
|
||||
nick = Identifier(nick)
|
||||
nick_id = botdb.db.get_nick_id(nick, create=True)
|
||||
return int(nick_id)
|
||||
|
||||
def save_user_db(self):
|
||||
botdb.set_bot_value('users', self.all)
|
||||
|
||||
def add_to_all(self, nick, nick_id=None):
|
||||
if not nick_id:
|
||||
nick_id = self.whois_ident(nick)
|
||||
# add to all if not there
|
||||
if nick_id not in self.all.keys():
|
||||
self.all[nick_id] = []
|
||||
# add nick alias
|
||||
if nick not in self.all[nick_id]:
|
||||
self.all[nick_id].append(nick)
|
||||
self.save_user_db()
|
||||
|
||||
def add_to_current(self, nick, nick_id=None):
|
||||
if not nick_id:
|
||||
nick_id = self.whois_ident(nick)
|
||||
# add to current if not there
|
||||
if nick_id not in self.current.keys():
|
||||
self.current[nick_id] = {"channels": [], "nick": nick}
|
||||
|
||||
def channel_scan(self, bot):
|
||||
for channel in bot.channels.keys():
|
||||
for user in bot.channels[channel].privileges.keys():
|
||||
# Identify
|
||||
nick_id = self.whois_ident(user)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_all(user, nick_id)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_current(user, nick_id)
|
||||
# set current nick
|
||||
self.current[nick_id]["nick"] = user
|
||||
# add joined channel to nick list
|
||||
if channel not in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].append(channel)
|
||||
# mark user as online
|
||||
if nick_id not in self.online:
|
||||
self.online.append(int(nick_id))
|
||||
if nick_id in self.offline:
|
||||
self.offline.remove(nick_id)
|
||||
|
||||
def join(self, bot, trigger):
|
||||
if trigger.nick == bot.nick:
|
||||
for user in bot.channels[trigger.sender].privileges.keys():
|
||||
# Identify
|
||||
nick_id = self.whois_ident(user)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_all(user, nick_id)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_current(user, nick_id)
|
||||
# set current nick
|
||||
self.current[nick_id]["nick"] = user
|
||||
# add joined channel to nick list
|
||||
if trigger.sender not in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].append(trigger.sender)
|
||||
# mark user as online
|
||||
if nick_id not in self.online:
|
||||
self.online.append(int(nick_id))
|
||||
if nick_id in self.offline:
|
||||
self.offline.remove(nick_id)
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(trigger.nick)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_all(trigger.nick, nick_id)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_current(trigger.nick, nick_id)
|
||||
# set current nick
|
||||
self.current[nick_id]["nick"] = trigger.nick
|
||||
# add joined channel to nick list
|
||||
if trigger.sender not in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].append(trigger.sender)
|
||||
# mark user as online
|
||||
if nick_id not in self.online:
|
||||
self.online.append(int(nick_id))
|
||||
if nick_id in self.offline:
|
||||
self.offline.remove(nick_id)
|
||||
|
||||
def quit(self, bot, trigger):
|
||||
if trigger.nick == bot.nick:
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(trigger.nick)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_all(trigger.nick, nick_id)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_current(trigger.nick, nick_id)
|
||||
# empty nicks channel list
|
||||
if trigger.sender in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].remove(trigger.sender)
|
||||
self.current[nick_id]["channels"] = []
|
||||
# mark user as offline
|
||||
if nick_id in self.online:
|
||||
self.online.remove(nick_id)
|
||||
if nick_id not in self.offline:
|
||||
self.offline.append(int(nick_id))
|
||||
|
||||
def part(self, bot, trigger):
|
||||
if trigger.nick == bot.nick:
|
||||
for nick_id in self.current.keys():
|
||||
if trigger.sender in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].remove(trigger.sender)
|
||||
# mark offline
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id in self.online:
|
||||
self.online.remove(nick_id)
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id not in self.offline:
|
||||
self.offline.append(int(nick_id))
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(trigger.nick)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_all(trigger.nick, nick_id)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_current(trigger.nick, nick_id)
|
||||
# remove channel from nick list
|
||||
if trigger.sender in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].remove(trigger.sender)
|
||||
# mark offline
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id in self.online:
|
||||
self.online.remove(nick_id)
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id not in self.offline:
|
||||
self.offline.append(int(nick_id))
|
||||
|
||||
def kick(self, bot, trigger):
|
||||
targetnick = Identifier(str(trigger.args[1]))
|
||||
if targetnick == bot.nick:
|
||||
for nick_id in self.current.keys():
|
||||
if trigger.sender in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].remove(trigger.sender)
|
||||
# mark offline
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id in self.online:
|
||||
self.online.remove(nick_id)
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id not in self.offline:
|
||||
self.offline.append(int(nick_id))
|
||||
return
|
||||
# Identify
|
||||
nick_id = self.whois_ident(targetnick)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_all(targetnick, nick_id)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_current(targetnick, nick_id)
|
||||
# remove channel from nick list
|
||||
if trigger.sender in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].remove(trigger.sender)
|
||||
# mark offline
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id in self.online:
|
||||
self.online.remove(nick_id)
|
||||
if not len(self.current[nick_id]["channels"]) and nick_id not in self.offline:
|
||||
self.offline.append(int(nick_id))
|
||||
|
||||
def nick(self, bot, trigger):
|
||||
newnick = Identifier(trigger)
|
||||
if trigger.nick == bot.nick or newnick == bot.nick:
|
||||
return
|
||||
# alias the nick
|
||||
if not botdb.check_nick_id(newnick):
|
||||
botdb.alias_nick(trigger.nick, newnick)
|
||||
# Identify
|
||||
nick_id = self.whois_ident(newnick)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_all(newnick, nick_id)
|
||||
# Verify nick is in the all list
|
||||
self.add_to_current(newnick, nick_id)
|
||||
# set current nick
|
||||
self.current[nick_id]["nick"] = newnick
|
||||
# add joined channel to nick list
|
||||
if trigger.sender not in self.current[nick_id]["channels"]:
|
||||
self.current[nick_id]["channels"].append(trigger.sender)
|
||||
# mark user as online
|
||||
if nick_id not in self.online:
|
||||
self.online.append(int(nick_id))
|
||||
if nick_id in self.offline:
|
||||
self.offline.remove(nick_id)
|
||||
|
||||
def mode(self, bot, trigger):
|
||||
return
|
||||
|
||||
|
||||
users = BotUsers()
|
||||
@ -20,6 +20,7 @@ from .Commands import *
|
||||
from .Events import *
|
||||
from .StartupMonologue import *
|
||||
from .Channels import *
|
||||
from .Users import *
|
||||
from .AI import *
|
||||
|
||||
|
||||
|
||||
@ -87,22 +87,3 @@ def bot_command_nick(bot, trigger):
|
||||
else:
|
||||
bot.osd("I'm afraid you do not have the authority to make that call, " + trigger.nick + ".")
|
||||
return
|
||||
|
||||
elif fulltrigger.lower().startswith("can you see"):
|
||||
target = spicemanip.main(trigger.sb['args'], "4+") or None
|
||||
if not target:
|
||||
bot.osd(trigger.nick + ", I can see clearly.")
|
||||
return
|
||||
if target in [trigger.nick, 'me']:
|
||||
bot.osd(trigger.nick + ", I can see you.")
|
||||
else:
|
||||
if SpiceBot.inlist(trigger.nick, bot.users):
|
||||
bot.osd(trigger.nick + ", yes. I can see " + SpiceBot.inlist_match(target, bot.users) + " right now!")
|
||||
else:
|
||||
bot.osd(trigger.nick + ", no. I cannot see " + SpiceBot.inlist_match(target, bot.users) + " right now!")
|
||||
# if bot_check_inlist(target, bot.memory["botdict"]["users"].keys()):
|
||||
# bot.osd(trigger.nick + ", I can't see " + inlist_match(target, bot.users) + " at the moment.")
|
||||
# else:
|
||||
# bot.osd("I have never seen " + str(target) + ".")
|
||||
# TODO
|
||||
return
|
||||
|
||||
@ -83,6 +83,28 @@ def bot_command_rule(bot, trigger):
|
||||
bot.osd(str(searchreturn))
|
||||
return
|
||||
|
||||
elif trigger_args[0].lower() in ["can"] and trigger_args[1].lower() in ["you"] and trigger_args[2].lower() in ["see"]:
|
||||
target = spicemanip.main(trigger_args, "4+") or None
|
||||
if target:
|
||||
if SpiceBot.inlist(trigger.nick, bot.users):
|
||||
realtarget = SpiceBot.inlist_match(target, bot.users)
|
||||
dispmsg = [trigger.nick + ", yes. I can see " + realtarget]
|
||||
targetchannels = []
|
||||
for channel in bot.channels.keys():
|
||||
if SpiceBot.inlist(trigger.nick, bot.channels[channel].privileges.keys()):
|
||||
targetchannels.append(channel)
|
||||
dispmsg.append(realtarget + " is in " + spicemanip.main(targetchannels, 'andlist'))
|
||||
bot.osd(dispmsg)
|
||||
else:
|
||||
bot.osd(trigger.nick + ", no. I cannot see " + target + " right now!")
|
||||
# if bot_check_inlist(target, bot.memory["botdict"]["users"].keys()):
|
||||
# bot.osd(trigger.nick + ", I can't see " + inlist_match(target, bot.users) + " at the moment.")
|
||||
# else:
|
||||
# bot.osd("I have never seen " + str(target) + ".")
|
||||
# user in bot.channels[channel].privileges.keys()
|
||||
# TODO
|
||||
return
|
||||
|
||||
closestmatches = SpiceBot.similar_list(trigger_command, SpiceBot.commands.dict['commands']["nickname"].keys(), 3, 'reverse')
|
||||
if len(closestmatches):
|
||||
closestmatches = spicemanip.main(closestmatches, "andlist")
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
# coding=utf8
|
||||
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||
|
||||
from .BotPrivs import *
|
||||
|
||||
__author__ = 'Sam Zick'
|
||||
__email__ = 'sam@deathbybandaid.net'
|
||||
__version__ = '0.1.1'
|
||||
@ -22,4 +22,24 @@
|
||||
</template>
|
||||
</category>
|
||||
|
||||
<category>
|
||||
<pattern>BOTNICK you there</pattern>
|
||||
<template>
|
||||
<random>
|
||||
<li>Need something, triggernick?</li>
|
||||
<li>What's going on, triggernick?</li>
|
||||
</random>
|
||||
</template>
|
||||
</category>
|
||||
|
||||
<category>
|
||||
<pattern>you there BOTNICK</pattern>
|
||||
<template>
|
||||
<random>
|
||||
<li>Need something, triggernick?</li>
|
||||
<li>What's going on, triggernick?</li>
|
||||
</random>
|
||||
</template>
|
||||
</category>
|
||||
|
||||
</aiml>
|
||||
|
||||
16
sopel_modules/SpiceBot_Configs/aiml/nickname_canyousee.aiml
Normal file
16
sopel_modules/SpiceBot_Configs/aiml/nickname_canyousee.aiml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<aiml version="1.0">
|
||||
|
||||
|
||||
<category>
|
||||
<pattern>BOTNICK can you see me</pattern>
|
||||
<template>triggernick, I can see you.</template>
|
||||
</category>
|
||||
|
||||
<category>
|
||||
<pattern>BOTNICK can you see</pattern>
|
||||
<template>triggernick, I can see clearly.</template>
|
||||
</category>
|
||||
|
||||
|
||||
</aiml>
|
||||
@ -15,13 +15,12 @@ import sopel_modules.SpiceBot as SpiceBot
|
||||
@SpiceBot.events.check_ready([SpiceBot.events.BOT_COMMANDS])
|
||||
@SpiceBot.prerun.prerun('nickname')
|
||||
@sopel.module.nickname_commands('commands', 'command')
|
||||
def nickname_comand_channels(bot, trigger):
|
||||
def nickname_comand_commands(bot, trigger):
|
||||
|
||||
if not len(trigger.sb['args']):
|
||||
commandused = 'list'
|
||||
else:
|
||||
commandused = spicemanip.main(trigger.sb['args'], 1).lower()
|
||||
bot.say(str(commandused))
|
||||
|
||||
commands_list = []
|
||||
for commandstype in SpiceBot.commands.dict['commands'].keys():
|
||||
@ -42,5 +41,5 @@ def nickname_comand_channels(bot, trigger):
|
||||
return
|
||||
|
||||
elif commandused == 'random':
|
||||
bot.osd(["Here's a random command for you:", + spicemanip.main(commands_list, 'random')])
|
||||
bot.osd(["Here's a random command for you:", spicemanip.main(commands_list, 'random')])
|
||||
return
|
||||
|
||||
@ -8,7 +8,7 @@ import sopel_modules.SpiceBot as SpiceBot
|
||||
|
||||
|
||||
@sopel.module.nickname_commands('help', 'docs', 'wiki')
|
||||
def bot_command_owners(bot, trigger):
|
||||
def bot_command_docs(bot, trigger):
|
||||
bot.osd(["IRC Modules Repository",
|
||||
str(SpiceBot.github_dict["url_main"] +
|
||||
SpiceBot.github_dict["repo_owner"] + "/" +
|
||||
|
||||
@ -10,6 +10,6 @@ import sopel_modules.SpiceBot as SpiceBot
|
||||
|
||||
|
||||
@sopel.module.nickname_commands('uptime')
|
||||
def bot_command_srewyou(bot, trigger):
|
||||
def bot_command_uptime(bot, trigger):
|
||||
timesince = str(SpiceBot.humanized_time(time.time() - SpiceBot.events.BOT_UPTIME)) + " ago."
|
||||
bot.osd("I have been running since " + timesince)
|
||||
|
||||
@ -15,6 +15,7 @@ from .Logs import *
|
||||
from .Runtime_Controls import *
|
||||
from .Messaging import *
|
||||
from .Docs import *
|
||||
from .BotPrivs import *
|
||||
|
||||
__author__ = 'Sam Zick'
|
||||
__email__ = 'sam@deathbybandaid.net'
|
||||
|
||||
@ -95,3 +95,47 @@ def trigger_channel_list_recurring(bot, trigger):
|
||||
if "*" in SpiceBot.channels.dict['list'].keys():
|
||||
del SpiceBot.channels.dict['list']["*"]
|
||||
SpiceBot.channels.bot_part_empty(bot)
|
||||
|
||||
|
||||
@sopel.module.event('JOIN')
|
||||
@sopel.module.rule('.*')
|
||||
def channels_users_join(bot, trigger):
|
||||
SpiceBot.channels.join(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('QUIT')
|
||||
@sopel.module.rule('.*')
|
||||
def channels_users_quit(bot, trigger):
|
||||
SpiceBot.channels.quit(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('PART')
|
||||
@sopel.module.rule('.*')
|
||||
def channels_users_part(bot, trigger):
|
||||
SpiceBot.channels.part(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('KICK')
|
||||
@sopel.module.rule('.*')
|
||||
def channels_users_kick(bot, trigger):
|
||||
SpiceBot.channels.kick(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('NICK')
|
||||
@sopel.module.rule('.*')
|
||||
def channels_users_nick(bot, trigger):
|
||||
SpiceBot.channels.nick(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('MODE')
|
||||
@sopel.module.rule('.*')
|
||||
def channels_users_mode(bot, trigger):
|
||||
SpiceBot.channels.mode(bot, trigger)
|
||||
# TODO
|
||||
|
||||
|
||||
@sopel.module.event(SpiceBot.events.BOT_CONNECTED)
|
||||
@sopel.module.rule('.*')
|
||||
def bot_channelscan(bot, trigger):
|
||||
while True:
|
||||
SpiceBot.channels.channel_scan(bot)
|
||||
|
||||
52
sopel_modules/SpiceBot_Core_Processing/Users.py
Normal file
52
sopel_modules/SpiceBot_Core_Processing/Users.py
Normal file
@ -0,0 +1,52 @@
|
||||
# coding=utf8
|
||||
from __future__ import unicode_literals, absolute_import, division, print_function
|
||||
"""
|
||||
This is the SpiceBot Channels system.
|
||||
"""
|
||||
import sopel
|
||||
|
||||
import sopel_modules.SpiceBot as SpiceBot
|
||||
|
||||
|
||||
@sopel.module.event('JOIN')
|
||||
@sopel.module.rule('.*')
|
||||
def users_join(bot, trigger):
|
||||
SpiceBot.users.join(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('QUIT')
|
||||
@sopel.module.rule('.*')
|
||||
def users_quit(bot, trigger):
|
||||
SpiceBot.users.quit(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('PART')
|
||||
@sopel.module.rule('.*')
|
||||
def users_part(bot, trigger):
|
||||
SpiceBot.users.part(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('KICK')
|
||||
@sopel.module.rule('.*')
|
||||
def users_kick(bot, trigger):
|
||||
SpiceBot.users.kick(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('NICK')
|
||||
@sopel.module.rule('.*')
|
||||
def users_nick(bot, trigger):
|
||||
SpiceBot.users.nick(bot, trigger)
|
||||
|
||||
|
||||
@sopel.module.event('MODE')
|
||||
@sopel.module.rule('.*')
|
||||
def users_mode(bot, trigger):
|
||||
SpiceBot.users.mode(bot, trigger)
|
||||
# TODO
|
||||
|
||||
|
||||
@sopel.module.event(SpiceBot.events.BOT_CONNECTED)
|
||||
@sopel.module.rule('.*')
|
||||
def bot_channelscan_users(bot, trigger):
|
||||
while True:
|
||||
SpiceBot.users.channel_scan(bot)
|
||||
@ -7,6 +7,7 @@ This module contains references only for other modules to utilize.
|
||||
"""
|
||||
|
||||
from .Channels import *
|
||||
from .Users import *
|
||||
from .Events import *
|
||||
from .Modules import *
|
||||
from .AI import *
|
||||
|
||||
Loading…
Reference in New Issue
Block a user