<commit_before>public IRC_OnConnect(botid, ip[], port)
{
    printf("*** IRC_OnConnect: Bot ID %d connected to %s:%d", botid, ip, port);
     
	IRC_SendRaw(botid, "PRIVMSG NickServ :IDENTIFY "#IRC_BOT_PASS);

	if (botid == bots[0] || botid == bots[1])
	{
	    printf("*** Added bot %d to Group gGroupID", botid);
	    IRC_AddToGroup(gGroupID, botid);
	    IRC_JoinChannel(botid, IRC_CHAN_MAIN);
	}
	else // It's the IRC Admin Bot
	{
	    printf("*** Added bot %d to Group gGroupAdminID", botid);
	    IRC_AddToGroup(gGroupAdminID, botid);
	    IRC_JoinChannel(botid, IRC_CHAN_ADMIN);
	}
	
	return 1;
}

public IRC_OnDisconnect(botid, ip[], port, reason[])
{
	printf("*** IRC_OnDisconnect: Bot ID %d disconnected from %s:%d (%s)", botid, ip, port, reason);

	if (botid == bots[0] || botid == bots[1])
	{
	    IRC_RemoveFromGroup(gGroupID, botid);
	}
	else // It's the IRC Admin Bot
	{
	    IRC_RemoveFromGroup(gGroupAdminID, botid);
	}
	
	return 1;
}

public IRC_OnConnectAttempt(botid, ip[], port)
{
	printf("*** IRC_OnConnectAttempt: Bot ID %d attempting to connect to %s:%d...", botid, ip, port);

	return 1;
}

public IRC_OnConnectAttemptFail(botid, ip[], port, reason[])
{
    printf("*** IRC_OnConnectAttemptFail: Bot ID %d failed to connect to %s:%d (%s)", botid, ip, port, reason);
     
	return 1;
}

public IRC_OnJoinChannel(botid, channel[])
{
    printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s", botid, channel);
    
	return 1;
}

public IRC_OnLeaveChannel(botid, channel[], message[])
{
	printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)", botid, channel, message);

	return 1;
}

public IRC_OnInvitedToChannel(botid, channel[], invitinguser[], invitinghost[])
{
    printf("*** IRC_OnInvitedToChannel: Bot ID %d invited to channel %s by %s (%s)", botid, channel, invitinguser, invitinghost);
     
	return 1;
}

public IRC_OnKickedFromChannel(botid, channel[], oppeduser[], oppedhost[], message[])
{
    printf("*** IRC_OnKickedFromChannel: Bot ID %d kicked by %s (%s) from channel %s (%s)", botid, oppeduser, oppedhost, channel, message);

	return 1;
}

public IRC_OnUserDisconnect(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected (%s)", botid, user, host, message);

	return 1;
}

public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
    printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s", botid, user, host, channel);

	return 1;
}

public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
    printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)", botid, user, host, channel, message);

	return 1;
}

public IRC_OnUserKickedFromChannel(botid, channel[], kickeduser[], oppeduser[], oppedhost[], message[])
{
    printf("*** IRC_OnUserKickedFromChannel (Bot ID %d): User %s kicked by %s (%s) from channel %s (%s)", botid, kickeduser, oppeduser, oppedhost, channel, message);

	return 1;
}

public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
{
    printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his/her nick to %s", botid, oldnick, host, newnick);

	return 1;
}

public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
{
    printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s", botid, user, host, channel, mode);

	return 1;
}

public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
{
    printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s", botid, user, host, channel, topic);

	return 1;
}

public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserSay (Bot ID %d): User %s (%s) sent message to %s: %s", botid, user, host, recipient, message);

	if (botid == bots[0] && strfind(user, IRC_BOT_MAIN2) == -1)
	{
		new File:log, fname[40], day, month, year;
		getdate(year, month, day);
		format(fname, sizeof(fname), "irc_%02d-%02d-%d.log", day, month, year);

		if (!fexist(fname))
		{
			log = fopen(fname, io_write);
		}
		else
		{
			log = fopen(fname, io_append);
		}
		
		if (log)
		{
			new string[256];
			new hour, minute, tmp;
			gettime(hour, minute, tmp);
			format(string, sizeof(string), "[%02d:%02d] <%s> %s\r\n", hour, minute, user, message);
			fwrite(log, string);
			fclose(log);
		}
	}
	return 1;
}

public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);

	return 1;
}

