diff --git a/src/main.lua b/src/main.lua index 82dcf37..f5ba4a9 100644 --- a/src/main.lua +++ b/src/main.lua @@ -212,6 +212,8 @@ local token = require('./modules/token.lua') local commands=require('./modules/commands.lua') local prefix = ',' local client = discordia.Client() +_G.client = client + discordia.extensions() client:on('ready',function() @@ -247,7 +249,7 @@ function parseMentions(message) if v:match('<@![0-9]+>') then local id=v:match('<@!([0-9]+)>') if usersMentioned[id] then - msgSplit[i]=usersMentioned[id].name + msgSplit[i]=usersMentioned[id].mentionString end end end diff --git a/src/modules/commands.lua b/src/modules/commands.lua index 0c477e9..2de74f6 100644 --- a/src/modules/commands.lua +++ b/src/modules/commands.lua @@ -1,7 +1,6 @@ local discordia=require('discordia') discordia.extensions() local commands={command_list={}} -_G.init=false setmetatable(commands.command_list,{__index=function(self,index) for i,v in pairs(self) do for i2,v2 in pairs(v.alias) do @@ -29,7 +28,6 @@ function commands:Get(name) end function commands:INIT() -- self.command_list={} - _G.init=true for file in io.popen([[dir "./src/modules/commands" /b]]):lines() do require('./commands/'..file) end print('commands done') end diff --git a/src/modules/commands/rank.lua b/src/modules/commands/rank.lua index 6d7d49b..f43a7b6 100644 --- a/src/modules/commands/rank.lua +++ b/src/modules/commands/rank.lua @@ -1,10 +1,41 @@ local discordia=require('discordia') +local API=require('./../strafes_net.lua') local commands=require('./../commands.lua') function dump(a,b,c,d)b=b or 50;d=d or("DUMP START "..tostring(a))c=c or 0;for e,f in next,a do local g;if type(f)=="string"then g="\""..f.."\""else g=tostring(f)end;d=d.."\nD "..string.rep(" ",c*2)..tostring(e)..": "..g;if type(f)=="table"then if c>=b then d=d.." [ ... ]"else d=dump(f,b,c+1,d)end end end;return d end discordia.extensions() commands:Add('rank',{},'rank