Giter Site home page Giter Site logo

diabot's Introduction

Diabot

A diabetes bot for Discord

Adding Diabot to your server

Use this invite link

Administration documentation

See documentation for admin commands here.

Sponsors

Diabot is a public Discord bot. This means that anyone can invite the bot to their server. Hosting a public bot isn't free. Diabot requires a machine to run on, and a database. Both of these things cost money. While there is a budget to ensure Diabot can continue running without any financial support from others, we do appreciate contributions. Financial contributions are used to pay for hosting costs, and (when the budget allows this) run a separate test version of Diabot, so we can better test it. When money is left over after all hosting fees are paid, this money will be saved for when contributions can't fully support the project.

If you wish to help pay for diabot hosting and development, you can Become a supporter on OpenCollective or sponsor cascer1 on GitHub.

Any support received will be used to pay for the hosting and improvement of Diabot. This is not a for-profit project.

Running Diabot

As Java application

Development for Diabot is aimed at a Java 11 environment. Diabot may not function correctly when using other version of java.

If you have Gradle installed, you can run the following two commands to quickly start Diabot:

gradle stage
java -jar build/libs/diabot.jar

For detailed instructions, see Running Diabot

As Docker container

Diabot releases are automatically published to the GitHub Container Registry. So, you can simply launch a new container to get up and running quickly:

docker run -e DIABOTTOKEN='token' ghcr.io/reddit-diabetes/diabot:latest

For detailed instructions and information about other environment variables, see Running Diabot

Contributing

Thank you for your interest in contributing to the development of Diabot.

We use GitHub issues to keep track of bugs and feature requests. Before opening a new issue, please check whether that issue has already been reported.

Pull Requests are welcome. When you submit a pull request, please make sure that you have tested your changes to ensure nothing is broken. On top of that, please describe your changes in the pull request. When your pull request is related to an issue, please mention this in the description. The description doesn't have to be anything fancy, so long as it helps the maintainers understand what the changes do.

If you have found a security issue, please report them immediately. See SECURITY.md for more information

diabot's People

Contributors

adidushi avatar cascer1 avatar chanceharrison avatar cominixo avatar davidlenfesty avatar djzeratul avatar esayles avatar mathwhiz avatar p5nbtgip0r avatar papert1d avatar stavlor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

diabot's Issues

Command Simplicity

