Sinisterly
REAPeR API - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/forumdisplay.php?fid=69)
+--- Forum: Python (https://sinister.ly/forumdisplay.php?fid=76)
+--- Thread: REAPeR API (/showthread.php?tid=23339)



REAPeR API - Stocking - 01-21-2014

TL;DR: Read it.

For a while I've had the idea for Chatango bots to shorten Python input.

Example without reAPIr.py:
Code:
if used_prefix and cmd == "stuff":
    room.message("Stuff.")

elif message.body.startswith("$stuff"):
    room.message("Stuff.")

With reAPIr.py:
Code:
if pfx&cmd == "stuff":
    rm("Stuff.")

elif msw("$stuff"):
    rm("Stuff.")

This isn't really an API, but here's the code for it anyways.

reAPIr.py
Code:
import ch

pfx& = used_prefix and
pfx&cmd = used_prefix and cmd
msw = message.body.startswith
rm = room.message

Pretty basic at the time but it'll get better. And more effective.

The usage for it is simple. A faster more efficient way to utilize Chatango bots with ch.py.
It shortens the length of code being typed to be able to finish projects faster.