def setUp(self): self.nicknames = set() patcher = patch('builtins.open') self.addCleanup(patcher.stop) patcher.start() patcher = patch('random.randint', return_value=123) self.addCleanup(patcher.stop) self.mock_randint = patcher.start() patcher = patch('pickle.load', return_value=self.nicknames) self.addCleanup(patcher.stop) patcher.start() patcher = patch('jabberbot.mucbot.Timer') self.addCleanup(patcher.stop) self.mock_timer = patcher.start() patcher = patch.object(MUCBot, 'register_plugin') self.addCleanup(patcher.stop) patcher.start() patcher = patch.object(MUCBot, 'add_event_handler') self.addCleanup(patcher.stop) patcher.start() patcher = patch.object(MUCBot, 'send_message') self.addCleanup(patcher.stop) patcher.start() self.bot = MUCBot('*****@*****.**', 'mypassword', '*****@*****.**', 'itsme', 'translator', 'translator_sec')
#!/usr/bin/env python from jabberbot.mucbot import MUCBot jid = '' pwd = '' muc_room = '' muc_nick = '' trans_client_id = '' trans_client_sec = '' bot = MUCBot(jid, pwd, muc_room, muc_nick, trans_client_id, trans_client_sec) bot.connect() bot.process(block=True)
# # 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/>. from jabberbot.mucbot import MUCBot print("Leyendo configuracion...") jid = '*****@*****.**' #edita esto por una cuenta de jabber pwd = "pasword here" #Edita esto por tu password muc_room = '*****@*****.**' #edita esto por el servidor y la sala muc_nick = 'jabberstom' #Esto no lo edites el nombre es lindo xd print("Configuracion aceptada....") bot = MUCBot(jid, pwd, muc_room, muc_nick) print("conectando...") bot.connect() print( "El bot esta conectado y listo para usar.. Seria preferible correr el bot en background" ) bot.process(block=True)