diff src/lib/Server.luan @ 16:552d6f944acb

add bump
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 01 Nov 2023 17:34:15 -0600
parents 80105b716a62
children 74277b56ac3c
line wrap: on
line diff
--- a/src/lib/Server.luan	Wed Nov 01 00:12:08 2023 -0600
+++ b/src/lib/Server.luan	Wed Nov 01 17:34:15 2023 -0600
@@ -1,6 +1,8 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local ipairs = Luan.ipairs or error()
+local Number = require "luan:Number.luan"
+local long = Number.long or error()
 local Db = require "site:/lib/Db.luan"
 local Utils = require "site:/lib/Utils.luan"
 local get_user = Utils.get_user or error()
@@ -14,6 +16,7 @@
 		id = doc.id
 		discord_id = doc.server_discord_id
 		owner_discord_id = doc.server_owner_discord_id
+		bumped = doc.server_bumped
 		name = doc.name
 		icon = doc.icon
 		invite = doc.invite
@@ -26,6 +29,7 @@
 		id = server.id
 		server_discord_id = server.discord_id or error()
 		server_owner_discord_id = server.owner_discord_id or error()
+		server_bumped = long(server.bumped)
 		name = server.name or error()
 		icon = server.icon or error()
 		invite = server.invite or error()
@@ -86,4 +90,8 @@
 	return search( "server_owner_discord_id:"..get_user() )
 end
 
+function Server.bumped_sort(s1,s2)
+	return s1.bumped > s2.bumped
+end
+
 return Server