Browse Source

Updated AI code and added some more responses.

pull/1/head
XeonSquared 4 years ago
parent
commit
35bcb741f2
2 changed files with 15 additions and 3 deletions
  1. +4
    -1
      ai.lua
  2. +11
    -2
      hooks/ai.lua

+ 4
- 1
ai.lua View File

@@ -5,9 +5,12 @@
{"I really like Queens of the Stone Age","Paramore is pretty good.","Green Day is great to listen to."},
{"music","favorite","like","?"}
},{
{"!cookie %s","\01ACTION gives %s a snowflake-shaped cookie\01","!cookie yukichan","!cake %s"},
{"cookie","biscuit","want","?"},true
},{
{"tsunbot a shit","tsunbot should pull a ThatAnon","tsunbot should self-terminate."},
{"tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot","tsunbot",}
},{
{"Yes.","No.","Perhaps."},
{"?","?"}
{"?","?"},true
}}

+ 11
- 2
hooks/ai.lua View File

@@ -21,8 +21,9 @@ if string.find(message,lnick) ~= nil and nick ~= "Shocky" then
for k,v in ipairs(aitab) do
local count = 0
for l,w in ipairs(v[2]) do
if message:find(w) then count = count + 1 print ("yes") end
if message:find(w) then count = count + 1 end
end
if config.debug then print(k.. " = " ..count) end
if count > hscore then
selection = k
hscore = count
@@ -31,11 +32,19 @@ if string.find(message,lnick) ~= nil and nick ~= "Shocky" then
end
if hscore == 0 then
-- print("No high score, selecting a random response.")
selection = math.random(1,#aitab)
local rtab = {}
for k,v in pairs(aitab) do
if v[3] == true then
table.insert(rtab,k)
end
end
selectrand = math.random(1,#rtab)
selection = rtab[selectrand]
end
-- print(selection)
seltab = aitab[selection][1]
selstring = seltab[math.random(1,#seltab)]
selstring = selstring:format(nick)
if type(selstring) == "table" then
for k,v in pairs(selstring) do
--print(k.."="..v)


Loading…
Cancel
Save