HoJBot.jl
HoJBot.jl copied to clipboard
dedicated Discord channel as backend storage
trafficstars
this channel holds the configuration data and maybe even the complete bot state either in serialized or in human-readable form. for configuration parameters, human-readable might be favourable, but for arbitrary state base64 most probably is a good format. Proposal (in pseudo julia code):
function startup()
haschannel("botconfig") || createchannel("botconfig")
global configchannel = getchannel("botconfig")
global configmsg = getconfigmessage(message->startswith(message, "hojbot"))
global config = loadsettings(content(configmsg)) #sets config dictionary
end
function commander(c, m::Message, Val{:config})
k, v = parseconfig(m)
updateconfig!(k, v)
end
function updateconfig!(k,v)
msg = generateconfigmsg()
edit!(configmsg, msg)
config[k] = v
end