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
41e5bc57
Commit
41e5bc57
authored
Jan 05, 2017
by
Pietro Albini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly handle deleted posts
parent
3518b7df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
uitsmmbot/post.py
uitsmmbot/post.py
+9
-3
No files found.
uitsmmbot/post.py
View file @
41e5bc57
...
@@ -79,10 +79,16 @@ class PostComponent(botogram.Component):
...
@@ -79,10 +79,16 @@ class PostComponent(botogram.Component):
)]
)]
for
post_id
in
to_telegram
:
for
post_id
in
to_telegram
:
data
=
self
.
buffer
.
request
(
"get"
,
"updates/%s.json"
%
post_id
)
data
=
self
.
buffer
.
request
(
"get"
,
"updates/%s.json"
%
post_id
)
# For example if the update was deleted
if
"error"
not
in
data
:
if
data
[
"status"
]
!=
"sent"
:
if
data
[
"status"
]
!=
"sent"
:
continue
continue
bot
.
chat
(
channel
).
send
(
data
[
"text_formatted"
])
bot
.
chat
(
channel
).
send
(
data
[
"text_formatted"
])
# This will delete the update if the message was sent to the
# channel or there was an error with it
self
.
db
.
update
(
self
.
db
.
update
(
"DELETE FROM to_telegram WHERE post_id = ?;"
,
post_id
"DELETE FROM to_telegram WHERE post_id = ?;"
,
post_id
)
)
...
...
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