thankyou
Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here

NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

Author Topic: Dirc Plugin  (Read 5628 times)

Offline d0nin380

  • Full Member
  • ***
  • Posts: 56
Dirc Plugin
« on: March 03, 2013, 05:08:48 AM »
IRC Plugin for b3
This plugin will be able to handle admin commands such as kick/ban from IRC

Written for B3 1.9.0 Python 2.7.3
Tested in Quakenet + cod4

This is the initial release so it is far from pretty! More testers needed. Might get kicked for flood on busy server. Wanted to put it out here to see if there is any interest for it. Any feedback is welcome, I'm monitoring this topic.

---> Plugin Download <---

#       README-Dirc.txt
#       Plugin for B3 (www.bigbrotherbot.com)
#      
#       Copyright 2013 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.

    TODO:
      Proper buffer
      Bot auth for gamesurge and quakenet
      Ability to admin the server from IRC
         Needs linked account from b3 database
         Probably can be linked with just Q account
         as long as usermode +x has been set in quakenet
         gamesurge works similarily...
      
      Some kind of a auth/login for guest chat from IRC (no admin commands)
      Bot to use the same name as your B3
      Possibly chatlogging to forum

Description:
      IRC Plugin for b3
      This plugin will be able to handle admin commands such as kick/ban from IRC
      

Installation:
   1. Unzip the content of this package into your B3 folder. It will
   place the Dirc.py file in b3/extplugins and the config file Dirc.xml in
   your b3/extplugins/conf folder.

   2. Open Dirc.xml with your texteditor and edit the bot name and server info.

   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/Dirc.xml" name="DircPlugin" />

   4. Restart your b3
   
Support:
   Support will ONLY be provided in http://forum.bigbrotherbot.net/releases/dirc-plugin so do not email me or anybody else your support questions.
   
# CHANGELOG
#   2013/03/01 - 1.0.0 - d0nin380
#   * Initial Release
« Last Edit: March 03, 2013, 05:14:16 AM by d0nin380 »

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4883
    • Github repository
Re: Dirc Plugin
« Reply #1 on: March 03, 2013, 07:02:37 PM »
Nice contribution :)

You have the wrong link in the readme file and this topic for the support topic. It should be http://forum.bigbrotherbot.net/releases/dirc-plugin/

Offline d0nin380

  • Full Member
  • ***
  • Posts: 56
Re: Dirc Plugin
« Reply #2 on: March 03, 2013, 07:12:42 PM »
Nice contribution :)

You have the wrong link in the readme file and this topic for the support topic. It should be http://forum.bigbrotherbot.net/releases/dirc-plugin/

oh... I though i had it all right... well hope ppl will find their way here until the next release...

And Thanks

Offline d0nin380

  • Full Member
  • ***
  • Posts: 56
Re: Dirc Plugin
« Reply #3 on: March 04, 2013, 01:53:51 PM »
Updated:
Quote from: CHANGELOG
# CHANGELOG
#   2013/03/01 - 1.0.0 - d0nin380
#      * Initial Release
#   2013/03/03 - 1.0.1 - d0nin380
#     * Add bot auth in quakenet
#     * Cleaned up irc_parser
#     * Fixed a bug where pong was sent
#     *    with the next msg in buffer
#     *   instead of the actual ping
#     * Added some error handling

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: Dirc Plugin
« Reply #4 on: March 20, 2013, 09:16:23 PM »
Code: [Select]
130320 21:07:37	BOT    	'Loading Plugin #13 DircPlugin [/home/b3/snd-dev/b3/extplugins/conf/DircPlugin.xml]'
130320 21:07:37 INFO 'DircPlugin is not a built-in plugin (No module named DircPlugin)'
130320 21:07:37 INFO 'trying external plugin directory : /home/b3/snd-dev/b3/extplugins'
130320 21:07:37 ERROR 'Error loading plugin DircPlugin'
Traceback (most recent call last):
  File "/home/b3/snd-dev/b3/parser.py", line 671, in loadPlugins
    pluginModule = self.pluginImport(plugin_name, plugins[s]['path'])
  File "/home/b3/snd-dev/b3/parser.py", line 755, in pluginImport
    fp, pathname, description = imp.find_module(name, [self.config.getpath('plugins', 'external_dir')])
ImportError: No module named DircPlugin

dirc.py is located in @b3/extplugins/ and dirc.xml is located in @b3/extplugins/conf and straight out of the box it doesn't work. Tried it with the latest stable release 1.9 and it doesn't work.

Any idea's what's wrong?

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: Dirc Plugin
« Reply #5 on: March 20, 2013, 09:20:52 PM »
DircPlugin.xml
Code: [Select]
<configuration plugin="DircPlugin">
<settings name="settings">

<!-- Name of the IRC server you want to connect-->
<set name="server">irc.rizon.net</set>

<!-- Port the IRC server is running in-->
<set name="port">6669</set>

<!-- This will be a hidden value later on as we want the bot to use the botnick in the game server but still have the option of changing the name if needed.-->
<set name="nick">b3dev</set>