public IRC_OnUserRequestCTCP(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserRequestCTCP (Bot ID %d): User %s (%s) sent CTCP request: %s", botid, user, host, message);
<commit_msg>1: add bot welcome message<commit_after>public IRC_OnConnect(botid, ip[], port)
{
    printf("*** IRC_OnConnect: Bot ID %d connected to %s:%d", botid, ip, port);
     
	IRC_SendRaw(botid, "PRIVMSG NickServ :IDENTIFY "#IRC_BOT_PASS);

	if (botid == bots[0] || botid == bots[1])
	{
	    printf("*** Added bot %d to Group gGroupID", botid);
	    IRC_AddToGroup(gGroupID, botid);
	    IRC_JoinChannel(botid, IRC_CHAN_MAIN);
		
		if (botid == bots[0])
		{
			IRC("Welcome to "#SERVER_STRING);
			IRC("IP: "#SERVER_IP" | Website: "#SERVER_WEBSITE);
			IRC("This channel is logged by "#SERVER_SNAME", review them at "#SERVER_LOGURL);
		}
	}
	else // It's the IRC Admin Bot
	{
	    printf("*** Added bot %d to Group gGroupAdminID", botid);
	    IRC_AddToGroup(gGroupAdminID, botid);
	    IRC_JoinChannel(botid, IRC_CHAN_ADMIN);
	}
	
	return 1;
}

public IRC_OnDisconnect(botid, ip[], port, reason[])
{
	printf("*** IRC_OnDisconnect: Bot ID %d disconnected from %s:%d (%s)", botid, ip, port, reason);

	if (botid == bots[0] || botid == bots[1])
	{
	    IRC_RemoveFromGroup(gGroupID, botid);
	}
	else // It's the IRC Admin Bot
	{
	    IRC_RemoveFromGroup(gGroupAdminID, botid);
	}
	
	return 1;
}

public IRC_OnConnectAttempt(botid, ip[], port)
{
	printf("*** IRC_OnConnectAttempt: Bot ID %d attempting to connect to %s:%d...", botid, ip, port);

	return 1;
}

public IRC_OnConnectAttemptFail(botid, ip[], port, reason[])
{
    printf("*** IRC_OnConnectAttemptFail: Bot ID %d failed to connect to %s:%d (%s)", botid, ip, port, reason);
     
	return 1;
}

public IRC_OnJoinChannel(botid, channel[])
{
    printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s", botid, channel);
    
	return 1;
}

public IRC_OnLeaveChannel(botid, channel[], message[])
{
	printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)", botid, channel, message);

	return 1;
}

public IRC_OnInvitedToChannel(botid, channel[], invitinguser[], invitinghost[])
{
    printf("*** IRC_OnInvitedToChannel: Bot ID %d invited to channel %s by %s (%s)", botid, channel, invitinguser, invitinghost);
     
	return 1;
}

public IRC_OnKickedFromChannel(botid, channel[], oppeduser[], oppedhost[], message[])
{
    printf("*** IRC_OnKickedFromChannel: Bot ID %d kicked by %s (%s) from channel %s (%s)", botid, oppeduser, oppedhost, channel, message);

	return 1;
}

public IRC_OnUserDisconnect(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected (%s)", botid, user, host, message);

	return 1;
}

public IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
    printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s", botid, user, host, channel);

	return 1;
}

public IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
    printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)", botid, user, host, channel, message);

	return 1;
}

public IRC_OnUserKickedFromChannel(botid, channel[], kickeduser[], oppeduser[], oppedhost[], message[])
{
    printf("*** IRC_OnUserKickedFromChannel (Bot ID %d): User %s kicked by %s (%s) from channel %s (%s)", botid, kickeduser, oppeduser, oppedhost, channel, message);

	return 1;
}

public IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
{
    printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his/her nick to %s", botid, oldnick, host, newnick);

	return 1;
}

public IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
{
    printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s", botid, user, host, channel, mode);

	return 1;
}

public IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
{
    printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s", botid, user, host, channel, topic);

	return 1;
}

public IRC_OnUserSay(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserSay (Bot ID %d): User %s (%s) sent message to %s: %s", botid, user, host, recipient, message);

	if (botid == bots[0] && strfind(user, IRC_BOT_MAIN2) == -1)
	{
		new File:log, fname[40], day, month, year;
		getdate(year, month, day);
		format(fname, sizeof(fname), "irc_%02d-%02d-%d.log", day, month, year);

		if (!fexist(fname))
		{
			log = fopen(fname, io_write);
		}
		else
		{
			log = fopen(fname, io_append);
		}
		
		if (log)
		{
			new string[256], userName[40];
			new hour, minute, tmp;
			IRC_GetUserChannelMode(botid, recipient, user, userName);
			format(userName, sizeof(userName), "%s%s", userName, user);
			gettime(hour, minute, tmp);
			format(string, sizeof(string), "[%02d:%02d] <%s> %s\r\n", hour, minute, user, message);
			fwrite(log, string);
			fclose(log);
		}
	}
	return 1;
}

public IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
{
    printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);

	return 1;
}

public IRC_OnUserRequestCTCP(botid, user[], host[], message[])
{
    printf("*** IRC_OnUserRequestCTCP (Bot ID %d): User %s (%s) sent CTCP request: %s", botid, user, host, message);

{'fraction_non_alphanumeric': 0.1746781979082864, 'fraction_numerical': 0.007843925985518906, 'mean_word_length': 4.712234348075818, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4100671', 'n_tokens_mistral': 3868, 'n_tokens_neox': 3643, 'n_words': 1064}