import logging import requests from command_system import RollbotResponse, RollbotFailure, RollbotPlugin from config import get_config, get_secret TS3_QUERY = get_secret("teamspeak.query") class teamspeak(RollbotPlugin): def __init__(self, bot, logger=logging.getLogger(__name__)): RollbotPlugin.__init__(self, "teamspeak", bot, logger=logger) def on_command(self, db, message): nicks = requests.get(TS3_QUERY).json()["users"] if len(nicks) == 0: return RollbotResponse(message, txt="No one in teamspeak!") if len(nicks) == 1: return RollbotResponse(message, txt="Only "+nicks[0]) return RollbotResponse(message, txt="I see the following people: "+", ".join(nicks)) class speamteek(teamspeak): def __init__(self, bot, logger=logging.getLogger(__name__)): RollbotPlugin.__init__(self, "speamteek", bot, logger=logger) def on_command(self, db, message): r = super().on_command(db, message) if r.is_success: r.txt = r.txt[::-1] return r class teamscream(teamspeak): def __init__(self, bot, logger=logging.getLogger(__name__)): RollbotPlugin.__init__(self, "teamscream", bot, logger=logger) def on_command(self, db, message): r = super().on_command(db, message) if r.is_success: r.txt = r.txt.upper() return r