xbot/mods/test/test.c
2015-04-08 13:56:32 -05:00

26 lines
463 B
C

#include "irc.h"
#include "events.h"
#include "module.h"
#include <stdio.h>
#include <stdlib.h>
int HANDLER = 0;
void hello(struct irc_conn *bot, char *user, char *chan, char *text)
{
char *buf = (char *)malloc(sizeof(char *) * 500);
sprintf(buf, "hi %s", bot->nick);
if (!strcmp(text, buf))
{
irc_privmsg(bot, chan, "%i", HANDLER);
del_handler(HANDLER, PRIVMSG_CHAN);
}
free(buf);
}
void mod_init()
{
HANDLER = add_handler(PRIVMSG_CHAN, hello);
}