group-butler / GroupButler

This bot can help you in managing your group with rules, anti-flood, description, custom triggers, and much more!
https://t.me/GroupButler_bot
GNU General Public License v2.0
442 stars 295 forks source link

bad argument #1 to 'format' (string expected, got nil) #318

Closed yangm97 closed 6 years ago

yangm97 commented 6 years ago
An #error occurred.
./lua/plugins/users.lua:224: bad argument #1 to 'format' (string expected, got nil)
stack traceback:
 [C]: in function 'format'
 ./lua/plugins/users.lua:224: in function <./lua/plugins/users.lua:208>
 (tail call): ?
 [C]: in function 'xpcall'
 ./lua/main.lua:107: in function <./lua/main.lua:61>
 (tail call): ?
 polling.lua:47: in main chunk
 [C]: ?
en
###cb:userbutton:remwarns:[redacted]
An #error occurred.
./lua/utilities.lua:637: bad argument #2 to 'format' (string expected, got nil)
stack traceback:
 [C]: in function 'format'
 ./lua/utilities.lua:637: in function 'getSettings'
 ./lua/plugins/dashboard.lua:109: in function <./lua/plugins/dashboard.lua:89>
 (tail call): ?
 [C]: in function 'xpcall'
 ./lua/main.lua:107: in function <./lua/main.lua:61>
 (tail call): ?
 polling.lua:47: in main chunk
 [C]: ?
en
###cb:dashboard:settings:[redacted]
yangm97 commented 6 years ago
lua: ./lua/main.lua:144: bad argument #2 to 'format' (string expected, got table)
stack traceback:
    [C]: in function 'format'
    ./lua/main.lua:144: in function <./lua/main.lua:61>
    (tail call): ?
    polling.lua:47: in main chunk
    [C]: ?
yangm97 commented 6 years ago

Fixed by #323

yangm97 commented 6 years ago

Maybe not. The issue with ###cb:dashboard:settings persists.

riskey95 commented 6 years ago

can you provide error log? i just pull from this repo, master branch and and launch (w/o docker) but not facing issue on ###cb:dashboard:settings

yangm97 commented 6 years ago

Ooops, I might have forgotten to update the running bots 😅

TODO: Add CI/CD

yangm97 commented 6 years ago
An #error occurred.
./lua/utilities.lua:608: bad argument #1 to 'format' (string expected, got nil)
stack traceback:
 [C]: in function 'format'
 ./lua/utilities.lua:608: in function 'getSettings'
 ./lua/plugins/dashboard.lua:109: in function <./lua/plugins/dashboard.lua:89>
 (tail call): ?
 [C]: in function 'xpcall'
 ./lua/main.lua:112: in function <./lua/main.lua:61>
 (tail call): ?
 polling.lua:47: in main chunk
 [C]: ?
it_IT
###cb:dashboard:settings:

Nah, seems like I did not forget to update it after all.

riskey95 commented 6 years ago

it seem you forget to update after all, i just test it using italian but i didnt face this issue

yangm97 commented 6 years ago

It is happening on official GB and I can assure it is up to date.

yangm97 commented 6 years ago
An #error occurred.
./lua/utilities.lua:594: bad argument #1 to 'format' (string expected, got nil)
stack traceback:
 [C]: in function 'format'
 ./lua/utilities.lua:594: in function 'getSettings'
 ./lua/plugins/dashboard.lua:109: in function <./lua/plugins/dashboard.lua:89>
 (tail call): ?
 [C]: in function 'xpcall'
 ./lua/main.lua:112: in function <./lua/main.lua:61>
 (tail call): ?
 polling.lua:47: in main chunk
 [C]: ?
it_IT
###cb:dashboard:settings:
yangm97 commented 6 years ago

(Notice how lines changed because I removed some leftover code from moderators and admins, after your PR got merged)

yangm97 commented 6 years ago

Seems like /ban id is broken too

./lua/plugins/banhammer.lua:99: bad argument #2 to 'format' (string expected, got nil)
stack traceback:
 [C]: in function 'format'
 ./lua/plugins/banhammer.lua:99: in function <./lua/plugins/banhammer.lua:46>
 (tail call): ?
 [C]: in function 'xpcall'
 ./lua/main.lua:112: in function <./lua/main.lua:61>
 (tail call): ?
 polling.lua:47: in main chunk
 [C]: ?
en
/ban [numeric id]
riskey95 commented 6 years ago

use /ban [user id] right? i dont this error when use command /ban (userid)

yangm97 commented 6 years ago

Maybe users are trying /ban with invalid numeric ids?

yangm97 commented 6 years ago

Or rather, ids from members that are not in the chat.

riskey95 commented 6 years ago

i dont get any error when tried to ban member that were not in the chat screenshot_20180716-112929 screenshot_20180716-112940

yangm97 commented 6 years ago

@riskey95 So I don't have any idea what it could be then. We're planning to store problematic updates somewhere in the future to help debugging this kind of issues though.

yangm97 commented 6 years ago

@NotAFile added an assert on getnames_complete() and today I just saw this:

An #error occurred.
./lua/utilities.lua:787: kicked is false/nil
stack traceback:
 [C]: in function 'assert'
 ./lua/utilities.lua:787: in function 'getnames_complete'
 ./lua/plugins/banhammer.lua:58: in function <./lua/plugins/banhammer.lua:46>
 (tail call): ?
 [C]: in function 'xpcall'
 ./lua/main.lua:122: in function 'on_msg_receive'
 ./lua/main.lua:335: in function 'parseMessageFunction'
 polling.lua:47: in main chunk
 [C]: ?
en
/ban [numeric id]

So there are cases where this function is returning nil/false.

yangm97 commented 6 years ago

Is anyone against adding a default value, like “unknown” for this function?

NotAFile commented 6 years ago

@yangm97 sounds great

yangm97 commented 6 years ago

Alright, should be fixed by fc12590 now.