Doing certain commands (such as diabot ns public true) and diabot ns set (domain name) either don’t help with hinting what to do (diabot simply says Something about a scheme if you don’t put https://) (setting domain) or doesn’t even tell you to put true (setting ns to public)

Rewrite help listener to better support subcommands

  • should clearly list subcommands in overview
  • when requesting help for a parent command, it should list subcommands like in the overview
  • command details should display parent if present
  • Currently, when there are subcommands with a common name (e.g: info set and nightscout set) it will always show help for the first found command (in this case nightscout set)

Add a NS graph command

I'd like to be able to see a small graph embedded into Discord when I get data from the bot, as then it would be easier (for the user) than taking screenshots and uploading

Add command for GitHub link to diabot

If the command 'diabot github' was given then give the link to the GitHub so that people can have easier access if they think of a good idea or there is an idea that someone in the discord thinks of.

Add settings for simple NS cards

With all the fields we're adding to the Nightscout cards, some users might prefer simple cards that contain only BG data.

diabot ns setsimple <true/false>

1 final emote response

Since 69mg and 6.9mmol both get smirks, despite meaning two different things, it seems only fair to our friends using mmol to get the 💯 emote as a reaction to 10.0mmol as well as 99/100mg.

I respect that this may feel unnecessary, but it will help towards normalizing upper range numbers and temporary setbacks by encouraging people with higher bgs to share their failures as well as their successes. Thank you for your time, and I hope that I can help you work towards a better and brighter future for our beloved Diabot. <3

Research JDA subcommands

Instead of this ugly parsing we do now in some commands (mostly nightscout and estimate), we should consider using JDA subcommands.

If they work anything like I hope they do, at least

IOB Display

IOB Display feature,

Device Status OpenAPS/AAPS Example:

[
  {
    "_id": "5bd7589cf56a912fced39f5b",
    "device": "openaps://Google Pixel 3 XL",
    "pump": {
      "battery": {
        "percent": 50
      },
      "status": {
        "status": "normal",
        "timestamp": "2018-10-29T18:59:39Z"
      },
      "extended": {
        "Version": "2.0i-dev-54b3e60f4-2018.10.17-16:27",
        "ActiveProfile": "New Default",
        "TempBasalAbsoluteRate": 0.37199999999999994,
        "TempBasalStart": "10/29/18 2:55 PM",
        "TempBasalRemaining": 25
      },
      "reservoir": 50,
      "clock": "2018-10-29T18:59:39Z"
    },
    "openaps": {
      "suggested": {
        "temp": "absolute",
        "bg": 236,
        "tick": "+8",
        "eventualBG": 194,
        "insulinReq": 1.92,
        "deliverAt": "2018-10-29T18:59:39.456Z",
        "sensitivityRatio": 1.2,
        "predBGs": {
          "IOB": [
            236, 243, 248, 253, 256, 258, 258, 258, 256, 254, 250, 245, 240, 234, 229, 223, 218, 213, 208, 204, 199, 195, 191, 187, 183, 180, 176, 173, 170, 167, 164, 162, 159, 157, 155, 153, 151, 149, 148, 146, 145, 144, 143, 142, 141, 140, 139, 138
          ],
          "ZT": [
            236, 231, 226, 221, 215, 209, 204, 198, 192, 187, 182, 176, 171, 166, 162, 157, 153, 149, 145, 142, 138, 135, 133, 130, 128, 126, 124, 123, 122, 121, 120, 120, 119, 119, 119, 119, 120, 120
          ],
          "UAM": [
            236, 243, 250, 255, 260, 264, 268, 270, 272, 274, 275, 275, 275, 274, 272, 271, 268, 266, 262, 259, 255, 250, 246, 242, 239, 235, 232, 228, 225, 222, 220, 217, 215, 212, 210, 208, 207, 205, 203, 202, 200, 199, 198, 197, 196, 195, 195, 194
          ]
        },
        "COB": 0,
        "IOB": 5.782,
        "reason": "COB: 0, Dev: 77, BGI: -5, ISF: 29, CR: 5.5, Target: 110, minPredBG 166, minGuardBG 193, IOBpredBG 138, UAMpredBG 194; Eventual BG 194 >= 110,  insulinReq 1.92; maxBolus 0.6; setting 30m low temp of 0.62U/h. Microbolusing 0.6U. ",
        "units": 0.6,
        "rate": 0.62,
        "duration": 30,
        "timestamp": "2018-10-29T18:59:39Z"
      },
      "iob": {
        "iob": 5.782,
        "basaliob": 0.23900000000000002,
        "activity": 0.033600000000000005,
        "time": "2018-10-29T18:59:39Z"
      }
    },
    "uploaderBattery": 90,
    "created_at": "2018-10-29T18:59:39Z",
    "NSCLIENT_ID": 1540839579493
  }
]

Pebble Endpoint example:

{
  "status": [
    {
      "now": 1540839651743
    }
  ],
  "bgs": [
    {
      "sgv": "236",
      "trend": 3,
      "direction": "FortyFiveUp",
      "datetime": 1540839559000,
      "bgdelta": 8,
      "battery": "90",
      "iob": "5.78",
      "bwp": "-2.19",
      "bwpo": 34,
      "cob": 0
    }
  ],
  "cals": []
}

Add diacast info command

Add a command to show information about (i) a specific; or (ii) a specific diacast episode

diabot episode

diabot episode 6

Enforce username rules

Allow diabot to enforce username rules

  • diabot admin usernames set <pattern> to set pattern
  • diabot admin usernames enable to enable enforcement
  • diabot admin usernames disable to disable enforcement
  • diabot admin usernames pattern to view pattern
  • diabot admin usernames replacement <replacement> to view or set the replacement name
  • Name change listener to enforce the rule
  • Refactor set command to merge with pattern

Add database support

Some of the advanced features we're planning require a database connection. This issue tracks the progress of this.

Add Reminders

#diabetic-chat paraphrased:

If diabot can send PMs like other bots can, then potentially set a reminder function to PM for specific times for those doing insulin at specific times. Basically like a timesulin cap but through discord.

Disclaimer "NOT OUR FAULT IF IT DON'T WORK, DON'T TRUST DUMB INTERNET BOTS TO TAKE CARE OF YOU THX"

Add role assignment logic

Bot should be able to assign a configured role, based on whether a user has another configured role or not.

For example:

  • Any user that sends a message AND has the approved role should be given the Halloween 2018 role

sub-tasks:

  • Store a list of roles that may grant a reward
  • For each of these roles, store a list of potential rewards
  • For each reward, store a list of roles a user must have to receive it

Add short Nightscout responses

Diabot should add a setting (configurable by admins) to use shorter nightscout responses. The card is nice but takes up a lot of space, especially when used often.

For example:

Name: mmol/L: 6.1(+0.3) | mg/dL: 109(+5) | trend: → | iob: 0.56 | cob: 3 | Today at 8:01 PM

The admin command to add or remove channels from the list of channels that receive short responses could be:

diabot nsadmin shortchannels add #diabetic-chat or diabot nsadmin shortchannels remove #regular-chat

(Thanks to Telani)

Display NS title in NS card

Users have the option to set a custom Nightscout title (environment variable CUSTOM_TITLE in Nightscout. We should display this title in the nightscout response when it is present.

Allow users to configure their nightscout URL

Allow users to configure a nightscout url (nightscout set <url>), and then allow them to request the status without including a domain (nightscout)

possibly also accept nightscout @user to see their configured status, if available.

Add support for rule management

Server administrators may wish to use diabot to manage rules.

Advantage: all admins (or other configured role) may configure rules for the server; diabot manages rule messages in a rules channel.

  • Store message IDs (every rule in a separate message, store which message IDs belongs to which rule number)
  • Save rule order
  • Store rule content
  • Command to add new rule
  • Command to remove existing rule
  • Command to overwrite existing rule (basically edit)
  • Support for rule title & description
  • Command to update existing rule messages (edit messages)
  • Command to completely refresh rules channel (delete all contents, post new rule messages)

Allow admins to configure role rewards

Instead of having to hardcode rewards, it should be possible for admins to configure them using a command

rewards add <requiredRole> <rewardRole>

for example

rewards add @Approved @Halloween

Manually calculate delta when it is not part of the nightscout response

Is your feature request related to a problem? Please describe.
Sometimes the Nightscout entries API endpoint (/api/v1/entries.json) does not include a delta. This makes it so that the delta is also not displayed in the NS card (diabot nightscout)

Describe the solution you'd like
manually calculate the delta by gathering the two most recent entries and doing some simple math

Describe alternatives you've considered
disabling Dexcom share

Additional context
Original reporter: accio-books

Nightscout command fails when most recent Nightscout entry is a calibration

When the most recent entry is a calibration, we should look at the entry before that.

example calibration response

[
  {
    "_id": "xxxx",
    "device": "xDrip-DexcomG5",
    "date": 1541183876774,
    "dateString": "2018-11-02T14:37:56.774-0400",
    "slope": 1384.1885140433599,
    "intercept": -19547.12370947527,
    "scale": 1,
    "type": "cal"
  }
]

Adding simple information commands for commonly referred to projects.

It would be handy to have a quick bot command that explains and links to things that people may not be aware of, but are commonly referred to in chat. For instance !xdrip !spike !nightscout

Having a single simple explanation can make it easier for people to answer questions they may not be fully equipped to explain, and prevents misconceptions about the capabilities of these programs.

Here's some things I threw together really quickly for xdrip+ and Nightscout:

!xdrip

xDrip+ is an open source diabetes management app on Android that allows for more features than official CGM applications. Features include Nightscout upload, compatibility with most CGMs, extended sensor sessions, customizable alerts, bluetooth glucose meter support, and much more. It is available at: https://github.com/NightscoutFoundation/xDrip

!nightscout

Nightscout is an open source, web based tool that allows for real time access to diabetes data. It has many different uses including sharing information with others, disposable supply tracking, alarms, basic predictions, diabetes treatment reports, and much more. It has wide compatibility with many systems including all modern CGMs, DIY artificial pancreas systems, and just about anything able to connect to the internet. More information at: http://www.nightscout.info/ Setup guide at: http://www.nightscout.info/wiki/welcome/set-up-nightscout-using-heroku

I'd do a spike one but I've never used it and the recent re-signing issues should be part of it. Also I'd love suggestions on changes to the above wording.

ambiguous conversions display incorrect source value

Describe the bug
When performing an ambiguous conversion, the source value (i.e 27) is displayed as its converted counterpart.

To Reproduce

  1. Type 27
  2. Observe incorrect left-hand values

Expected behavior
Bot shouldn't convert the input unit

Diaboi NS

Is your feature request related to a problem? Please describe.

It's a problem that the diaboi ns command doesn't show a picture of Aaron.

Describe the solution you'd like

I'd like the command diaboi ns to show a picture of Aaron.

Describe alternatives you've considered
It could also just show Aaron's PFP Bepis man.

Additional context
image

Add BG conversion commands

Users should be able to convert between mmol/L and mg/dL blood glucose levels in several ways:

  1. standalone: A single message with just a number
  2. inline: A number surrounded by underscores (My bg when I woke up was _7.3_!)
  3. Inline with unit: A number succeeded by a unit indication (I'm currently at 130 mg/dL)

Preferably, multiple inline notations in the same message should all be converted

Use conversion logic from #2

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.