-
Notifications
You must be signed in to change notification settings - Fork 4
/
Talho.py.example
executable file
·95 lines (85 loc) · 3.03 KB
/
Talho.py.example
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################
# Talho - jabber bot
# Copyright (C) 2008 anonymous
# (C) eurekafag 2009-2011
#
# 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 3 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, see <http://www.gnu.org/licenses/>.
###############################################
import sys
import os
import signal
os.chdir(sys.path[0])
from jabberbot import JabberBot
# Settings {{{
user = (u'[email protected]', u'password', u'Talho') # jid, pass, nick
rooms = {u'[email protected]': ('', 10), u'[email protected]': ('', 10), u'[email protected]': ('', 9)} # conference jid : (nick, conference default level)
usersjid = {u'[email protected]': 0} # admin's jid
usersnick = {u'eurekafag': 0} # nick : level
#}}}
mpd_password = "password_for_mpd_access"
icecast_admin = ("admin", "admin")
vk_acc = ("[email protected]", "password")
mpd_addr = {"host": "127.0.0.1", "port": "6600"}
google_key = "blablabla" # get it on http://code.google.com/intl/ru-RU/apis/loader/signup.html
ans_file = "/srv/radioanon.ru/htdocs/answers.html"
bh_file = "/srv/radioanon.ru/htdocs/bhl.php"
ans_salt = "type_random_letters_here"
vkontakte_cookies = "remixsid=valid_cookie_should_be_here"
ignors = ["^__^", "Miria", "other nicks you want bot not to react to"]
def handle_pdb(sig, frame):
import pdb
pdb.set_trace()
def main(): #{{{
signal.signal(signal.SIGUSR1, handle_pdb)
bot = JabberBot(user, rooms, usersjid, usersnick, logfile)
bot.settings = {}
bot.settings['mpd_password'] = mpd_password
bot.settings['icecast_admin'] = icecast_admin
bot.settings['vk_acc'] = vk_acc
bot.settings['mpd_addr'] = mpd_addr
bot.settings['google_key'] = google_key
bot.settings['ans_file'] = ans_file
bot.settings['bh_file'] = bh_file
bot.settings['ans_salt'] = ans_salt
bot.settings['vkontakte_cookies'] = vkontakte_cookies
bot.settings['ignors'] = ignors
bot.load()
bot.process()
#}}}
def help(): #{{{
help = ('Usage: %s [-d|-h|--help]' %sys.argv[0]) +\
'\n\n' +\
'-d daemon\n' +\
'-h, --help help'
print(help)
sys.exit(1)
#}}}
logfile = '/dev/stdout'
if len(sys.argv) > 1:
if sys.argv[1] == '-h' or sys.argv[1] == '--help':
help()
elif sys.argv[1] == '-d':
logfile = 'bot.log'
pid = os.fork()
if pid == 0:
os.setsid()
pid = os.fork()
if pid == 0:
main()
else:
help()
else:
main()