forked from JaquerEspeis/err-tweebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tweebot.py
27 lines (21 loc) · 881 Bytes
/
tweebot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from errbot import BotPlugin, botcmd
import tweepy
class TweeBot(BotPlugin):
"""Updates twitter status"""
@botcmd
def tweet(self, msg, args):
"""Send tweet to the world"""
auth = tweepy.OAuthHandler(self.config['consumer_key'], self.config['consumer_secret'])
auth.set_access_token(self.config['access_token'], self.config['access_token_secret'])
api = tweepy.API(auth)
try:
status = api.update_status(args)
return "Twitter status updated."
except tweepy.error.TweepError as error:
return error.response.text
def get_configuration_template(self):
return {'consumer_key': 'change me',
'consumer_secret': 'change me',
'access_token': 'change me',
'access_token_secret': 'change me',
}