cmarguel / lloid Goto Github PK
View Code? Open in Web Editor NEWA turnip tracker for discord
A turnip tracker for discord
Lloid will respond with usage statements if you use existing commands incorrectly, such as !host
via DM/channel, or host
via DM, without arguments.
However, Lloid will not respond to gibberish, or commands that do not exist. asdf
and !asdf
do nothing on either channel.
We can remove this if people don't like it, but someone suggested that it might be more convenient to remind people what the description said when sending the dodo code.
One or both of self.get_user(task[0]) or task[1] in let_next_user_in may be None for some reason in the line below.
logger.info(f"{self.get_user(task[0]).name} has departed for {task[1].name}'s island")
This seemingly causes it to crash. The cause for a None user may be Lloid getting disconnected briefly by Discord, but the event for disconnection doesn't seem to be executed, only reconnection.
Follow speech patterns of Lloid from the game in messages. Every sentence must end with "friend" or "chum", or something similar--look for sample Lloid dialogue.
It's very annoying when people say !queueinfo in a crowded room. Don't let him encourage them.
Lloid ends up in a bad state if it's unable to send a message to someone. Do a sanity check at the start of any method that sends out messages.
There are some issues Lloid can't help with, but maybe we can still mitigate it more. Some common causes of congestion even when Lloid is working properly:
Give host the option of being the one to control the flow of visitors by issuing the command
"next n" where it lets in the next 1 <= n <= 7 visitors.
Timers and "done" are to be disabled in this mode.
Guest queued up and told Lloid "done".
Guest received: "It sounds like either the market is now closed, or you're in line elsewhere at the moment."
"done" should never print this statement.
No other information available
The lloidbot.py file should only be for features specific to Discord, but it's started to contain a lot of logic. The queueing logic is more generalized and should be in its own set of easily-testable classes. Associating messages and reactions could be done in a more generic and testable fashion as well, without tying it too hard to discord.
The refactored queueing logic should go into its own class, and the contents of the queue class that exists in turnips.py should eventually be merged into that one as well.
If a guest isn't the most recent person to be let in, and they say done, then there's the possibility of too many codes being doled out in a short time (timeout flush plus a "done" flush). If we make it so that the command only works for the most recent guest, this problem should be alleviated.
Guests for whom it doesn't work should still receive a thank you message, though.
The code is getting cluttered up with long long strings (among other things). Extract them into a resource file of some kind.
Host should be able to prevent people from signing up without closing the queue. Proposed commands for this would be lock
and unlock
.
We have an array called recently_departed, which maps guest ids to owner ids--this allows Lloid to know whose queue to pause when a particular guest messages him "done". However, related entries are not being deleted when a queue closes, which means that anyone who neglected to say done is potentially in memory forever.
There are two ways I can think of. Either:
we have a single DM to the host which is continually edited to reflect who Lloid believes to be currently active, or
Lloid issues the list on demand, perhaps this is what !queueinfo can do on the host's end
The first offers info closer to real time, but I tend to prefer the second one.
Tracking and reporting the number of codes served per-queue would allow people to see how many people utilized their queue in the time that it is open. Reporting could be done periodically or once at queue close.
It is unclear what's causing this exactly, but according to the logs, the owner associated with the guest who says done isn't found in the sleepers array.
User wants to be notified if anyone posts that a certain item, DIY, etc. is in their town.
watch "<phrase>" ["<phrase>" ...]
Thanks, I'll look out for
"<phrase>" ["<phrase>" ...]
and message you if I hear about it.
By the way, to list the phrases you've watched, saywatchlist
. To unwatch a phrase, sayunwatch "<phrase>" ["<phrase>" ...]
. It's that easy!
Hello, good friend!
"<phrase>"
was mentioned in#<channel>
. Follow this link to see what's up, pal.<link to message>
If you no longer wish to be notified when this phrase is said, replyunwatch
watchlist
.I'm watching out for these great phrases you told me about:
<phrase>
- ...
unwatch "<phrase>" ["<phrase>" ...]
.Glad I could help. I won't watch for
"<phrase>" ["<phrase>" ...]
anymore. I hope you found what you were looking for!
unwatch
to lloid.Glad I could help. I won't watch for "" anymore. I hope you found what you were looking for!
unwatch
command.unwatchall
.I see. I'll unwatch all phrases you had watched.
help watch
, help unwatch
, help unwatchall
, or help watchlist
.
I can watch for a phrase with you if you say
watch "<phrase>" ["<phrase>" ...]
. For example:
watch "ironwood dresser"
orwatch "ironwood dresser" "peach umbrella"
I can tell you what phrases I'm looking out for if you say
watchlist
.I can unwatch a phrase if you say
unwatch "<phrase>" ["<phrase>" ...]
. For example:
unwatch "ironwood dresser"
orunwatch "ironwood dresser" "peach umbrella"
>
> I can unwatch all phrases you've asked me to watch if you sayunwatchall
.
watch
or unwatch
lloid replies:
Something's not right with that command.
Then lloid replies with the watch/unwatch/watchlist help string.
watch_limit
phrases (default: 10, can be set in bot configuration).
Whoa pal! That's too many watch phrases. I can only watch for
<watch_limit>
phrases for you. Right now I'm watching<N>
and you've asked to add<M>
phrases. That'ssum(<N> + <M>)
phrases. List the phrases you have watched withwatchlist
then unwatch a phrase withunwatch "<phrase>"
or reduce the amount of phrases you're asking to watch at once.
unwatch
command after the most-recently-found phrase has been forgotten, or never existed.
Sorry buddy, we've been talking about other things and I'm not sure which phrase you want me to unwatch. List the phrases you have watched with
watchlist
then unwatch a phrase withunwatch "<phrase>"
.
watchlist
but they have not watched any phrases.
I'm not watching for any phrases for you right now, but I would sure love to. Say
watch "<phrase>" ["<phrase>" ...]
to add phrases I can look out for. I'll let you know if I see 'em!
watchlist
implementation).To investigate:
Best guess: queue closed before guest could arrive, and Lloid possibly doesn't check that.
I'm not sure of the exact cause, but the logs indicate that the timers on old visitors might not actually be getting cancelled, so that might be it. Old visitors say done, letting in the next guest, but their timers expire after that, letting in another one. But it doesn't seem to be happening all the time.
It currently isn't possible to update the descriptions listed in the announcement channel.
Since it's possible for a host to have their situation change in one way or another, or make a mistake, hosts should be able to change the descriptions.
The bot should simply edit the announcement message in order to reflect this.
Example:
123 C0FEE 8 Hello this is my new description
Idea:
!closewhen [minutes] -- Automatically close listing in x minutes. Use of this command will broadcast time remaining to all in queue, plus a warning every hour, and in the last 20 minutes.
!closewhen rollover -- Compute minutes left and automatically close listing at turnip rollover time. This feature was previously omitted because time travellers could extend their prices indefinitely. This is no longer the case, so there is a stronger case for it.
!closewhen exhausted -- Automatically close queue when queue size hits zero
Currently only checks when a user tries to queue. It's feasible that Lloid could break if someone changes their DM settings while Lloid is supposed to be interacting with them. This should be done in the refactoring.
If the queue is paused, have lloid say so upon use of !queueinfo.
A host somehow opened two queues. After he closed one, another was still there, but because it wasn't actually a valid queue, visitors got into a corrupted state where they couldn't queue up for anything if they queued up for the invalid queue, because they could never unqueue. There is now a sanity check to make sure the visitors don't get corrupted, but this does not fix the host creating two queues at once.
Attached is a truncated log file of user's message history with Lloid. Hopefully this will help us reproduce the problem.
lloid-oyster-2020-04-23-edited.txt
Truncated were several paragraphs of the text Lloid normally spits out, and omitted entirely were the lines where user queued up for someone else's island, as I'm fairly confident that this had no bearing on the bug.
A guest queueing up should be able to type defer
to push them backwards a few slots.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.