xbot/mods/hello/hello.c

25 lines
425 B
C
Raw Normal View History

#include "irc.h"
#include "events.h"
2015-04-06 23:56:50 -07:00
#include "module.h"
#include <stdio.h>
#include <stdlib.h>
2015-04-08 11:56:32 -07:00
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))
{
2015-04-18 08:51:15 -07:00
irc_privmsg(bot, chan, "hi %s", user);
}
free(buf);
}
2015-04-07 11:18:24 -07:00
void mod_init()
{
2015-04-08 11:56:32 -07:00
HANDLER = add_handler(PRIVMSG_CHAN, hello);
}