clean up the poll command output

This commit is contained in:
biglyderv 2025-03-29 02:51:38 -04:00
parent 4b3b6c9111
commit 177f9025e0
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
3 changed files with 9 additions and 3 deletions

View file

@ -61,11 +61,16 @@ int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
char *val2 = (char *)val;
if (i->is_poll) {
char *key3 = calloc(strlen(key2)+1,sizeof(char));
memcpy(key3,key2,strstr(key2,"_") - key2);
if (val2[strlen(val2) - 1] == '\n') {
printf("- %s suggested %s", key2, val2);
printf("- %s suggested %s", key3, val2);
} else {
printf("- %s suggested %s\n", key2, val2);
printf("- %s suggested %s\n", key3, val2);
}
free(key3);
return 1;
}

View file

@ -8,7 +8,7 @@
#include "main.h"
// todo: polls, help commands, spacing in combos
// todo: polls, help commands, spacing in combos, clean init_tables
void init_tables(hashmap *elements, hashmap *inv, hashmap *polls, int do_inv) {
load_elements(elements, "../elem_data/" combo_file, 0);

View file

@ -3,6 +3,7 @@
#define combo_file "combos.txt"
#define poll_file "polls.txt"
#define polls_lock_file "polls_lock.txt"
#define lb_file "lb.txt"
#define MAX_BUF_LENGTH 1024
#define MAX_COMBO_LENGTH 1024