Pages: [1]   Go Down
  Print  
Author Topic: Twitter  (Read 1095 times) Bookmark and Share
Moderator
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 55
Offline Offline
WWW
« on: August 08, 2011, 08:13:30 AM »

This plugin has the following functionality:

1. If somebody got banned or kick this plugin will tweet player name, reason, expiration time, admin name

2. Admin can tweet ingame

3. Tweets from another twitter account can be printed ingame

Download: https://github.com/bmamba/b3-plugin-twitter/zipball/v1.1

You need at least 1.7.x

This plugin is similar to Ban Tweeter.

You can see the result here: http://twitter.com/chiLLUrT (all posts beginning with "Bot:").

Changelog:

v1.0
----

- plugin tweets kicks and bans
- admin can tweet ingame


v1.1
----

- plugin tweets additional information if somebody was banned/kicked:
  - expiration time of the ban
  - admin name
- plugin prints tweets of another twitter account
- Bugfix: b3 changed data for EVT_CLIENT_BAN_TEMP and EVT_CLIENT_BAN
« Last Edit: September 02, 2011, 09:19:31 AM by BlackMamba » Logged


Newbie
*
OS: --No B3 installed--
Type: --No B3 installed--
Gameservers: UrT
Posts: 5
Offline Offline
« Reply #1 on: August 22, 2011, 10:16:58 PM »

Greetings BlackMamba and all,

Just got done trying to install and use the twitter plugin for bans on B3 for UrT. An error message in b3.log said:
110822 23:25:39   BOT       Starting Plugin b3twitter
110822 23:25:39   ERROR   STDERR Twitter now requires an oAuth Access Token for API calls.
110822 23:25:39   ERROR   STDERR If your using this library from a command line utility, please
110822 23:25:39   ERROR   STDERR run the the included get_access_token.py tool to generate one


(by the way, this was the same error we got in attempting to use the Ban Tweeter plugin by Bakes)

We fixed this error by putting the username and password of the twitter account into consumer_secret and access_token_secret of the b3twitter.xml file. The B3 would crash if at least those two were not filled in. Not sure what exactly needs to go into these 4 fields, or even if all 4 fields need to have a value put in.
   <settings name="authentication">
      <set name="consumer_key"></set>
      <set name="consumer_secret"></set>
      <set name="access_token"></set>
      <set name="access_token_secret"></set>
   </settings>



The libraries and such are installed correctly it seems.

Any help to solve this and get it working would be appreciated. nice job Cheesy
Logged
Moderator
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 55
Offline Offline
WWW
« Reply #2 on: August 23, 2011, 12:46:59 PM »

You cannot use your normal login data to access the twitter api. You have to go to
https://dev.twitter.com/apps/new
to create a new application. After creation you have to change the read only mode to read and write and then create the tokens.
Logged

Moderator
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 55
Offline Offline
WWW
« Reply #3 on: August 26, 2011, 02:15:14 PM »

Some time ago it was possible that applications could using the twitter api. So the apps could write on your twitter account if they knew your username and password. But this is not possible anymore. Now you need four tokens (text strings), two for identifying your app (consumer tokens) and two which allow your app to access your twitter account (access tokens). The gain is that you don't need to give your login data to the app. If you don't want that the app can access your account anymore you can delete the access tokens and don't need to change your password or any tokens for other apps.

I wrote a short tutorial how to get the tokens from twitter:
http://www.bmamba.de/?p=221
Logged

Newbie
*
OS: --No B3 installed--
Type: --No B3 installed--
Gameservers: UrT
Posts: 5
Offline Offline
« Reply #4 on: August 31, 2011, 10:28:53 PM »

Ah ok. Thanks for that info and we should be set if we get this going.
Logged
Moderator
*
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 55
Offline Offline
WWW
« Reply #5 on: September 02, 2011, 09:24:22 AM »

I added a new version (see first post).

