Skip to content

Commit 0de684b

Browse files
committed
replace emojis with text symbols for less flashiness
1 parent d6f6746 commit 0de684b

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

bot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
logger = logging.getLogger(__name__)
1515

1616

17-
BOT_TOKEN = os.environ.get('BOT_TOKEN')
17+
BOT_TOKEN = os.environ.get('BOT_TOKEN_NOTION')
1818

1919
def error(update, context):
2020
"""Log Errors caused by Updates."""
@@ -23,6 +23,7 @@ def error(update, context):
2323

2424
def main():
2525
# pp = PicklePersistence(filename='notionbot')
26+
logger.info(f'bot token: {BOT_TOKEN}')
2627
updater = Updater(BOT_TOKEN, use_context=True)
2728

2829
dp = updater.dispatcher

db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
Base = declarative_base()
9-
engine = create_engine(os.environ['DATABASE_URL'])
9+
engine = create_engine(os.environ['DATABASE_URL_NOTION'])
1010
DBSession = sessionmaker(bind=engine)
1111
session = DBSession()
1212

helpers.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def set_notion_api_key(update, context):
7272

7373
session.commit()
7474

75-
update.message.reply_text('✔️ Notion API key set.', reply_markup=keyboard)
75+
update.message.reply_text(' Notion API key set.', reply_markup=keyboard)
7676

7777
setclient(update, context, user)
7878

@@ -85,9 +85,9 @@ def setclient(update, context, user):
8585

8686
try:
8787
context.user_data['notion_client'] = NotionClient(token_v2=user.notion_api_key)
88-
update.message.reply_text('✔️ Notion client set!', reply_markup=keyboard)
88+
update.message.reply_text(' Notion client set!', reply_markup=keyboard)
8989
except Exception as e:
90-
update.message.reply_text(f' Error while setting Notion client: {e}', reply_markup=keyboard)
90+
update.message.reply_text(f' Error while setting Notion client: {e}', reply_markup=keyboard)
9191

9292
return ConversationHandler.END
9393

@@ -97,17 +97,17 @@ def check_client(update, context):
9797
user = session.query(User).filter(User.username == username).first()
9898

9999
if user.notion_api_key:
100-
update.message.reply_text('✔️ Notion API key set!', reply_markup=keyboard)
100+
update.message.reply_text(' Notion API key set!', reply_markup=keyboard)
101101

102102
if not user.notion_api_key:
103-
update.message.reply_text(' Notion API key not set.', reply_markup=keyboard)
103+
update.message.reply_text(' Notion API key not set.', reply_markup=keyboard)
104104
ask_notion_api_key(update, context)
105105

106106
if context.user_data.get('notion_client'):
107-
update.message.reply_text('✔️ Notion client set!', reply_markup=keyboard)
107+
update.message.reply_text(' Notion client set!', reply_markup=keyboard)
108108

109109
if not context.user_data.get('notion_client'):
110-
update.message.reply_text(' Notion client not set.', reply_markup=keyboard)
110+
update.message.reply_text(' Notion client not set.', reply_markup=keyboard)
111111
setclient(update, context, user)
112112

113113
return ConversationHandler.END
@@ -133,7 +133,7 @@ def set_page_address(update, context):
133133
update.message.reply_text(f'page adress set to {page_address}.')
134134

135135
except Exception as e:
136-
update.message.reply_text(f' error while setting page adress: {e}', reply_markup=keyboard)
136+
update.message.reply_text(f' error while setting page adress: {e}', reply_markup=keyboard)
137137

138138
connect_to_page(update, context, user, user.page_address)
139139

@@ -154,10 +154,10 @@ def connect_to_page(update, context, user, page_address):
154154

155155
session.commit()
156156

157-
update.message.reply_text(f'✔️ connected to page {user.page_title}!')
157+
update.message.reply_text(f' connected to page {user.page_title}!')
158158

159159
except Exception as e:
160-
update.message.reply_text(f' error while connecting to page: {e}', reply_markup=keyboard)
160+
update.message.reply_text(f' error while connecting to page: {e}', reply_markup=keyboard)
161161
# если это не сделать, он уйдет в бесконечное 'page set to'!
162162
return ConversationHandler.END
163163

@@ -167,17 +167,17 @@ def check_page(update, context):
167167
user = session.query(User).filter(User.username == username).first()
168168

169169
if user.page_address:
170-
update.message.reply_text(f'✔️ page address set.', reply_markup=keyboard)
170+
update.message.reply_text(f' page address set.', reply_markup=keyboard)
171171

172172
if not user.page_address:
173-
update.message.reply_text(' page address not set.', reply_markup=keyboard)
173+
update.message.reply_text(' page address not set.', reply_markup=keyboard)
174174
askpage(update, context)
175175

176176
if context.user_data.get('page'):
177-
update.message.reply_text(f'✔️ connected to page {user.page_title}.', reply_markup=keyboard)
177+
update.message.reply_text(f' connected to page {user.page_title}.', reply_markup=keyboard)
178178

179179
if not context.user_data.get('page'):
180-
update.message.reply_text(' page not connected.', reply_markup=keyboard)
180+
update.message.reply_text(' page not connected.', reply_markup=keyboard)
181181
connect_to_page(update, context, user, user.page_address)
182182

183183
return ConversationHandler.END
@@ -193,7 +193,7 @@ def send_text_to_notion(update, context):
193193
newblock = page.children.add_new(TextBlock, title=text)
194194
update.message.reply_text(f'Sent text to {user.page_title}.', reply_markup=keyboard)
195195
except Exception as e:
196-
update.message.reply_text(f' Error while sending text to Notion: {e}', reply_markup=keyboard)
196+
update.message.reply_text(f' Error while sending text to Notion: {e}', reply_markup=keyboard)
197197

198198
return ConversationHandler.END
199199

0 commit comments

Comments
 (0)