This is the first plugin i wrote for b3 and being a not-so-good python programmer all the suggstions/comments are welcome.
The plugin was written for CoD Black Ops on b3 v. 1.4.2b and have not been tested in any other game or b3 version.
Python v.2.6.6
Well all the information about the plugin are below.
->Plugin Download<- # README-MoreSpam.txt
# Plugin for B3 (
www.bigbrotherbot.com)
#
# Copyright 2011 d0nin380 <d0nin380<at>gmail<dot>com>
#
# 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 Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
Description:
A very basic plugin to add custom say-commands just by editing the config file.
Check the MoreSpam.xml for details.
You can rename or delete the existing cmds and add ones you want.
Make sure your responses "name" settings are the same as the commands and commands-p2p "name" settings INCLUDING the aliases.
help-messages "name" settings must be without the alias.
***NOTE*** The plugin will NOT work if you change the names of the sections. ***NOTE***
Installation:
1. Unzip the content of this package into your B3 folder. It will
place the MoreSpam.py file in b3/extplugins and the config file MoreSpam.xml in
your b3/extplugins/conf folder.
2. Open MoreSpam.xml with your texteditor and edit it to your liking.
3. Open your B3.xml file (in b3/conf) and add the next line in the
<plugins> section of the file:
<plugin config="@b3/extplugins/conf/MoreSpam.xml" name="MoreSpam" />
4. Restart your b3
Support:
Support will ONLY be provided in
http://forum.bigbrotherbot.net/releases/morespam-plugin/ so do not email me or anybody else your support questions.
# CHANGELOG
# 2011/03/23 - 1.1.0 - d0nin380
# * Initial Release
MoreSpam.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# MoreSpam.py
#
# Copyright 2011 d0nin380 d0nin380[at]gmail[dot]com>
#
# 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 Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
__version__ = '1.0.0'
__author__ = 'd0nin380'
import b3, re, b3.events, random
class MorespamPlugin(b3.plugin.Plugin):
def startup(self):
"""
Plugin for b3 to spam messages like !ns !owned !lol etc...
"""
self._adminPlugin = self.console.getPlugin('admin')
self._p2p_cmddict = {}
self._cmddict = {}
self._helpdict = {}
self._sections = ['commands', 'commands-p2p', 'responses', 'help-messages']
self._failed_section = ""
if not self._adminPlugin:
self.error('Could not find admin plugin')
return False
#Make sure all the sections needed are in the xml file.
for section in self._sections:
if section in self.config.sections():
pass
else:
self._failed_section=section
self.warning("Plugin did not start because of missing section [%s] in the config file." % self._failed_section)
return False
try:
for cmd in self.config.options('commands-p2p'):
_response = self.config.get('responses', cmd)
level = self.config.get('commands-p2p', cmd)
sp = cmd.split('-')
alias = None
if len(sp) == 2:
cmd, alias = sp
func = self.getCmd(cmd)
if func:
try:
func.__func__.__doc__ = self.config.get("help-messages", cmd)
except Exception, msg:
self.debug("%s No help message set in MoreSpam.xml." % msg)
func.__func__.__doc__ = None
self._adminPlugin.registerCommand(self, cmd, level, func, alias)
self._p2p_cmddict[cmd] = _response.split(',')
except Exception, msg:
self.debug("Something is wrong with your MoreSpam.xml section %s. Some commands may not work." % msg)
try:
for cmd in self.config.options('commands'):
_response = self.config.get('responses', cmd)
level = self.config.get('commands', cmd)
sp = cmd.split('-')
alias = None
if len(sp) == 2:
cmd, alias = sp
func = self.getCmd(cmd)
if func:
try:
func.__func__.__doc__ = self.config.get("help-messages", cmd)
except Exception, msg:
self.debug("%s No help message set in MoreSpam.xml." % msg)
func.__func__.__doc__ = None
self._adminPlugin.registerCommand(self, cmd, level, func, alias)
self._cmddict[cmd] = _response
except Exception, msg:
self.debug("Something is wrong with your MoreSpam.xml section %s. Some commands may not work." % msg)
self.debug('Started')
def getCmd(self, cmd):
cmd = 'cmd_handler'
func = getattr(self, cmd)
return func
def cmd_handler(self, data, client=None, cmd=None):
__doc__ = "help msg for: %s" % cmd
m = self._adminPlugin.parseUserCmd(data)
if cmd.command in self._p2p_cmddict.keys():
if not m:
client.message('^7Invalid parameters, you must supply a player name')
return False
sclient = self._adminPlugin.findClientPrompt(m[0], client)
if sclient:
self.console.say('^2%s ^3says: %s %s' % (client.name,\
random.choice(self._p2p_cmddict[cmd.command]),\
sclient.name))
else:
client.message(self._cmddict[cmd.command])
MoreSpam.xml
2
2
2
0
2
That was hilarious, I cannot stop laughing, You are so funny, You made my day
Nice shot, Awesome shot, That was a heck of a shot
Sit down
Our forum is located @: www.tce-massa.com/forum
^2Our public ^3TS3(voicechat)^7: ^2tce-massa.com:9987
PlayerName
PlayerName or !ns PlayerName
PlayerName or !sd PlayerName
- Display the location of our forum
- Display the information of our TeamSpeak 3 voicechat.