Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
U
UserLixo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
Amano Team
UserLixo
Compare Revisions
f998925b85c70c31f70b6ff8beedcf8823c851d7...9a582c2d76656a1cb8159db38a9d3e55835640c2
Source
9a582c2d76656a1cb8159db38a9d3e55835640c2
Select Git revision
...
Target
f998925b85c70c31f70b6ff8beedcf8823c851d7
Select Git revision
Compare
Commits (2)
Update print.py
· f9321521
OLixao
authored
Oct 22, 2019
f9321521
add ctime
· 9a582c2d
OLixao
authored
Oct 22, 2019
9a582c2d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
plugins/print.py
plugins/print.py
+25
-11
No files found.
plugins/print.py
View file @
9a582c2d
...
...
@@ -7,6 +7,20 @@ import os
@
Client
.
on_message
(
Filters
.
command
(
"print"
,
prefixes
=
[
'!'
,
'/'
]))
def
print
(
client
,
message
):
url
=
message
.
text
.
split
(
' '
,
1
)[
1
]
if
'fullpage '
in
url
:
ctime
=
time
.
time
()
try
:
if
not
re
.
match
(
r'^[a-z]+://'
,
url
):
url
=
'http://'
+
url
r
=
requests
.
post
(
"https://api.thumbnail.ws/api/ab45a17344aa033247137cf2d457fc39ee4e7e16a464/thumbnail/get"
,
params
=
dict
(
url
=
url
.
replace
(
'fullpage '
,
''
),
width
=
1280
,
refresh
=
'true'
,
fullpage
=
'true'
))
with
open
(
f
'{ctime}.png'
,
'wb'
)
as
f
:
f
.
write
(
r
.
content
)
client
.
send_photo
(
message
.
chat
.
id
,
f
"{ctime}.png"
)
except
Exception
as
e
:
message
.
reply
(
f
'There was an error sending print, please try again later.
\n
Description of the error:{e}'
)
os
.
remove
(
f
'{ctime}.png'
)
ctime
=
time
.
time
()
else
:
ctime
=
time
.
time
()
try
:
if
not
re
.
match
(
r'^[a-z]+://'
,
url
):
...
...