<!-- The channel you want to connect to (including the hash) -->
<set name="channel">#b3</set>

<!-- Bot prefix, Set this to a character or character combination. Every message in IRC starting with the Bot prefix will be sent to the game server. -->
<set name="botprefix">></set>

<!-- Bot auth name and password (if you dont know what this is then leave it empty)-->
<set name="botauth"></set>

</settings>
</configuration>

Offline d0nin380

  • Full Member
  • ***
  • Posts: 56
Re: Dirc Plugin
« Reply #6 on: March 20, 2013, 09:32:16 PM »
I'm going to release a minor update tonight that includes events so writing your own irc commands will be easier.. It works the same way as the other parsers in b3.. The update is almost ready to release so instead of fixing that just wait for the update...

ETA. 8pm EST

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: Dirc Plugin
« Reply #7 on: March 20, 2013, 09:47:01 PM »
Alright, thank you for the quick reply.
Keep the updates coming :)

Offline d0nin380

  • Full Member
  • ***
  • Posts: 56
Re: Dirc Plugin
« Reply #8 on: March 21, 2013, 02:56:49 AM »
Sorry for the delay...
The update is waiting for approval

Quote
[master 1796a53] minor release. added events fixed bugs.
 3 files changed, 402 insertions(+), 83 deletions(-)

Edit: for some reason its not working any more.. I think I have to find a workaround the socket timeout as thats probably where the errors are being lost

OKAY
dont know what i was thinking...
"quickfix" below or wait for an update tomorrow within the next few days..
add ":" infront of "(?P<text>" in self._lineFormats line 114

OLD
Code: [Select]
  # Message
  re.compile(r'^:(?P<data>(?P<nick>.+)!(?P<ident>.+)@(?P<host>.+))\s(?P<action>PRIVMSG)(?P<data2>\s(?P<channel>\#[\w]+)\s(?P<text>.*))$',re.I),
to

NEW
Code: [Select]
  # Message
  re.compile(r'^:(?P<data>(?P<nick>.+)!(?P<ident>.+)@(?P<host>.+))\s(?P<action>PRIVMSG)(?P<data2>\s(?P<channel>\#[\w]+)\s:(?P<text>.*))$',re.I),

 on line 247
Code: [Select]
text = match.group('text')[:1]
remove [:1] from the end

It seems like i forgot to add the message prefix in there too so if you dont want everything written to the channel being sent to the game server then change the OnPrivmsg function starting on line 241 to:
Code: [Select]
	def OnPrivmsg(self,action,data,match=None):
"""
:dIRCBot!~dIRCBot@d0nin380.users.quakenet.org PRIVMSG #dIRCBot :hey
"""
nick = match.group('nick')
text = match.group('text')
if text.startswith(self.irc_chat_prefix):
self.console.say('[IRC]%s: %s'%(nick,text[1:]))
« Last Edit: March 21, 2013, 04:27:32 AM by d0nin380 »

Offline d0nin380

  • Full Member
  • ***
  • Posts: 56
Re: Dirc Plugin
« Reply #9 on: March 22, 2013, 03:24:38 AM »
Update:
Quote
#   2013/03/21 -1.1.1 - d0nin380
#       *fixed a bug in OnPrivmsg
#       *chat prefix can be left empty to send all messages in channel to game server
#       *identation matches b3 identation
#       *fixed file names

Offline Nocturnal1982

  • Full Member
  • ***
  • Posts: 111
    • Bandit Company
Re: Dirc Plugin
« Reply #10 on: March 24, 2013, 11:55:08 PM »
Wait, what exactly did you test this with?
The new version keeps making the same error.

Offline d0nin380

  • Full Member
  • ***
  • Posts: 56
Re: Dirc Plugin
« Reply #11 on: March 24, 2013, 11:58:19 PM »
Wait, what exactly did you test this with?
The new version keeps making the same error.

What is the error exactly?
B3.log?

here is what happens when I run it.

Tested in QUAKENET and COD4

I will run some tests on irc.rizon.net today for you...

edit:
so far all I've got in irc.rizon.net is numeric 439 which is reply too fast... probably just trying to register before the server is ready for it..

no other errors nor b3 crash.

I need your help to be able to help you ;)

edit2:
I added support for irc.rizon.net and while I was changing the README I figured out what the problem was and I apologize for that....

it said
Code: xml [Select]
<plugin config="@b3/extplugins/conf/Dirc.xml" name="DircPlugin" />

but it is supposed to say
Code: xml [Select]
<plugin config="@b3/extplugins/conf/dirc.xml" name="dirc" />


I'm setting this all up in github because I realized how many changes I'm making every day so rather than having staff approve the file every day, it will be available in github...

edit3:
the plugin should now be able to connect to irc.rizon.net.
the updated file is in https://github.com/d0nin380/big-brother-bot/blob/master/b3/extplugins/dirc.py and as long as you change the plugin config line in b3.xml to what it should be, all you need is the updated dirc.py.

I guess I should make a separated repo for the plugin alone...
« Last Edit: March 25, 2013, 04:06:39 AM by d0nin380 »

 


Rate this page +1 at Google Search