-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
883bcd7
commit cd2bc99
Showing
5 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
config.yaml | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Introduction | ||
This bot is intended to serve as a SecretSanta randomizer to bring people around the world! It's idea is very simple: user can create a group and get special id of that group. After obtaining Id user automatically joins the initiated group and can share this id with others. | ||
|
||
While creating group, admin specifies time for the timer. When time passed all members of the group who specified the valid information about their interests will get information about a person to whome they will give present! | ||
|
||
Merry X-mas! | ||
|
||
# Setting up | ||
First you will need to install all required packages. We strongly advise to do it in a newly created environment using conda/virtualenv. To to this run the following command: | ||
``` | ||
python3 -m pip install -r requirements.txt | ||
``` | ||
|
||
# Implementation | ||
|
||
## Database | ||
For storing information about customers we use PostgreSQL. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
database: | ||
ip: 127.0.0.1 | ||
port: 5051 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
import telebot | ||
import yaml | ||
import argparse | ||
|
||
def parse_arguments(): | ||
parser = argparse.ArgumentParser() | ||
|
||
parser.add_argument('--config-path', type=str, default='./config.yaml', | ||
help='Path to the file, where base configuration is being stored.') | ||
parser.add_argument('--api-key', type=str, required=True, | ||
help='API-key of your bot.') | ||
|
||
return parser.parse_args() | ||
|
||
|
||
if __name__ == '__main__': | ||
args = parse_arguments() | ||
bot = telebot.TeleBot(args.api_key) | ||
|
||
with open(args.config_path) as config: | ||
config = yaml.safe_load(config) | ||
|
||
print(config) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pyTelegramBotAPI | ||
pyyaml |