forked from foxo/printer_bot
Compare commits
5 Commits
cd4ac2d3aa
...
a6c4de8e2c
Author | SHA1 | Date |
---|---|---|
Eloy | a6c4de8e2c | |
Ed | fe4d8a77d3 | |
Ed | a3eca6e7d1 | |
Ed | 3d195e8e16 | |
Foxo | 19563e734f |
|
@ -160,4 +160,5 @@ cython_debug/
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
config.py
|
config.py
|
||||||
bot.session
|
*.session
|
||||||
|
*.session-*
|
||||||
|
|
|
@ -10,6 +10,7 @@ Currently, you can set any command to print your sticker (by default brother_ql
|
||||||
* [MCH2022](https://mch2022.org)
|
* [MCH2022](https://mch2022.org)
|
||||||
* [BornHack (2023)](https://bornhack.dk/bornhack-2023)
|
* [BornHack (2023)](https://bornhack.dk/bornhack-2023)
|
||||||
* [Chaos Communication Camp (2023)](https://events.ccc.de/camp/2023/infos/index.html)
|
* [Chaos Communication Camp (2023)](https://events.ccc.de/camp/2023/infos/index.html)
|
||||||
|
* [37th Chaos Communication Congress (2023)](https://events.ccc.de/congress/2023/infos/startpage.html)
|
||||||
|
|
||||||
**Running it at your con? Add it with a pull request! :D**
|
**Running it at your con? Add it with a pull request! :D**
|
||||||
|
|
||||||
|
|
5
bot.py
5
bot.py
|
@ -77,7 +77,8 @@ async def handler(ev):
|
||||||
|
|
||||||
# Limit stickers ratio (so people don't print incredibly long stickers)
|
# Limit stickers ratio (so people don't print incredibly long stickers)
|
||||||
if img.size[1]/img.size[0] > MAX_ASPECT_RATIO:
|
if img.size[1]/img.size[0] > MAX_ASPECT_RATIO:
|
||||||
return ev.respond(RATIO_ERR_MSG)
|
await ev.respond(RATIO_ERR_MSG)
|
||||||
|
return
|
||||||
|
|
||||||
# Remove transparency
|
# Remove transparency
|
||||||
if img.mode == 'RGBA':
|
if img.mode == 'RGBA':
|
||||||
|
@ -95,6 +96,8 @@ async def handler(ev):
|
||||||
|
|
||||||
img.save(IMAGE_PATH, 'PNG')
|
img.save(IMAGE_PATH, 'PNG')
|
||||||
|
|
||||||
|
await client.forward_messages(ADMIN_ID, ev.message)
|
||||||
|
|
||||||
status_code = system(PRINT_COMMAND)
|
status_code = system(PRINT_COMMAND)
|
||||||
if status_code == 0:
|
if status_code == 0:
|
||||||
print_log[ev.peer_id.user_id] = time()
|
print_log[ev.peer_id.user_id] = time()
|
||||||
|
|
Loading…
Reference in New Issue