This commit is contained in:
Erik C. Thauvin 2020-12-07 01:34:11 -08:00
parent f9edff4813
commit a0530a8dc2
4 changed files with 14 additions and 33 deletions

View file

@ -47,6 +47,9 @@ class FeedReader(
// URL to fetch
private val url: String
) : Runnable {
// Maximum number of feed items to display
private val maxItems = 5
/**
* Fetches the Feed's items.
*/
@ -61,7 +64,7 @@ class FeedReader(
send(sender, "There is currently nothing to view.", false)
} else {
var i = 0
while (i < items.size && i < MAX_ITEMS) {
while (i < items.size && i < maxItems) {
send(sender, items[i].title, false)
send(sender, Utils.helpIndent(Utils.green(items[i].link), false), false)
i++
@ -77,9 +80,4 @@ class FeedReader(
}
}
}
companion object {
// Maximum number of feed items to display
private const val MAX_ITEMS = 5
}
}

View file

@ -71,16 +71,10 @@ class LinksMgr(bot: Mobibot) : AbstractCommand(bot) {
@JvmField
val history = mutableListOf<String>()
@JvmStatic
var startDate: String = Utils.today()
private set
// @JvmStatic
// fun addHistory(index: Int, entry: String) {
// history.add(index, entry)
// }
/**
* Saves the entries.
*
@ -91,16 +85,6 @@ class LinksMgr(bot: Mobibot) : AbstractCommand(bot) {
EntriesMgr.saveEntries(bot, entries, history, isDayBackup)
}
// @JvmStatic
// fun removeEntry(index: Int) {
// entries.removeAt(index)
// }
//
// @JvmStatic
// fun getEntry(index: Int): EntryLink {
// return entries[index]
// }
@JvmStatic
fun startup(current: String, backlogs: String, channel: String) {
startDate = EntriesMgr.loadEntries(current, channel, entries)