Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dedicated Discord channel as backend storage #80

Open
rapus95 opened this issue May 31, 2021 · 0 comments
Open

dedicated Discord channel as backend storage #80

rapus95 opened this issue May 31, 2021 · 0 comments

Comments

@rapus95
Copy link
Member

rapus95 commented May 31, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant