-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init #3
Open
Prosta4okua
wants to merge
5
commits into
main
Choose a base branch
from
tg
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
init #3
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,2 +1,19 @@ | ||
# Notion Assistant Telegram Bot | ||
<h1>Notion Assistant Telegram Bot</h1> | ||
Telegram assistant bot for Notion. | ||
|
||
<h1>Bot Features</h1> | ||
<ul> | ||
<li>Automatically saves your reposted to our bot materials in Notion</li> | ||
<li>Currently languages: Ukrainian and English</li> | ||
</ul> | ||
|
||
<h2>Building on your locale mashine</h2> | ||
<ol> | ||
<li>Clone repository</li> | ||
<li>Install all requirements from <code>requirements.txt</code></li> | ||
<li>Rename <code>.env.example</code> to <code>.env</code></li> | ||
<li>Add Telegram Bot Token</li> | ||
<li>Run <code>__init__.py</code></li> | ||
</ol> | ||
|
||
<div>Made by Yishachock.io</div> |
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,3 +1,4 @@ | ||
python-dotenv~=0.21.1 | ||
certifi==2022.12.7 | ||
charset-normalizer==3.0.1 | ||
idna==3.4 | ||
|
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 @@ | ||
from bot import startTelegramBot | ||
|
||
startTelegramBot() |
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,6 @@ | ||
from bot.controller import Controller | ||
from dotenv import load_dotenv | ||
|
||
def startTelegramBot(): | ||
load_dotenv("res/config/.env") | ||
controller = Controller() |
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,28 @@ | ||
import os | ||
|
||
import i18n | ||
import telebot | ||
|
||
|
||
class Controller: | ||
|
||
def __init__(self): | ||
# setting up translation | ||
i18n.set('file_format', 'json') | ||
i18n.set('locale', 'en') | ||
i18n.load_path.append("res/translations") | ||
|
||
TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN") | ||
bot = telebot.TeleBot(TOKEN) | ||
|
||
@bot.message_handler(commands=['start', 'help']) | ||
def command_help(message): | ||
bot.reply_to(message, i18n.t("tr.start_help")) | ||
|
||
@bot.message_handler(func=lambda message: True, | ||
content_types=['audio', 'video', 'document', 'text', 'location', 'contact', 'sticker']) | ||
def default_command(message): | ||
bot.reply_to(message, "tr.test") | ||
|
||
print("Bot has started!") | ||
bot.infinity_polling() |
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 @@ | ||
# Get it from FatherBot in Telegram | ||
Prosta4okua marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TELEGRAM_BOT_TOKEN= |
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,5 @@ | ||
{ | ||
"en": { | ||
"start_help": "Hello!\nYou can repost your materials to our bot to auto-save them in Notion." | ||
} | ||
} |
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,6 @@ | ||
{ | ||
"uk": { | ||
"start_help": "Вітаю!\nВи можете пересилати сюди свої матеріали, щоби зберегти їх в Notion!", | ||
"test": "Ця команда наразі тестується!" | ||
} | ||
} |
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,9 @@ | ||
# import os | ||
|
||
|
||
import i18n | ||
from dotenv import load_dotenv, find_dotenv | ||
|
||
|
||
def setup(): | ||
load_dotenv("res/config/.env") |
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,13 @@ | ||
from distutils.core import setup | ||
# IDK why i've created this | ||
setup( | ||
name='notion-assistant-telegram-bot', | ||
version='', | ||
packages=['bot', 'notion'], | ||
package_dir={'': 'src'}, | ||
url='', | ||
license='', | ||
author='Yishachok.io', | ||
author_email='', | ||
description='' | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Зроби статичні методи, і можна не створювати об'єкт
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а це точно ООП?