<commit_before>package main

import (
    "fmt"
    "github.com/thoj/go-ircevent"
)

var roomName = "#botsex"
var myNick = "gonbot"
var con *irc.Connection
var goTime = false

func main() {
    //Make a connection, "nick", "user"
    con = irc.IRC("gonbot", "gonbot")
    err := con.Connect("skynet.csh.rit.edu:6667")
    if err != nil {
        fmt.Println("Failed connecting")
        return
    }

    con.AddCallback("001", connectionMade)
    con.AddCallback("JOIN", joinedChannel)
    con.AddCallback("PRIVMSG", newPrivmsg)
    con.AddCallback("MODE", modeChanged)
    con.AddCallback("CTCP_ACTION", actionReceived)
    con.Loop()
}

func connectionMade(e *irc.Event) {
    con.Join(roomName)
}

func joinedChannel(e *irc.Event) {
    con.Privmsg(roomName, "Sup bitches?")
}

func newPrivmsg(e *irc.Event) {
    msg := e.Message()
    if len(msg) > len(myNick) && msg[0:len(myNick)] == myNick {
        con.Privmsg(roomName, msg[len(myNick)+2:])
    }
}

func modeChanged(e *irc.Event) {
    //Check if we got op
    if len(e.Arguments) >= 3 && e.Arguments[0] == roomName {
        //If modes were given,
        if e.Arguments[1][0] == '+' {
            gotOp := false
            gotAdmin := false
            wereInTheList := false
            //Check if op was given out
            for _, letter := range e.Arguments[1][1:] {
                if letter == 'o' {
                    gotOp = true
                }
            }
            //Check if admin was given out
            for _, letter := range e.Arguments[1][1:] {
                if letter == 'a' {
                    gotAdmin = true
                }
            }
            //Check if we're in the list
            for _, name := range e.Arguments[2:] {
                if name == myNick {
                    wereInTheList = true
                }
            }
            if gotOp && wereInTheList {
                //We got op, let's take note of this
                con.Privmsg(roomName, "I got op")
            }
            if gotAdmin && wereInTheList {
                //We got admin, let's take note of this
                con.Privmsg(roomName, "I got admin")
            }
        }
    }
}

func actionReceived(e *irc.Event) {
    fmt.Println(e.Message())
}
<commit_msg>Will now properly assume control of a channel.<commit_after>package ceti-eel

import (
    "fmt"
    "strings"
    "github.com/thoj/go-ircevent"
)

var roomName = "#botsex"
var myNick = "gonbot"
var con *irc.Connection
var goTime = false
var admin = false
var op = false

func main() {
    //Make a connection, "nick", "user"
    con = irc.IRC("gonbot", "gonbot")
    err := con.Connect("skynet.csh.rit.edu:6667")
    if err != nil {
        fmt.Println("Failed connecting")
        return
    }

    con.AddCallback("001", connectionMade)
    con.AddCallback("PRIVMSG", newPrivmsg)
    con.AddCallback("MODE", modeChanged)
    con.AddCallback("353", gotNames)
    con.Loop()
}

//Send a message to the server requesting the list of everyone in the channel
func checkNames() {
    con.SendRaw("NAMES " + roomName)
}

func connectionMade(e *irc.Event) {
    con.Join(roomName)
}

//Parrot back a message if it begins with <name>: 
func newPrivmsg(e *irc.Event) {
    msg := e.Message()
    if len(msg) > len(myNick) && msg[0:len(myNick)] == myNick {
        con.Privmsg(roomName, msg[len(myNick)+2:])
    }
}

func modeChanged(e *irc.Event) {
    //Check if we got op
    if len(e.Arguments) >= 3 && e.Arguments[0] == roomName {
        adding := true
        gotOp := false
        gotAdmin := false
        wereInTheList := false
        //Note if modes are being added or removed
        if e.Arguments[1][0] == '-' {
            adding = false
        }
        //Check if op was changed
        for _, letter := range e.Arguments[1][1:] {
            if letter == 'o' {
                gotOp = true
            }
        }
        //Check if admin was changed
        for _, letter := range e.Arguments[1][1:] {
            if letter == 'a' {
                gotAdmin = true
            }
        }
        //Check if we're in the list
        for _, name := range e.Arguments[2:] {
            if name == myNick {
                wereInTheList = true
            }
        }
        if gotOp && wereInTheList {
            //We got op, let's take note of this
            op = adding
        }
        if gotAdmin && wereInTheList {
            //We got admin, let's take note of this
            admin = adding
        }
        checkNames()
    }
}

func gotNames(e *irc.Event) {
    names := strings.Fields(e.Message())
    //If we're admin and it's not go time, then let's make it go time
    if admin && !goTime {
        fmt.Println("Go time!")
        goTime = true
    } else if op {
        //Else if we're op and there's not an admin, and it's not go time, 
        //then let's make it go time
        theresAnAdmin := false
        for _, name := range names {
            if name[0] == '!' {
                theresAnAdmin = true
            }
        }
        if !theresAnAdmin && !goTime {
            fmt.Println("Go time!")
            goTime = true
        } else if goTime {
            //If there's an admin and we have op and it's go time, 
            //it's not actually go time
            goTime = false
        }
    } else {
        //We're not op or admin. It's not go time.
        goTime = false
    }
    if goTime {
        takeControl(names)
    }
}

//De-op and de-admin everyone
func takeControl(names []string) {
    for _, name := range names {
        if name[1:] != myNick  && name[1:] != "dgonyeo" {
            if name[0] == '!' {
                con.SendRaw("MODE " + roomName + " -ao " + name[1:])
            }
            if name[0] == '@' {
                con.SendRaw("MODE " + roomName + " -o " + name[1:])
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.12865197334700154, 'fraction_numerical': 0.007859217495301555, 'mean_word_length': 1.6440831074977416, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2163723', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1808, 'n_words': 507}