Giter Site home page Giter Site logo

phanabani / sandpiper Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 1.22 MB

A Discord bot that makes it easier to communicate with friends around the world.

License: MIT License

Python 99.45% JavaScript 0.41% Mako 0.14%
discord-bot conversion time timezone timezone-conversion unit unit-conversion imperial metric

sandpiper's People

Contributors

dependabot[bot] avatar malivil avatar phanabani avatar

Stargazers

 avatar  avatar

Watchers

 avatar

sandpiper's Issues

Upgrade hook for performing things on Sandpiper upgrades

I'm making privacy fields more important in Sandpiper's operation (age set to public will show it in birthday messages), and I want to notify users about this, so I want to add a way to communicate back to Sandpiper when a database upgrade occurs.

Add unit tests for birthday announcements

We'll probably need to patch asyncio.sleep somewhere...
Edit: yeah we sure did lol

  • Birthday in future
  • Birthday in the past (schedule if still birthday, don't otherwise)
  • Privacies
    • Birthday (don't send at all)
    • Age (don't put age in notif)
    • Name (use server nickname)
    • Pronouns (use they/them)
    • Timezone (use UTC)
  • Changing timezone/birthday while already scheduled
  • Send in several servers
  • Don't send (or error) if no birthday channel set
  • Don't error if birthday channel no longer exists

whois command should support tagging

Currently when using "!piper whois" you have to type a name manually e.g. "!piper whois Malivil"
It would be nice to be able to do "!piper whois @Malivil" to take advantage of the auto-complete

Improve help messages

they feel very generic

it also feels a bit clunky to have to do for example help timezone, and then look what the commands in it are to then do help timezone set to figure out the formatting for that

It would be cool if it was like a man page where it shows all the commands and their usage by just doing "help birthday"

Examples would be good. Like the stuff you have in GitHub

  • Make less generic
  • Add examples
  • Man page
  • DM only display

Embeds with inline fields on Discord for Android are ugly

This is a bug on the android app. I could add a mobile flag to commands to render these messages in monospaced blocks rather than the embeds. I looked into getting the user's mobile status to automatically change rendering style, but this would have way too much overhead (and has unknown behavior if the user is on both mobile and desktop).

Time Conversion - Add "now"

Sometimes I want to know what time it is for people in the server so have a "{now}" conversion would be useful

Tell users how privacy values tie into birthday message formatting

Enable/disable sending their birthday notification
Setting to display age in notif? Maybe this could be controlled by age privacy

I'm reconsidering these two issues. I think it's most logical to have the privacy settings control what data gets accessed by the birthday alerts module. For example:

  • Private birthdays won't be announced
  • Private ages won't be put in the birthday message
  • Private/missing preferred names will be replaced by regular usernames in the birthday message

However, is it intuitive that having your age as public means it will be announced? It doesn't seem so, and I think many people might not enjoy having their age displayed like this. The solution I was already thinking about is to add a NEW setting for displaying age, but that seems redundant/extraneous along with the privacy.

We could instead give more explicit hints to the user about what's going on when they set their data. For example, here's a diagram of possible a command flow:

  1. User sets birthday
    1. Birthday privacy == private
      1. "I can announce when it's your birthday if you set your birthday privacy to public"
    2. Birthday privacy == public
      1. "I will announce to your servers when it's your birthday"
      2. Age privacy == private
        1. "I will not show your new age in your birthday announcement"
      3. Age privacy == public
        1. "I will show your new age in your birthday announcement"
  2. User sets birthday privacy
    1. Birthday privacy == private
      1. "I will not announce your birthday. You can change this by setting birthday to public."
    2. Birthday privacy == public
      1. Same as 1.ii.
  3. User sets age privacy
    1. Birthday privacy == private
    2. Birthday privacy == public
      1. Age privacy == private
        1. Same as 1.ii.a.
      2. Age privacy == public
        1. Same as 1.ii.b.

I think this is a state machine. It probably doesn't need to be more complicated than a few nested conditionals but maybe look into that.

Originally posted by @Phanabani in #14 (comment)

Find a better solution for the timezone/unit ambiguity

Currently, it is possible to specify an input timezone like {5pm amsterdam} or {17:00 amsterdam}. {17 amsterdam} or {1700 amsterdam} does not work because we defer to a unit conversion when there is no colon or AM/PM period specified in the numeric section. This rule is not transparent, however, and has been a source of confusion for users.

The reason I've done it this way is because I think specifying a unit is a higher priority action than specifying an input timezone, since it's more common for a user to use their default timezone, and unit conversion is a core feature. Additionally, the fuzzy timezone matcher uses a partial token scorer, which means substring matches have very high precedence in scoring fuzzy matches and will easily match simple unit strings (5 km would 100% match a timezone with a name like "Akmo"). This scorer returned the most natural results during testing, so it is not up for changing.

One solution would be to run another pass at the timezone converter after failing a unit conversion ({17 amsterdam} returns an error "'Amsterdam' is not a recognized unit"), but the downside to this is that unknown unit errors will silently be discarded. I think meaningful error feedback is important and that this solution is undesirable.

Another solution may be to implement a more intelligent algorithm for determining whether a suffix is supposed to be a unit or a timezone. Though, thinking about it just now, that is also undesirable because some units which aren't handled by default have long snake_case names, such as boltzmann_constant. Is there really any way to reliably distinguish between a string like this and a timezone name? I feel it is very important to support uncommon units like this because it feels honestly like magic when the conversion of a weird unit just works out-of-the-box, and as a user myself I really enjoyed that feeling.

I just had another idea, perhaps I could do a similar approach to the two-pass time conversion idea, but for first use the current, more natural partial-token scorer, while the second uses a full token scorer. This retains the algorithm of the current implementation, but adds a very high threshold timezone match as a last resort. If the last resort timezone match fails, we can pretend it didn't happen and raise the unknown unit error. This will increase the domain of valid time conversion inputs without sacrificing units.

Timezone autocomplete

Output top 5 (or more?) fuzzily-matched timezones. Also allow lookup by country name.

Add format specifier in time/unit conversions to force output unit

Something like {9pm amsterdam}. This might conflict with unit conversion, as there could be an ambiguities.

Input Expected Actual
9 degC 9 degrees Celsius 09:00 in timezone "degC"

Could require either a period specifier (AM/PM) or 24hr time to prevent ambiguity.

Make birthday notifications atomic

If the bot starts up mid-day, I think it should announce any birthdays for that day even if it's past the birthday midnight. We need to make the birthday announcements atomic then, such that birthdays are announced once and only once, even if the bot restarts.

Onboarding

Create an onboarding system to help make it super easy for users to get started with Piper.

Birthday notifications

  • Guild settings database table
    • Birthday announcements channel
  • Role to allow changing guild settings? Just check admin perms
  • User settings table
    • Enable/disable sending their birthday notification
    • Setting to display age in notif? Maybe this could be controlled by age privacy
  • Use user's timezone to decide when to send message (default to UTC)

Handle users editing/deleting messages with conversions

When a user edits a conversion, Sandpiper should pick up on this and edit her reply with the new conversion. Likewise, if a user deletes their message with a conversion, she should delete her reply. The deletion could also be a config field.

Add config option to allow publicly setting personal data

We've had lots of problems on my server with people not understanding command syntax, and it's really difficult to troubleshoot with them when they have to go back and forth to DMs. There should be an option to allow public info changes rather than forcing users into DMs.

I think this is a reasonable option because users still will have the option to DM if they're uncomfortable, and they (should?) have the option of deleting their public messages. Perhaps have a sort of "onboarding" for new users setting info to be like "hey, you can also set your personal info in DMs if you want".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.