xbot/mods/hello/hello.c

31 lines
537 B
C
Raw Normal View History

2024-02-13 07:22:10 +00:00
#define MY_DLL_EXPORTS 1
#include "irc.h"
#include "events.h"
2015-04-07 06:56:50 +00:00
#include "module.h"
#include <stdio.h>
#include <stdlib.h>
2024-02-13 07:22:10 +00:00
#include <string.h>
2015-04-08 18:56:32 +00:00
int HANDLER = 0;
2024-02-13 07:22:10 +00:00
MY_API void hello(struct irc_conn *bot, char *user, char *chan, const char *text)
{
char *buf = (char *)malloc(sizeof(char *) * 500);
sprintf(buf, "hi %s", bot->nick);
if (!strcmp(text, buf))
{
2015-04-18 15:51:15 +00:00
irc_privmsg(bot, chan, "hi %s", user);
2024-02-13 07:22:10 +00:00
printf("%s said hi to me\n", user);
}
free(buf);
}
2024-02-13 07:22:10 +00:00
MY_API void mod_init()
{
2015-04-08 18:56:32 +00:00
HANDLER = add_handler(PRIVMSG_CHAN, hello);
2024-02-13 07:22:10 +00:00
}