Skip to content
This repository was archived by the owner on Jun 9, 2019. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 11 additions & 31 deletions Arnavion-scripts/autoinvite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,17 @@

__module_name__ = 'AutoInvite'
__module_version__ = '1.0'
__module_description__ = ''
__module_description__ = 'Automatically invites if a channel is invite only and accepts any invites'

hexchat.prnt('AutoInvite script loaded')

def autoinvite_callback(word, word_eol, user_data):
channel = word[0]

def invited_callback(word, word_eol, user_data):
invited_result = hexchat.EAT_NONE

if word[0] == channel:
hexchat.unhook(invited_hook)
hexchat.unhook(denied_hook)
invited_result = hexchat.EAT_HEXCHAT
hexchat.command('join {0}'.format(channel))

return invited_result

invited_hook = hexchat.hook_print('Invited', invited_callback)

def denied_callback(word, word_eol, user_data):
if word[1] == 'Permission denied.':
hexchat.unhook(invited_hook)
hexchat.unhook(denied_hook)

return hexchat.EAT_NONE

denied_hook = hexchat.hook_print('Notice', denied_callback)

hexchat.command('msg ChanServ invite {0}'.format(channel))

def invite_callback(word, word_eol, user_data):
hexchat.command('msg ChanServ invite {0}'.format(word[0]))
return hexchat.EAT_HEXCHAT

hexchat.hook_print('Invite', autoinvite_callback)
def invited_callback(word, word_eol, user_data):
hexchat.command('join {0}'.format(word[0]))
return hexchat.EAT_NONE

hexchat.hook_print('Invite', invite_callback)
hexchat.hook_print('Invited', invited_callback)

hexchat.prnt('AutoInvite script loaded')