The plugin tweets expiration time and admin name additionally. There are some changes from 1.6 to 1.7, thats why the plugin needs to get fixed. As a result you need at least 1.7.0 now.

You can add another twitter account. Tweets from this account will be printed ingame.
Logged

Jr. Member
**
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 21
Offline Offline
« Reply #6 on: November 24, 2011, 12:54:23 AM »

BlackMamba - hope you can help

Just loaded your plugin .. Did all the dependencies added the extra modules and set up Twitter API etc

Can Tweet from inside the game with !twitter message

However not seeing any of the Auto Tweets

B3.log Example

111124 08:44:29   CONSOLE   '40:13 tell: GrandPa to GrandPa: !tempban crashtest 1m test'
111124 08:44:29   CONSOLE   '40:13 saytell: 0 0 GrandPa: !tempban crashtest 1m test'
111124 08:44:29   VERBOSE   'Client Found: GrandPa on slot 0'
111124 08:44:29   VERBOSE   'Queueing event Private Message !tempban crashtest 1m test'
111124 08:44:29   VERBOSE   'Parsing Event: Private Message: AdminPlugin'
111124 08:44:29   DEBUG   'AdminPlugin: OnSay handle 7:"!tempban crashtest 1m test"'
111124 08:44:29   DEBUG   'AdminPlugin: Handle command !tempban crashtest 1m test'
111124 08:44:29   VERBOSE   "RCON sending (127.0.0.1:27960) 'clientkick 8'"
111124 08:44:29   CONSOLE   '40:14 ClientDisconnect: 8'
111124 08:44:29   VERBOSE   'Queueing event Client Disconnect 8'
111124 08:44:29   CONSOLE   '40:14 Item: 7 ut_weapon_ump45'
111124 08:44:29   VERBOSE   "RCON sending (127.0.0.1:27960) 'say ^0(^2SkyNet^0)^7: CrashTestDummy^7 was temp banned by GrandPa^7 for 1.0 minute^7 ^7Test Purposes Only'"
111124 08:44:29   VERBOSE   "Queueing event Client Temp Banned {'duration': 1.0, 'admin': <b3.clients.Client object at 0x01CBE510>, 'reason': '^7Test Purposes Only'}"
111124 08:44:29   DEBUG   "Storage: setClientPenalty data {'time_edit': 1322124269, 'keyword': 'test', 'time_expire': 1322124329, 'admin_id': 1, 'reason': '^7Test Purposes Only', 'inactive': 0, 'data': '', 'client_id': 62, 'duration': 1.0, 'time_add': 1322124269, 'type': 'TempBan'}"
111124 08:44:29   VERBOSE   'Parsing Event: Client Disconnect: CtimePlugin'
111124 08:44:29   DEBUG   u'CtimePlugin: CTIME LEFT:'
111124 08:44:29   DEBUG   u'CtimePlugin: CTIME LEFT: Player: CrashTestDummy^7 played this time: 111 sec'
111124 08:44:29   DEBUG   u'CtimePlugin: CTIME LEFT: Player: CrashTestDummy^7 played this time: 0:1:51'
111124 08:44:29   VERBOSE   'Parsing Event: Client Disconnect: PoweradminurtPlugin'
111124 08:44:29   VERBOSE   'Parsing Event: Client Disconnect: DuelPlugin'
111124 08:44:29   DEBUG   'DuelPlugin: client disconnecting : None'
111124 08:44:29   ERROR   'handler DuelPlugin could not handle event Client Disconnect: AttributeError: \'NoneType\' object has no attribute \'var\' [(\'C:\\\\b3-1.7.1\\\\b3\\\\parser.py\', 973, \'handleEvents\', \'hfunc.parseEvent(event)\'), (\'C:\\\\b3-1.7.1\\\\b3\\\\plugin.py\', 158, \'parseEvent\', \'self.onEvent(event)\'), (\'C:\\\\b3-1.7.1\\\\b3\\\\extplugins\\\\duel.py\', 63, \'onEvent\', \'self.onDisconnect(event)\'), (\'C:\\\\b3-1.7.1\\\\b3\\\\extplugins\\\\duel.py\', 75, \'onDisconnect\', "duels = event.client.var(self, \'duelling\', {}).value")]'
111124 08:44:29   VERBOSE   'Parsing Event: Client Temp Banned: B3TwitterPlugin'
111124 08:44:29   DEBUG   "B3TwitterPlugin: select * from penalties where client_id = 62 and type in ('Ban', 'TempBan', 'Kick') order by time_add desc limit 1"
111124 08:44:29   DEBUG   "B3TwitterPlugin: Found at least one row: {'time_edit': 1322124269L, 'keyword': u'test', 'data': u'', 'time_expire': 1322124329L, 'admin_id': 1L, 'reason': u'^7Test Purposes Only', 'inactive': 0, 'client_id': 62L, 'duration': 1L, 'time_add': 1322124269L, 'type': u'TempBan', 'id': 13066L}"
111124 08:44:29   ERROR   "handler B3TwitterPlugin could not handle event Client Temp Banned: AttributeError: 'module' object has no attribute 'getByCID' [('C:\\\\b3-1.7.1\\\\b3\\\\parser.py', 973, 'handleEvents', 'hfunc.parseEvent(event)'), ('C:\\\\b3-1.7.1\\\\b3\\\\plugin.py', 158, 'parseEvent', 'self.onEvent(event)'), ('C:\\\\b3-1.7.1\\\\b3\\\\extplugins\\\\b3twitter.py', 215, 'onEvent', 'admin = b3.clients.getByCID(p.adminId)')]"
111124 08:44:29   VERBOSE   'Parsing Event: Client Temp Banned: SuperadminPlugin'
111124 08:44:29   DEBUG   'formatting time with timezone [GMT], tzOffset : 0'
111124 08:44:30   VERBOSE   "RCON sending (127.0.0.1:27960) 'status'"
111124 08:44:31   VERBOSE   "RCON sending (127.0.0.1:27960) 'tell 0 ^0(^2SkyNet^0)^7: ^3[pm]^7 ^7CrashTestDummy has ^41 ^7past bans'"
111124 08:44:32   VERBOSE   "RCON sending (127.0.0.1:27960) 'tell 4 ^0(^2SkyNet^0)^7: ^3[pm]^7 ^7CrashTestDummy has ^41 ^7past bans'"


