Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BX-Committees
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BX-Telegram
BX-Committees
Commits
3a7fb451
Commit
3a7fb451
authored
1 year ago
by
Charlielv04
Browse files
Options
Downloads
Patches
Plain Diff
Menu implementation
parent
548f31a4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Committees-Parrot.py
+1
-1
1 addition, 1 deletion
src/Committees-Parrot.py
src/Committees/bar.py
+14
-9
14 additions, 9 deletions
src/Committees/bar.py
with
15 additions
and
10 deletions
src/Committees-Parrot.py
+
1
−
1
View file @
3a7fb451
...
...
@@ -24,7 +24,7 @@ from dotenv import load_dotenv
import
os
load_dotenv
()
COMMITTEES_TOKEN
=
os
.
getenv
(
"
SAILORE_COMMITTEE
_BOT
"
)
COMMITTEES_TOKEN
=
os
.
getenv
(
"
TEST
_BOT
"
)
PARROT_TOKEN
=
os
.
getenv
(
"
SAILORE_PARROT_BOT
"
)
SAILORE_TOKEN
=
os
.
getenv
(
"
SAILORE_BX_BOT
"
)
...
...
This diff is collapsed.
Click to expand it.
src/Committees/bar.py
+
14
−
9
View file @
3a7fb451
import
googleapiclient.errors
from
.
import
base
import
utils
import
bx_utils
import
os
from
telegram
import
Update
,
Bot
,
InlineKeyboardButton
,
InlineKeyboardMarkup
from
telegram.constants
import
ParseMode
...
...
@@ -26,12 +29,16 @@ class Bar(base.Committee_hub_base):
self
.
info
=
bx_utils
.
db
.
get_committee_info
(
self
.
name
)
async
def
menu
(
self
,
update
:
Update
,
context
:
ContextTypes
.
DEFAULT_TYPE
):
"""
Asks for the receival of the menu
"""
if
"
menu_id
"
in
self
.
info
.
keys
():
photo_id
=
self
.
info
[
"
menu_id
"
]
await
context
.
bot
.
send_message
(
chat_id
=
update
.
effective_chat
.
id
,
text
=
"
This was the previous menu
"
)
await
context
.
bot
.
send_photo
(
chat_id
=
update
.
effective_chat
.
id
,
photo
=
photo_id
)
file_path
=
utils
.
config
.
ROOT
+
'
/data/temp_files/menu.jpg
'
try
:
bx_utils
.
drive
.
download_committee_file
(
self
.
name
,
'
menu.jpg
'
,
file_path
)
with
open
(
file_path
,
'
rb
'
)
as
file
:
await
context
.
bot
.
send_message
(
chat_id
=
update
.
effective_chat
.
id
,
text
=
"
This was the old menu
"
)
await
context
.
bot
.
send_photo
(
chat_id
=
update
.
effective_chat
.
id
,
photo
=
file
)
except
googleapiclient
.
errors
.
HttpError
:
pass
await
context
.
bot
.
send_message
(
chat_id
=
update
.
effective_chat
.
id
,
text
=
"
Send the photo of the new menu
"
)
return
self
.
state
.
MENU
...
...
@@ -42,9 +49,7 @@ class Bar(base.Committee_hub_base):
photo_id
=
photo
.
file_id
photo_obj
=
await
context
.
bot
.
getFile
(
photo_id
)
await
photo_obj
.
download_to_drive
(
custom_path
=
utils
.
config
.
ROOT
+
'
/data/temp_files/menu.jpg
'
)
bx_utils
.
drive
bx_utils
.
db
.
extra_committee_info
(
self
.
name
,
"
menu_id
"
,
photo_id
)
self
.
info
=
bx_utils
.
db
.
get_committee_info
(
self
.
name
)
bx_utils
.
drive
.
upload_image_to_committee
(
self
.
name
,
utils
.
config
.
ROOT
+
'
/data/temp_files/menu.jpg
'
)
await
context
.
bot
.
send_message
(
chat_id
=
update
.
effective_chat
.
id
,
text
=
"
Photo received
"
)
return
self
.
state
.
HUB
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment