@@ -181,7 +181,7 @@ int loadLua(lua_State* L) {
181181 if (c == ' \\ ' ) c = ' /' ;
182182 }
183183#endif
184- std::filesystem::path pathFile{ nameFile + " .lua " };
184+ std::filesystem::path pathFile{ nameFile };
185185 if (pathFile.extension () != " .lua" )pathFile = nameFile + " .lua" ;
186186 if (pathFile.is_relative ())pathFile = DiceDir / " plugin" / pathFile;
187187 if (!std::filesystem::exists (pathFile) && nameFile.find (' \\ ' ) == string::npos && nameFile.find (' /' ) == string::npos)
@@ -217,18 +217,37 @@ int getGroupConf(lua_State* L) {
217217 long long id{ lua_to_int (L, 1 ) };
218218 string item{ lua_to_gb18030_string (L, 2 ) };
219219 if (!id || item.empty ())return 0 ;
220- Chat& grp{ chat (id) };
221- if (item == " name" ) {
222- lua_push_string (L, grp.Name );
223- }
224- else if (mChatConf .count (item)) {
225- lua_pushboolean (L, grp.boolConf .count (item));
226- }
227- else if (grp.intConf .count (item)) {
228- lua_pushnumber (L, (double )grp.intConf [item]);
220+ if (lua_gettop (L) > 3 )lua_settop (L, 3 );
221+ if (item == " size" ) {
222+ lua_pushnumber (L, (double )DD::getGroupSize (id).siz );
223+ }
224+ else if (item == " maxsize" ) {
225+ lua_pushnumber (L, (double )DD::getGroupSize (id).cap );
226+ }
227+ else if (ChatList.count (id)) {
228+ Chat& grp{ chat (id) };
229+ if (item == " name" ) {
230+ if (grp.Name .empty ())lua_push_string (L, grp.Name = DD::getGroupName (id));
231+ else lua_push_string (L, grp.Name );
232+ }
233+ else if (item == " firstCreate" ) {
234+ lua_pushnumber (L, (double )grp.tCreated );
235+ }
236+ else if (item == " lastUpdate" ) {
237+ lua_pushnumber (L, (double )grp.tUpdated );
238+ }
239+ else if (mChatConf .count (item)) {
240+ lua_pushboolean (L, grp.boolConf .count (item));
241+ }
242+ else if (grp.intConf .count (item)) {
243+ lua_pushnumber (L, (double )grp.intConf [item]);
244+ }
245+ else if (grp.strConf .count (item)) {
246+ lua_push_string (L, grp.strConf [item]);
247+ }
229248 }
230- else if (grp. strConf . count ( item) ) {
231- lua_push_string (L, grp. strConf [item] );
249+ else if (item == " name " ) {
250+ lua_push_string (L, DD::getGroupName (id) );
232251 }
233252 else {
234253 lua_pushnil (L);
@@ -255,20 +274,34 @@ int setGroupConf(lua_State* L) {
255274int getUserConf (lua_State* L) {
256275 long long qq{ lua_to_int (L, 1 ) };
257276 if (!qq)return 0 ;
277+ if (lua_gettop (L) > 3 )lua_settop (L, 3 );
258278 string item{ lua_to_gb18030_string (L, 2 ) };
259279 if (item.empty ())return 0 ;
260- User& user{ getUser (qq) };
261280 if (item == " nick" ) {
262281 lua_push_string (L, getName (qq));
263282 }
264283 else if (item == " trust" ) {
265284 lua_pushnumber (L, trustedQQ (qq));
266285 }
267- else if (user.intConf .count (item)) {
268- lua_pushnumber (L, (double )user.intConf [item]);
269- }
270- else if (user.strConf .count (item)) {
271- lua_push_string (L, user.strConf [item]);
286+ else if (UserList.count (qq)) {
287+ User& user{ getUser (qq) };
288+ if (item == " firstCreate" ) {
289+ lua_pushnumber (L, (double )user.tCreated );
290+ }
291+ else if (item == " lastUpdate" ) {
292+ lua_pushnumber (L, (double )user.tUpdated );
293+ }
294+ else if (item == " nn" ) {
295+ string nick;
296+ user.getNick (nick, qq);
297+ lua_push_string (L, nick);
298+ }
299+ else if (user.intConf .count (item)) {
300+ lua_pushnumber (L, (double )user.intConf [item]);
301+ }
302+ else if (user.strConf .count (item)) {
303+ lua_push_string (L, user.strConf [item]);
304+ }
272305 }
273306 else {
274307 lua_pushnil (L);
0 commit comments