Any Ideas ?  Thanks
Logged
Jr. Member
**
OS: Linux
Type: Owner dedicated server(s)
Gameservers: UrT
Posts: 21
Offline Offline
« Reply #7 on: November 24, 2011, 04:01:01 AM »

Update ..

Changed Config to not Look up Admin who did the kick ban and it now works
   <settings name="tweet">
      <set name="tweetonkick">True</set>
      <set name="tweetonbantemp">True</set>
      <set name="tweetonban">True</set>
      <set name="tweetadminname">False</set>
      <set name="tweetexpirationdate">True</set>
   </settings>

Would still like to get the Admin name on the Tweet working .. so help woul dbe appreciated on fixing that

Also spotted in B3.log, although tweeting there is new error reported

111124 11:55:36   DEBUG   "B3TwitterPlugin: select * from penalties where client_id = 62 and type in ('Ban', 'TempBan', 'Kick') order by time_add desc limit 1"
111124 11:55:36   DEBUG   "B3TwitterPlugin: Found at least one row: {'time_edit': 1322135736L, 'keyword': u'test', 'data': u'', 'time_expire': 1322135796L, 'admin_id': 1L, 'reason': u'^7Test Purposes Only', 'inactive': 0, 'client_id': 62L, 'duration': 1L, 'time_add': 1322135736L, 'type': u'TempBan', 'id': 13070L}"
111124 11:55:36   DEBUG   u'B3TwitterPlugin: Tweet: CrashTestDummy was banned  until 24/11/2011, 11:56: Test Purposes Only'
111124 11:55:37   ERROR   'handler B3TwitterPlugin could not handle event Client Temp Banned: NameError: global name \'rmColor\' is not defined [(\'C:\\\\b3-1.7.1\\\\b3\\\\parser.py\', 973, \'handleEvents\', \'hfunc.parseEvent(event)\'), (\'C:\\\\b3-1.7.1\\\\b3\\\\plugin.py\', 158, \'parseEvent\', \'self.onEvent(event)\'), (\'C:\\\\b3-1.7.1\\\\b3\\\\extplugins\\\\b3twitter.py\', 231, \'onEvent\', "status = self._twitterapi.PostUpdate(\'%s\' % rmColor)")]'
Logged
Beta Testers
*
OS: Windows
Type: Owner dedicated server(s)
Gameservers: alterIW
Posts: 652
Offline Offline
WWW
« Reply #8 on: November 27, 2011, 08:41:17 PM »

