Mercurial Hosting > disearch
diff src/lib/Server.luan @ 14:80105b716a62
start bot
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 31 Oct 2023 23:56:48 -0600 |
parents | af2b95854072 |
children | 552d6f944acb |
line wrap: on
line diff
--- a/src/lib/Server.luan Mon Oct 30 21:32:42 2023 -0600 +++ b/src/lib/Server.luan Tue Oct 31 23:56:48 2023 -0600 @@ -12,8 +12,8 @@ doc.type == "server" or error "wrong type" return Server.new { id = doc.id + discord_id = doc.server_discord_id owner_discord_id = doc.server_owner_discord_id - discord_id = doc.discord_id name = doc.name icon = doc.icon invite = doc.invite @@ -24,8 +24,8 @@ return { type = "server" id = server.id + server_discord_id = server.discord_id or error() server_owner_discord_id = server.owner_discord_id or error() - discord_id = server.discord_id or error() name = server.name or error() icon = server.icon or error() invite = server.invite or error() @@ -66,6 +66,11 @@ return doc and from_doc(doc) end +function Server.get_by_discord_id(discord_id) + local doc = Db.get_document("server_discord_id:"..discord_id) + return doc and from_doc(doc) +end + local function search(query,sort,rows) rows = rows or 1000000 local docs = Db.search(query,1,rows,{sort=sort})