Send information messages about QS states
(job, action, interval, nap)
| 224 | |
| 225 | |
| 226 | def send_message(job, action, interval, nap): |
| 227 | """Send information messages about QS states""" |
| 228 | job = job.replace("_", " ") |
| 229 | |
| 230 | if action == "sleep": |
| 231 | if interval == "hourly": |
| 232 | quick_drink = random.choice( |
| 233 | [ |
| 234 | "lemon tea", |
| 235 | "black tea", |
| 236 | "green tea", |
| 237 | "grey tea", |
| 238 | "coffee mexicano", |
| 239 | "coffee colombia", |
| 240 | "fruit juice", |
| 241 | ] |
| 242 | ) |
| 243 | message = ( |
| 244 | "Quota Supervisor: hourly {} reached quotient!" |
| 245 | "\t~going to sleep {} minutes long\n\ttake a {} " |
| 246 | "break? :>".format(job, "%.0f" % (nap / 60), quick_drink) |
| 247 | ) |
| 248 | |
| 249 | elif interval == "daily": |
| 250 | message = ( |
| 251 | "Quota Supervisor: daily {} reached quotient!" |
| 252 | "\t~going to sleep {} hours long\n" |
| 253 | "\ttime for InstaPy to take a big good nap :-)".format( |
| 254 | job, "%.1f" % (nap / 60 / 60) |
| 255 | ) |
| 256 | ) |
| 257 | |
| 258 | elif action == "exit": |
| 259 | message = ( |
| 260 | "Quota Supervisor: {} {} reached quotient!" |
| 261 | "\t~exiting\n\tfor *non-stop botting use `sleep_after` " |
| 262 | "parameter on the go! ;)".format(interval, job) |
| 263 | ) |
| 264 | |
| 265 | elif action == "jump": |
| 266 | message = ( |
| 267 | "Quota Supervisor: jumped a {} out of {} quotient!\t~be fair " |
| 268 | "with numbers :]\n".format(job[:-1], interval) |
| 269 | ) |
| 270 | |
| 271 | logger.info(message) |
| 272 | |
| 273 | |
| 274 | def toast_notification(notify, alert, job, interval): |