fixed neonspam cmd_set (support for default trigger)
[NeonServV5.git] / src / cmd_neonspam_set.c
index cb52314158cfc2bf2ea27031521c37ce6ff80915..00a4d1c816a1cb76ed51512d4f0d9e860c0ff579 100644 (file)
@@ -292,10 +292,10 @@ static char* neonspam_cmd_set_trigger(struct ClientSocket *client, struct UserNo
     //get current trigger
     MYSQL_RES *res;
     MYSQL_ROW row;
-    printf_mysql_query("SELECT `trigger` FROM `bot_channels` WHERE `chanid` = '%d' AND `botid` = '%d'", chan->channel_id, client->clientid);
+    printf_mysql_query("SELECT `trigger`, `defaulttrigger` FROM `bot_channels` LEFT JOIN `bots` ON `botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botid` = '%d'", chan->channel_id, client->clientid);
     res = mysql_use();
     row = mysql_fetch_row(res);
-    trigger = row[0];
+    trigger = (row[0] ? row[0] : row[1]);
     if(argument) {
         int uaccess = getChannelAccess(user, chan);
         if(uaccess < 500) {