Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
uitsmmbot
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Socialmedia
uitsmmbot
Commits
b9afb7a5
Commit
b9afb7a5
authored
Jun 06, 2017
by
Pietro Albini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Authenticate incoming callback queries
parent
8dd30d91
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
uitsmmbot/bot.py
uitsmmbot/bot.py
+1
-1
uitsmmbot/post.py
uitsmmbot/post.py
+5
-1
No files found.
uitsmmbot/bot.py
View file @
b9afb7a5
...
...
@@ -56,7 +56,7 @@ def create_bot(token, db_path):
auth
=
AuthComponent
(
db
)
settings
=
SettingsComponent
(
db
,
buffer
)
post
=
PostComponent
(
db
,
buffer
)
post
=
PostComponent
(
db
,
buffer
,
auth
)
bot
.
use
(
auth
)
bot
.
use
(
settings
)
...
...
uitsmmbot/post.py
View file @
b9afb7a5
...
...
@@ -43,9 +43,10 @@ def inline_keyboard(buttons):
class
PostComponent
(
botogram
.
Component
):
component_name
=
"post"
def
__init__
(
self
,
db
,
buffer
):
def
__init__
(
self
,
db
,
buffer
,
auth
):
self
.
db
=
db
self
.
buffer
=
buffer
self
.
auth
=
auth
self
.
add_timer
(
2
*
60
,
self
.
cleanup
)
self
.
add_timer
(
5
*
60
,
self
.
post_to_telegram
)
...
...
@@ -161,6 +162,9 @@ class PostComponent(botogram.Component):
query
=
update
.
callback_query
action
,
data
=
query
.
data
.
split
(
":"
,
1
)
# Authenticate the request
self
.
auth
.
check
(
query
.
message
.
chat
)
if
action
==
"now"
:
if
query
.
sender
not
in
query
.
message
.
chat
.
admins
:
bot
.
api
.
call
(
"answerCallbackQuery"
,
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment