from ameliabot.core import connect
##############################################################################
import sys

# You can place your plugins at ~/.amelia # To use them inside this file just do.
# import plugin_package_name or import plugin_name

from os.path import expanduser, join
sys.path.append(join(expanduser('~'), '.amelia'))
##############################################################################
# The plugin imports.

# from ameliabot.plugins import join
# from ameliabot.plugins import spam
# from ameliabot.plugins import advisor

from ameliabot.plugins import logmsg
from ameliabot.plugins import quick_search
from ameliabot.plugins import tell
from ameliabot.plugins import troll
from ameliabot.plugins import calc
from ameliabot.plugins import url_title
from ameliabot.plugins import codebox
from ameliabot.plugins import codenv
from ameliabot.plugins import note
from ameliabot.plugins import pipe
from ameliabot.plugins import seen
from ameliabot.plugins import keep_alive
from ameliabot.plugins import ircadm
from ameliabot.plugins import help
from ameliabot.plugins.quote import quote
from ameliabot.plugins import booklist
from ameliabot.plugins import dcc_send
from ameliabot.plugins import dcc_get
from ameliabot.plugins import translator
from ameliabot.plugins import polyglot
from ameliabot.plugins import lichess
from ameliabot.plugins import antispam


##############################################################################

# Define the set of plugins that will be available.
# You can define a different scheme for each server.

def PLUGIN_SCHEME(server):
    """
    These are all ameliabot built in plugins.
    You can have more than one scheme for irc networks.

    Just implement new PLUGIN_SCHEME functions then pass it as argument
    to connect function.
    """

    # join.install(server)
    # spam.install(server, db=['Ameliabot rocks', 'Use ameliabot'], excpt=['#freenode'])
    # advisor.install(server, questions='questions', suggestions='suggestions')
    # logmsg.LogMsg(server, '/home/tau')

    quick_search.install(server)
    tell.install(server)
    troll.install(server, 'aehiou', 4, 16)
    calc.install(server, '4WERXG-VAGETKREGX')
    url_title.install(server)
    codebox.install(server)
    codenv.install(server, 'python', '=py', '=end')
    codenv.install(server, 'c', '=c', '=end')
    codenv.install(server, 'c++', '=c++', '=end')
    codenv.install(server, 'd', '=d', '=end')
    codenv.install(server, 'lua', '=lua', '=end')
    codenv.install(server, 'ocaml', '=ocaml', '=end')
    codenv.install(server, 'php', '=php', '=end')
    codenv.install(server, 'perl', '=perl', '=end')
    codenv.install(server, 'ruby', '=ruby', '=end')
    codenv.install(server, 'scheme', '=scheme', '=end')
    codenv.install(server, 'tcl', '=tcl', '=end')

    note.install(server)
    pipe.install(server)
    seen.install(server)
    keep_alive.install(server)
    ircadm.install(server)
    help.install(server)
    quote.install(server)
    translator.install(server)
    polyglot.install(server)
    lichess.install(server)

    # The n_lines arg determins how many lines should be allowed in n_secs.
    # The cmd is the command to be executed if the rate is overriden.
    # For akicking:
    # cmd = 'chanserv akick {chan} add *!*@{host} : get out!
    antispam.install(server, n_lines=5, n_secs=5,  cmd='kick {chan} {nick} :Amelia rocks!')

    # Used to share files, set the correct folder where the files would be in.
    # booklist.BookList(server, '/home/tau/ircshare')
    # dcc_send.install(server, '/home/tau/ircshare')
    # dcc_get.install(server, '/home/tau/ircshare')

##############################################################################
# The channel where the bot will stay when at freenode.
FREENODE_CHANNEL_SCHEME = ['#ameliabot', '#vy']

##############################################################################
# It tells the bot to connect to freenode then use the plugins
# that we have defined in PLUGIN_SCHEME handle.
# It will join the channels #ameliabot, #vy and ##calculus at irc.freenode.org
server = connect('irc.freenode.org', 6667, 
                 'ameliabot',                                 
                 'untwistedbot euler euler :Ameliabot',       
                 'PRIVMSG nickserv :IDENTIFY nick_passwd',    
                 'bot_passwd', FREENODE_CHANNEL_SCHEME, PLUGIN_SCHEME)

##############################################################################

# It is possible to have more than one connection per bot process. 
# For such just calls connect as many times as needed.
# VIRTUALIFE_CHANNEL_SCHEME = ['#oldcine']
##############################################################################

# server = connect('irc.virtualife.com.br', 6667, 
                 # 'ameliabot',                                 
                 # 'untwistedbot euler euler :Ameliabot',       
                 # 'NickServ IDENTIFY nick_passwd',    
                 # 'bot_passwd', VIRTUALIFE_CHANNEL_SCHEME, PLUGIN_SCHEME)












