Skip to content

Instantly share code, notes, and snippets.

@nixmaniack
Created February 14, 2012 15:51
Show Gist options
  • Save nixmaniack/1827704 to your computer and use it in GitHub Desktop.
Save nixmaniack/1827704 to your computer and use it in GitHub Desktop.
Dictionary Bot for XChat (Plugin)
1 #!/usr/bin/env python
2
3 __module_name__ = "DictBot"
4 __module_version__ = "0.1"
5 __module_description__ = "DictBot by Muneeb"
6
7 import xchat
8 import os
9
10
11 print "\0034",__module_name__, __module_version__,"has been loaded\003"
12
13 def getDefinition(word, word_eol, userdata):
14 if word[0] == 'define':
15 cmd = 'dict %s' % (word[1])
16 fi, fo, fe = os.popen3(cmd)
17 for i in fo.readlines():
18 print i,
19
20 return xchat.EAT_ALL
21
22 xchat.hook_command('define', getDefinition, help="Usage: /define word")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment