xbot/mods/uptime/uptime.c

32 lines
480 B
C
Raw Normal View History

2015-04-18 08:51:15 -07:00
#include "irc.h"
#include "events.h"
#include "module.h"
#include <stdio.h>
#include <stdlib.h>
2024-02-12 23:22:10 -08:00
#include <string.h>
2015-04-18 08:51:15 -07:00
2024-02-12 23:22:10 -08:00
const char *trigger;
void up(struct irc_conn *bot, char *user, char *chan, const char *text)
2015-04-18 08:51:15 -07:00
{
char buf[100];
FILE* file;
2024-02-12 23:22:10 -08:00
printf("dbug: %s\n", text);
2015-04-18 08:51:15 -07:00
if (!strcmp(text, "!uptime"))
{
file = popen("uptime", "r");
fgets(buf, 100, file);
pclose(file);
irc_privmsg(bot, chan, "%s", buf);
}
}
void mod_init()
{
add_handler(PRIVMSG_CHAN, up);
2024-02-12 23:22:10 -08:00
}