Very nice plugin. I am trying it out on my aIW servers.
Logged
Beta Testers
*
OS: Windows
Type: Owner dedicated server(s)
Gameservers: alterIW
Posts: 652
Offline Offline
WWW
« Reply #9 on: November 27, 2011, 08:46:17 PM »

Well, added this just like any other external plugin and I get this error in the b3 log:

Code:
111127 20:41:56 BOT    'Loading Plugin #10 b3twitter [C:\\b3\\b3dmc\\b3\\extplugins\\conf\\b3twitter.xml]'
111127 20:41:56 INFO 'Could not load built in plugin b3twitter (No module named b3twitter)'
111127 20:41:56 INFO 'trying external plugin directory : C:\\b3\\b3dmc\\b3\\extplugins'
111127 20:41:56 CRITICAL 'Error loading plugin: No module named twitter'
Traceback (most recent call last):
  File "C:\b3\b3dmc\b3\parser.py", line 604, in loadPlugins
    pluginModule = self.pluginImport(plugins[s]['name'], plugins[s]['path'])
  File "C:\b3\b3dmc\b3\parser.py", line 717, in pluginImport
    return imp.load_module(name, fp, pathname, description)
  File "C:\b3\b3dmc\b3\extplugins\b3twitter.py", line 34, in <module>
    import twitter
ImportError: No module named twitter
Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2630
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #10 on: November 28, 2011, 08:18:02 AM »

Did you install the extra libs?
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Beta Testers
*
OS: Windows
Type: Owner dedicated server(s)
Gameservers: alterIW
Posts: 652
Offline Offline
WWW
« Reply #11 on: November 28, 2011, 06:28:32 PM »

Did you install the extra libs?

I didn't see anything about extra libs in the directions.
Logged
Support Hero
*
OS: Windows
Type: Gameserver Rental Co.
Gameservers: 2x CoD4, 1x BF3
Posts: 2630
Offline Offline
Owner of Host4B3.com - Over 70 bots hosted!
WWW
« Reply #12 on: November 28, 2011, 07:20:22 PM »

You can TRY installing this in the b3 folder. I don't know if this is what you need, but simple test.

http://code.google.com/p/python-twitter/ and http://pypi.python.org/pypi/simplejson

And this needs a lib from what I can tell, but could be wrong.

Weird it is not in the instructions.
Logged

Need B3 Bot hosting? Check out Host4B3.com
Check Twitter.com/Host4B3 for updates if the site it down.

Help will be given to those with a b3.log

System: Python 2.7.1 - B3 Source Code - Locally hosted MySQL & Apache - Win 2k3
Tags: plugin twitter 
Pages: [1]   Go Up
  Print  
 
Jump to:  


Rate this page +1 at Google Search


SimplePortal 2.3.1 © 2008-2009, SimplePortal