How to use the deltachat.Account function in deltachat

To help you get started, we’ve selected a few deltachat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deltachat / deltabot / src / deltabot / cmdline.py View on Github external
def bot_main(ctx, basedir, stdout_loglevel):
    """delta.chat bot management command line interface."""
    basedir = os.path.abspath(os.path.expanduser(basedir))
    if not os.path.exists(basedir):
        os.makedirs(basedir)

    db_path = os.path.join(basedir, "account.db")
    account = deltachat.Account(db_path, "deltabot/{}".format(sys.platform))
    loglevel = getattr(logging, stdout_loglevel.upper())
    logger = make_logger(basedir, loglevel)
    ctx.bot = DeltaBot(account, logger)
github deltachat / deltabot / src / simplebot / cmdline.py View on Github external
def get_account(basedir, remove=False):
    dbpath = os.path.join(basedir, "account.db")
    if remove and os.path.exists(dbpath):
        os.remove(dbpath)
    acc = deltachat.Account(dbpath)
    acc.db_path = dbpath
    return acc
github deltachat / deltabot / src / deltabot / main.py View on Github external
def make_bot_from_args(args, plugin_manager, account=None):
    basedir = os.path.abspath(os.path.expanduser(args.basedir))
    if not os.path.exists(basedir):
        os.makedirs(basedir)

    if account is None:
        db_path = os.path.join(basedir, "account.db")
        account = Account(db_path, "deltabot/{}".format(sys.platform))

    logger = plugin_manager.hook.deltabot_get_logger(args=args)
    return DeltaBot(account, logger, plugin_manager=plugin_manager)