changed Makefile; build all commands as an own file
[NeonServV5.git] / cmd_neonserv_unbind.c
1
2 #include "cmd_neonserv.h"
3
4 /*
5 * argv[0]   command name
6 */
7
8 CMD_BIND(neonserv_cmd_unbind) {
9     MYSQL_RES *res;
10     MYSQL_ROW row;
11     printf_mysql_query("SELECT `id` FROM `bot_binds` WHERE `botclass` = '%d' AND `command` = '%s'", client->botid, escape_string(argv[0]));
12     res = mysql_use();
13     if ((row = mysql_fetch_row(res)) == NULL) {
14         reply(getTextBot(), user, "NS_UNBIND_NOT_FOUND", argv[0]);
15         return;
16     }
17     unbind_cmd(client->botid, argv[0]);
18     printf_mysql_query("DELETE FROM `bot_binds` WHERE `id` = '%s'", row[0]);
19     reply(getTextBot(), user, "NS_UNBIND_DONE", argv[0]);
20     logEvent(event);
21 }