mirror of
https://git.wownero.com/wownero/tippero.git
synced 2024-08-15 00:33:14 +00:00
Add an IRC module with join/part commands
This commit is contained in:
parent
27117ae53e
commit
8d115438a3
1 changed files with 58 additions and 0 deletions
58
tipbot/modules/irc.py
Normal file
58
tipbot/modules/irc.py
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/python
|
||||||
|
#
|
||||||
|
# Cryptonote tipbot - IRC commands
|
||||||
|
# Copyright 2014 moneromooo
|
||||||
|
#
|
||||||
|
# The Cryptonote tipbot is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License as published
|
||||||
|
# by the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import string
|
||||||
|
import tipbot.config as config
|
||||||
|
from tipbot.log import log_error, log_warn, log_info, log_log
|
||||||
|
from tipbot.utils import *
|
||||||
|
from tipbot.irc import *
|
||||||
|
from tipbot.command_manager import *
|
||||||
|
|
||||||
|
def JoinChannel(nick,chan,cmd):
|
||||||
|
sendto=GetSendTo(nick,chan)
|
||||||
|
jchan = GetParam(cmd,1)
|
||||||
|
if not jchan:
|
||||||
|
SendTo(sendto,'Usage: join <channel>')
|
||||||
|
rerurn
|
||||||
|
if jchan[0] != '#':
|
||||||
|
SendTo(sendto,'Channel name must start with #')
|
||||||
|
return
|
||||||
|
Join(jchan)
|
||||||
|
|
||||||
|
def PartChannel(nick,chan,cmd):
|
||||||
|
sendto=GetSendTo(nick,chan)
|
||||||
|
pchan = GetParam(cmd,1)
|
||||||
|
if pchan:
|
||||||
|
if pchan[0] != '#':
|
||||||
|
SendTo(sendto,'Channel name must start with #')
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
pchan = chan
|
||||||
|
Part(pchan)
|
||||||
|
|
||||||
|
|
||||||
|
RegisterCommand({
|
||||||
|
'module': __name__,
|
||||||
|
'name': 'join',
|
||||||
|
'parms': '<channel>',
|
||||||
|
'function': JoinChannel,
|
||||||
|
'admin': True,
|
||||||
|
'help': "Makes %s join a channel" % (config.tipbot_name)
|
||||||
|
})
|
||||||
|
RegisterCommand({
|
||||||
|
'module': __name__,
|
||||||
|
'name': 'part',
|
||||||
|
'parms': '<channel>',
|
||||||
|
'function': PartChannel,
|
||||||
|
'admin': True,
|
||||||
|
'help': "Makes %s part from a channel" % (config.tipbot_name)
|
||||||
|
})
|
Loading…
Reference in a new issue