Auto-promote DanbooruBot to Mod. Auto-create DanbooruBot if it doesn't exist.

This commit is contained in:
evazion
2017-12-15 14:51:24 -06:00
parent b48211cd4a
commit e2eb45a5a3
8 changed files with 21 additions and 9 deletions

View File

@@ -0,0 +1,10 @@
require "securerandom"
system = User.find_or_create_by!(name: Danbooru.config.system_user) do |user|
user.password = SecureRandom.base64(32)
end
unless system.is_moderator?
system.level = User::Levels::MODERATOR
system.save
end