Browse Source

Basic structure for jogobot bot

develop
Jonathan Golder 6 years ago
parent
commit
506400a528
  1. 75
      euroexange/euroexange.py

75
euroexange/euroexange.py

@ -0,0 +1,75 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# 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 2 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
import os
import locale
import pywikibot
import jogobot
class EuroExangeBot( pywikibot.bot.BaseBot ):
def __init__( self, genFactory, **kwargs ):
super().__init__(*kwargs)
def run(self):
pass
def main(*args):
"""
Process command line arguments and invoke bot.
If args is an empty list, sys.argv is used.
@param args: command line arguments
@type args: list of unicode
"""
# Make sure locale is set to 'de_DE.UTF-8' to prevent problems
# with wrong month abreviations in strptime
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
# Process global arguments to determine desired site
local_args = pywikibot.handle_args(args)
# Get the jogobot-task_slug (basename of current file without ending)
task_slug = os.path.basename(__file__)[:-len(".py")]
# Actually not needed since we only run semi-automaticall
# Before run, we need to check wether we are currently active or not
#~ if not jogobot.bot.active( task_slug ):
#~ return
# Parse local Args to get information about subtask
( subtask, genFactory, subtask_args ) = jogobot.bot.parse_local_args(
local_args, None )
# Init Bot
bot = jogobot.bot.init_bot( task_slug, None, EuroExangeBot, genFactory)
# Run bot
jogobot.bot.run_bot( task_slug, None, bot )
if( __name__ == "__main__" ):
main()
Loading…
Cancel
Save