mirror of
https://codeberg.org/sch/BukuBot
synced 2024-11-17 19:48:40 +01:00
61 lines
1.9 KiB
Python
61 lines
1.9 KiB
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
# BukuBot: Chat Bot Bookmark Manager for XMPP
|
||
|
# Copyright (C) 2024 Schimon Zackary
|
||
|
# This file is part of BukuBot.
|
||
|
# See the file LICENSE for copying permission.
|
||
|
|
||
|
import buku
|
||
|
from bukubot.about import Documentation
|
||
|
from bukubot.config import Configuration
|
||
|
from bukubot.xmpp.chat import Chat
|
||
|
from bukubot.xmpp.client import Client
|
||
|
from getpass import getpass
|
||
|
from argparse import ArgumentParser
|
||
|
import logging
|
||
|
import os
|
||
|
import slixmpp
|
||
|
import sys
|
||
|
|
||
|
# bookmarks_db = buku.BukuDb(dbfile='temp.db')
|
||
|
# bookmarks_db.get_tag_all
|
||
|
# bookmarks_db.search_keywords_and_filter_by_tags
|
||
|
# bookmarks_db.exclude_results_from_search
|
||
|
|
||
|
def main():
|
||
|
# Setup the command line arguments.
|
||
|
parser = ArgumentParser(description=Client.__doc__)
|
||
|
|
||
|
# Output verbosity options.
|
||
|
parser.add_argument("-q", "--quiet", help="set logging to ERROR",
|
||
|
action="store_const", dest="loglevel",
|
||
|
const=logging.ERROR, default=logging.INFO)
|
||
|
parser.add_argument("-d", "--debug", help="set logging to DEBUG",
|
||
|
action="store_const", dest="loglevel",
|
||
|
const=logging.DEBUG, default=logging.INFO)
|
||
|
|
||
|
# JID and password options.
|
||
|
parser.add_argument("-j", "--jid", dest="jid",
|
||
|
help="JID to use")
|
||
|
parser.add_argument("-p", "--password", dest="password",
|
||
|
help="password to use")
|
||
|
|
||
|
args = parser.parse_args()
|
||
|
|
||
|
# Setup logging.
|
||
|
logging.basicConfig(level=args.loglevel,
|
||
|
format='%(levelname)-8s %(message)s')
|
||
|
|
||
|
if args.jid is None:
|
||
|
args.jid = input("Username: ")
|
||
|
if args.password is None:
|
||
|
args.password = getpass("Password: ")
|
||
|
|
||
|
# Setup the bot and register plugins. Note that while plugins may
|
||
|
# have interdependencies, the order in which you register them does
|
||
|
# not matter.
|
||
|
xmpp = Client(args.jid, args.password)
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|