Portage NixOS
This commit is contained in:
parent
61e491699f
commit
ebf12e00a4
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
__pycache__
|
||||
*.egg-info
|
||||
result
|
||||
api_keys.env
|
@ -1,8 +0,0 @@
|
||||
FROM python:alpine
|
||||
|
||||
RUN apk add --no-cache gcc g++ make libffi-dev openssl-dev && \
|
||||
pip install python-telegram-bot requests block-io
|
||||
|
||||
COPY run.py /
|
||||
|
||||
CMD ["python", "run.py"]
|
7
Makefile
7
Makefile
@ -1,7 +0,0 @@
|
||||
.PHONY: build
|
||||
build:
|
||||
docker build -t dogetipbot .
|
||||
|
||||
.PHONY: run
|
||||
run: build
|
||||
docker run --rm --name dogetipbot --env-file api_keys.env dogetipbot
|
@ -1,3 +0,0 @@
|
||||
BLOCK_IO_API_KEY=123455678
|
||||
BLOCK_IO_PIN=12345678
|
||||
TELEGRAM_API_KEY=12345678
|
26
default.nix
Normal file
26
default.nix
Normal file
@ -0,0 +1,26 @@
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) fetchgit;
|
||||
inherit (blockioPkgs) python3;
|
||||
|
||||
blockioPkgs = import (fetchgit {
|
||||
url = "https://github.com/nyanloutre/nixpkgs.git";
|
||||
rev = "b2e5d6520e16e6188b13ee79712078b072e253f5";
|
||||
sha256 = "0gjy61vpm434fvfwb6kbgsmd9d8k7w4kk68vxikivys805h4sxd0";
|
||||
}){};
|
||||
in
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
name = "dogetipbot-telegram-${version}";
|
||||
version = "1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
propagatedBuildInputs = with python3.pkgs; [
|
||||
python-telegram-bot
|
||||
requests
|
||||
block-io
|
||||
];
|
||||
}
|
29
run.py → dogetipbot_telegram.py
Normal file → Executable file
29
run.py → dogetipbot_telegram.py
Normal file → Executable file
@ -5,11 +5,27 @@ import logging
|
||||
import os
|
||||
import urllib.request
|
||||
import json
|
||||
import argparse
|
||||
|
||||
BLOCK_IO_API_KEY = os.environ['BLOCK_IO_API_KEY']
|
||||
BLOCK_IO_PIN = os.environ['BLOCK_IO_PIN']
|
||||
TELEGRAM_API_KEY = os.environ['TELEGRAM_API_KEY']
|
||||
NETWORK = os.environ['NETWORK']
|
||||
# BLOCK_IO_API_KEY = os.environ['BLOCK_IO_API_KEY']
|
||||
# BLOCK_IO_PIN = os.environ['BLOCK_IO_PIN']
|
||||
# TELEGRAM_API_KEY = os.environ['TELEGRAM_API_KEY']
|
||||
# NETWORK = os.environ['NETWORK']
|
||||
|
||||
# Parsing arguments
|
||||
|
||||
parser = argparse.ArgumentParser(description='Dogetipbot telegram')
|
||||
parser.add_argument('--block-io-api-key')
|
||||
parser.add_argument('--block-io-pin')
|
||||
parser.add_argument('--telegram-api-key')
|
||||
parser.add_argument('--network')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
BLOCK_IO_API_KEY = args.block_io_api_key
|
||||
BLOCK_IO_PIN = args.block_io_pin
|
||||
TELEGRAM_API_KEY = args.telegram_api_key
|
||||
NETWORK = args.network
|
||||
|
||||
# Logging
|
||||
|
||||
@ -216,5 +232,6 @@ dispatcher.add_handler(infos_handler)
|
||||
withdraw_handler = CommandHandler('withdraw', withdraw, pass_args=True)
|
||||
dispatcher.add_handler(withdraw_handler)
|
||||
|
||||
updater.start_polling()
|
||||
updater.idle()
|
||||
def main():
|
||||
updater.start_polling()
|
||||
updater.idle()
|
22
setup.py
Normal file
22
setup.py
Normal file
@ -0,0 +1,22 @@
|
||||
from setuptools import setup
|
||||
|
||||
setup(
|
||||
name='dogetipbot-telegram',
|
||||
py_modules=['dogetipbot_telegram'],
|
||||
version='1.0',
|
||||
description='Telegram bot for tipping Dogecoins',
|
||||
author='Paul TREHIOU',
|
||||
author_email='paul@nyanlout.re',
|
||||
url='https://gitea.nyanlout.re/nyanloutre/dogetipbot-telegram',
|
||||
license='MIT',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'dogetipbot-telegram=dogetipbot_telegram:main'
|
||||
]
|
||||
},
|
||||
install_requires=[
|
||||
'python-telegram-bot',
|
||||
'requests',
|
||||
'block-io'
|
||||
]
|
||||
)
|
Loading…
Reference in New Issue
Block a user