Skip to content

Instantly share code, notes, and snippets.

@jsenin
Created March 25, 2015 13:42
Show Gist options
  • Save jsenin/3e2b00f1312582d6d454 to your computer and use it in GitHub Desktop.
Save jsenin/3e2b00f1312582d6d454 to your computer and use it in GitHub Desktop.
xchat script to greeting on channel joining
__module_name__ = 'Saluda cuando entras'
__module_version__ = '0.1'
__module_description__ = 'Saluda en un canal cuando entras'
__module_author__ = 'nterprais@gmail.com'
import xchat
c = '\x0312'
def on_join(word, word_eol, userdata):
#Add the channels you want to greet people in here, inbetween the ' marks. Example: channels = ['#Jake','#Example']
#You can add as many channels that you'd like by adding a comma then another set of quotes
channels = ['','','']
nick, channel = word[0], word[1]
destination = xchat.get_context()
if channel in channels:
destination.command('say Hello %s, welcome to %s!' % (nick, channel))
else:
return
def on_access(word, word_eol, userdata):
triggernick, triggercommand, triggerchannel = word
me = xchat.get_info('nick')
nick = triggernick.partition('!')[0][1:]
greet = 'Hello everybody'
if xchat.nickcmp(nick, me ) == 0:
destination = xchat.get_context()
destination.command('say %s ' %( greet ))
# Don't eat this event, let other plugins and xchat see it too
return xchat.EAT_NONE
def onUnload(userdata):
xchat.prnt('%s%s, version: %s, has been unloaded.' % (c, __module_name__, __module_version__))
# bind hooks
xchat.hook_server('JOIN',on_access)
xchat.hook_unload(onUnload)
# load finished
print('%s%s, version: %s, has been loaded.' % (c, __module_name__, __module_version__))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment