Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import codecs
  2. import json
  3. import os
  4. import random
  5. import asyncio
  6. import re
  7.  
  8. from cloudbot import hook
  9. from cloudbot.util import textgen
  10. from cloudbot.util import colors
  11.  
  12.  
  13. @hook.on_start()
  14. def load_responses(bot):
  15. path = os.path.join(bot.data_dir, "decoys.txt")
  16. global responses
  17. with codecs.open(path, encoding="utf-8") as f:
  18. responses = [line.strip() for line in
  19. f.readlines() if not line.startswith("//")]
  20.  
  21.  
  22. @asyncio.coroutine
  23. @hook.command("decoy")
  24. def decoy(chan, conn):
  25. """it does something"""
  26. meh = random.choice(responses)
  27. message = colors.parse("".format(meh))
  28.  
  29. conn.message(chan, message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement