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
585c1ba8
Commit
585c1ba8
authored
Jun 06, 2017
by
Pietro Albini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow only chat admins to use the "now" action
parent
44db94cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
uitsmmbot/bot.py
uitsmmbot/bot.py
+3
-0
uitsmmbot/post.py
uitsmmbot/post.py
+10
-0
No files found.
uitsmmbot/bot.py
View file @
585c1ba8
...
...
@@ -37,6 +37,9 @@ class CallbackQuery(botogram.objects.base.BaseObject):
"data"
:
str
,
"game_short_name"
:
str
,
}
replace_keys
=
{
"from"
:
"sender"
,
}
botogram
.
Update
.
optional
[
"callback_query"
]
=
CallbackQuery
...
...
uitsmmbot/post.py
View file @
585c1ba8
...
...
@@ -161,6 +161,16 @@ class PostComponent(botogram.Component):
query
=
update
.
callback_query
action
,
data
=
query
.
data
.
split
(
":"
,
1
)
if
action
==
"now"
:
if
query
.
sender
not
in
query
.
message
.
chat
.
admins
:
bot
.
api
.
call
(
"answerCallbackQuery"
,
{
"callback_query_id"
:
query
.
id
,
"text"
:
"Devi essere admin per poter eseguire questa "
"azione."
,
"show_alert"
:
True
,
})
return
if
action
==
"toggle"
:
message
,
social
=
data
.
split
(
":"
)
message
=
int
(
message
)
...
...
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