This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Simple interface to urbandictionary.com | |
# | |
# Author: Roman Bogorodskiy <bogorodskiy@gmail.com> | |
import sys | |
from urllib.request import urlopen | |
from urllib.parse import quote as urlquote | |
from html.parser import HTMLParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import goslate | |
import asyncio | |
gs = goslate.Goslate() | |
def _initialise(command): | |
command.register_handler(_handle_message) | |
@asyncio.coroutine | |
def _handle_message(bot, event, command): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
searchfor = "some_string" | |
theconvid = None | |
if bot.memory.exists(["conv_data"]): # verify key exists | |
conv_list = bot.memory.get_by_path(["conv_data"]) # grab all conversations | |
for conv_id in conv_list: | |
conv_data = conv_list[conv_id] | |
if "shortname" in conv_data: # verify subkey exists | |
if searchfor in conv_data["shortname"]: # do text search | |
theconvid = conv_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// bot.conversation_memory_set(<event.conv_id>, <keyname>) | |
// bot.conversation_memory_get(<event.conv_id>, <keyname>) | |
// <event.conv_id> can be CONVERSATION_ID_1, CONVERSATION_ID_2 etc | |
// <keyname> would be "somekey1", "somekey2", etc | |
// bot.memory.exists(["conv_data", "CONVERSATION_ID_1", "somekey1"]) returns true | |
// bot.memory.exists(["conv_data", "CONVERSATION_ID_1", "somekey5"]) returns false | |
"conv_data": { | |
"CONVERSATION_ID_1": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true | |
do | |
# blocking call until SIGINT received or /bot quit | |
python3 -u /<username>/bot/hangupsbot/hangupsbot.py -d > /<username>/bot-stdout.log | |
# sleep 3 | |
done |
NewerOlder