Skip to content

Instantly share code, notes, and snippets.

@danielepantaleone
Last active August 29, 2015 14:15
Show Gist options
  • Save danielepantaleone/b0bd6cb774e100b5d6e4 to your computer and use it in GitHub Desktop.
Save danielepantaleone/b0bd6cb774e100b5d6e4 to your computer and use it in GitHub Desktop.
MsTPlugin
#
# MstPlugin for BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2013 Daniele Pantaleone <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# CHANGELOG
#
# 12/02/2015 - 1.0 - Fenix - initial version
__author__ = 'MsT|Quick, Fenix'
__version__ = '1.0'
import b3
import b3.plugin
from b3.functions import getCmd
class MstPlugin(b3.plugin.Plugin):
adminPlugin = None
requiresConfigFile = False
####################################################################################################################
## ##
## STARTUP ##
## ##
####################################################################################################################
def onStartup(self):
"""
Initialize plugin settings.
"""
self.adminPlugin = self.console.getPlugin('admin')
if not self.adminPlugin:
raise AssertionError("could not start without admin plugin")
self.registerEvent(self.console.getEventID('EVT_CLIENT_AUTH'), self.onAuth)
self.debug('plugin started')
####################################################################################################################
## ##
## EVENTS ##
## ##
####################################################################################################################
def onAuth(self, event):
"""
Executed when EVT_CLIENT_AUTH is intercepted.
"""
client = event.client
if client.maxLevel >= self.adminPlugin._admins_level:
for admin in self.adminPlugin.getAdmins():
if admin != client:
admin.message("^6Admin connected: ^7%s[^2%s^7]" % (client.name, client.maxLevel))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment