<commit_before>'''
    Title: Basic IRC bot
    Author: <NAME>
    Creation date: 23:11 28/12/2015 (GMT-3)
    Last edit: 16:14 29/12/2015 (GMT-3)
    Version: 1.0

    Description:
        This is a simple IRC bot made to work whenever the normal bot collapses
    also to perform other sort of stuff such as a personal archive for me cause
    I really never set that up.

    Bugs list: <<Might get moved to another file, idk>> <<Move to git now>>
        <R> 01: Will stop sending a message at a space isntead of at a \n
        <R>02: The dice doesn't get the correct xdy values, hash doesn't work.
'''


import socket
import sys
import random

def getCommand(text):
    '''
        Paramenters:
            text: String. Raw entry right out of the IRC protocol.

        Returns the command sent, which is the following:
            "!command <extra>"
    '''
    parts = text.split(":")
    return parts[len(parts)-1]

def makeDeck():
    '''
        Returns a deck array containing the cards located in the file "deck"
    '''
    deckFile = open("deck", "r")
    baseDeck = deckFile.readlines()
    for index in range(0, len(baseDeck)):
        baseDeck[index] = baseDeck[index][:-1]
    return baseDeck

server = "irc.esper.net"
channel = "#RPGStuck"
botnick = "KaiserBot"

user = "USER "+ botnick +" "+ botnick +" "+ botnick +" :This is the KaiserBot!\n"
nick = "NICK "+ botnick +"\n"
join = "JOIN "+ channel +"\n"

irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("connecting to:"+server)
irc.connect((server, 6667))
irc.send(user.encode("utf-8"))
irc.send(nick.encode("utf-8"))
irc.send("PRIVMSG nickserv :iNOOPE\r\n".encode("utf-8"))

while 1:
    text=irc.recv(2040)
    text = text.decode("utf-8").upper()
    print(text)

    if text.find("End of /MOTD command.".upper()) != -1:
        irc.send(join.encode("utf-8"))      #Used to join the channel, this is specific to
                                            #esper, stupid motd...

    if text.find('PING') != -1:<commit_msg>Updated deck loader to use different decks.<commit_after>'''
    Title: Basic IRC bot
    Author: <NAME>
    Creation date: 23:11 28/12/2015 (GMT-3)
    Last edit: 16:14 29/12/2015 (GMT-3)
    Version: 1.0

    Description:
        This is a simple IRC bot made to work whenever the normal bot collapses
    also to perform other sort of stuff such as a personal archive for me cause
    I really never set that up.

    Bugs list: <<Might get moved to another file, idk>> <<Move to git now>>
        <R> 01: Will stop sending a message at a space isntead of at a \n
        <R>02: The dice doesn't get the correct xdy values, hash doesn't work.
'''


import socket
import sys
import random

def getCommand(text):
    '''
        Paramenters:
            text: String. Raw entry right out of the IRC protocol.

        Returns the command sent, which is the following:
            "!command <extra>"
    '''
    parts = text.split(":")
    return parts[len(parts)-1]

def makeDeck(deck):
    '''
        Paramenters:
            deck: file with the cards saved as a line each.
        
        Returns a deck array containing the cards located in the file deck.
    '''
    deckFile = open(deck, "r")
    baseDeck = deckFile.readlines()
    for index in range(0, len(baseDeck)):
        baseDeck[index] = baseDeck[index][:-1]
    return baseDeck

server = "irc.esper.net"
channel = "#RPGStuck"
botnick = "KaiserBot"

user = "USER "+ botnick +" "+ botnick +" "+ botnick +" :This is the KaiserBot!\n"
nick = "NICK "+ botnick +"\n"
join = "JOIN "+ channel +"\n"

irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("connecting to:"+server)
irc.connect((server, 6667))
irc.send(user.encode("utf-8"))
irc.send(nick.encode("utf-8"))
irc.send("PRIVMSG nickserv :iNOOPE\r\n".encode("utf-8"))

while 1:
    text=irc.recv(2040)
    text = text.decode("utf-8").upper()
    print(text)

    if text.find("End of /MOTD command.".upper()) != -1:
        irc.send(join.encode("utf-8"))      #Used to join the channel, this is specific to
                                            #esper, stupid motd...

    if text.find('PING') != -1:
{'fraction_non_alphanumeric': 0.13299541395124306, 'fraction_numerical': 0.024619840695148443, 'mean_word_length': 2.641476274165202, 'pattern_counts': {'":': 2, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '383756', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1327, 'n_words': 454}