mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
cleanup; use a more reasonable config{} definition method
This commit is contained in:
10
bot.py
10
bot.py
@@ -26,7 +26,6 @@ def message_handler(connect_object, message_node):
|
||||
typ='groupchat'
|
||||
)
|
||||
)
|
||||
# send_msg('hello %s!' % msg_from)
|
||||
|
||||
try:
|
||||
print '%20s: %s' %(msg_from, msg_body)
|
||||
@@ -44,15 +43,6 @@ client.RegisterHandler('message', message_handler)
|
||||
|
||||
client.send(xmpp.Presence(to=(conf('room') + '/' + conf('nick'))))
|
||||
|
||||
def send_msg(msg='''wee, I'm a native bot.'''):
|
||||
client.send(
|
||||
xmpp.protocol.Message(
|
||||
to=conf('room'),
|
||||
body=msg,
|
||||
typ='groupchat'
|
||||
)
|
||||
)
|
||||
|
||||
while (t + time.time()) < 30:
|
||||
client.Process(1)
|
||||
|
||||
|
||||
@@ -4,11 +4,13 @@ if '__main__' == __name__:
|
||||
print '''don't try running this'''
|
||||
exit(-1)
|
||||
|
||||
config = {}
|
||||
config['jid'] = ''
|
||||
config['password'] = ''
|
||||
config['room'] = ''
|
||||
config['nick'] = ''
|
||||
config = {
|
||||
'jid': '',
|
||||
'password': '',
|
||||
'room': '',
|
||||
'nick': '',
|
||||
'nick': 'urlbot'
|
||||
}
|
||||
|
||||
def conf(val):
|
||||
if val in config.keys():
|
||||
|
||||
Reference in New Issue
Block a user