Skip to content

Instantly share code, notes, and snippets.

@danielepantaleone
Last active August 29, 2015 14:01
Show Gist options
  • Save danielepantaleone/8beb3799c4fd4b4b8eb2 to your computer and use it in GitHub Desktop.
Save danielepantaleone/8beb3799c4fd4b4b8eb2 to your computer and use it in GitHub Desktop.
Cod6Parser patch plugin
#
# BigBrotherBot(B3) (www.bigbrotherbot.net)
# Copyright (C) 2014 Fenix <fenix@bigbrotherbot.net>
#
# 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
#
from b3.plugin import Plugin
from b3.parsers.cod6 import Cod6Parser
__author__ = 'Fenix'
__version__ = '1.0'
def patch_cod6_parser():
"""
Add the possibility to define a kickreason for !kick.
"""
_commands = {
'message': 'tell %(cid)s %(prefix)s ^3[pm]^7 %(message)s',
'deadsay': 'tell %(cid)s %(prefix)s [DEAD]^7 %(message)s',
'say': 'say %(prefix)s %(message)s',
'set': 'set %(name)s "%(value)s"',
'kick': 'clientkick %(cid)s "Player Kicked:^7 %(reason)s"',
'ban': 'clientkick %(cid)s "Player Banned:^7 %(reason)s Visit classicSnD.org in order to appeal for an unban"',
'permban': 'clientkick %(cid)s "Player Banned:^7 %(reason)s Visit classicSnD.org in order to appeal for an unban"',
'unban': 'unbanuser %(name)s', # remove players from game engine's ban.txt
'tempban': 'clientkick %(cid)s "Player Banned:^7 %(reason)s Visit classicSnD.org in order to appeal for an unban"',
}
Cod6Parser._commands = _commands
class Cod6Plugin(Plugin):
"""
Patches the Cod6 parser adding reason parameter to client kick.
Based on URT EVT_BOMB_EXPLODED template by Thomas Leveil.
Kick reason idea by Sammuel.
"""
requiresConfigFile = False
def __new__(cls, *args, **kwargs):
patch_cod6_parser()
return Cod6Parser.__new__(cls)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment