GithubHelp home page GithubHelp logo

laralove143 / timezoner Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 4.0 16.16 MB

A Discord bot that converts times so that everyone sees them in their own timezone

License: MIT License

Rust 100.00%
discord

timezoner's Introduction

πŸ‘‹πŸ‘‹πŸ‘‹πŸ‘‹πŸ‘‹

Hello! I'm Lara, a 20 years old non-binary university student at METU trying to code despite my ADHD, nice to meet you!

Github Sponsors


πŸ—£οΈπŸ—£οΈπŸ—£οΈπŸ—£οΈπŸ—£οΈ

Discord

Telegram LinkedIn Mail Instagram

More πŸ—£οΈοΈ

Snapchat Genius


πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»

HTML CSS Tailwind CSS Bootstrap JavaScript TypeScript Node.js

Rust Go C# Swift Python

PostgreSQL SQLite

Cloudflare Debian

More πŸ§‘β€πŸ’»

Bash systemd GitHub Actions Microsoft Azure Google Cloud Google Apps Script Unity



πŸ’ΌπŸ’ΌπŸ’ΌπŸ’ΌπŸ’Ό

Discord bots to make your life easier

In the team of Twilight, a Discord library for the Rust programming language

Volunteer at ÜNOG, an organization of university student game developers


πŸ› οΈπŸ› οΈπŸ› οΈπŸ› οΈπŸ› οΈ

A Discord bot that converts times so that everyone sees them in their own timezone

A Discord bot to move messages between channels

A Discord bot that lets you edit other people's messages

A Discord bot that automatically puts possibly triggering words in spoilers


🎡🎡🎡🎡🎡

These are just my Apple Music playlists, here because I love music

Feel Again Chill Takeoff Unbottling It
I wish I could share my Apple Music profile but they're not supported where I live


β€οΈπŸ§‘πŸ’›πŸ’šπŸ’™πŸ’œπŸ’›πŸ€πŸ’œπŸ–€

timezoner's People

Contributors

dependabot[bot] avatar laralove143 avatar

Stargazers

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

Watchers

 avatar

timezoner's Issues

message too long error deletes original message

when a message with converted time is over 2k chars, the correct error is returned but after the original is deleted

solution? save CreateMessage future before deleting, await it after deletion

make setup easier

make it easier to let people know they need to set their timezones, the reaction isnt obvious enough, maybe still resend the message but instead of the formatted time say it could be shown if they set their timezone, which might be too annoying though

overhaul the readme

as the bot grows larger, more and more features will go in just a list entry so im thinking:

  • split each feature to its own heading, with examples
  • add a get started heading
  • add a support heading
  • add a shameless donation heading
  • link other bots
  • add troubleshooting heading
  • link to the readme on /help
  • reflect the changes on top.gg and app discovery

[FEATURE REQUEST] New functionality flow for Timezoner

Summary

The new functionality I propose is one concocted by several people within the development discord. I do not take credit for all of the ideas here, simply their representation.

New Functionality Flow

don't ask why I made it like a github workflow I don't know

on:
  message_sent:
    includes_time: true

jobs:
  reply:
    type: ephemeral
    options:   
    - convert: 
      - name: delete original message
        steps:
        - message: delete
      - name: send bot message
        steps: 
        - message: send
          body: "text or something idk"
        - after: add reaction clock to the bot message
          reaction:
            action: add
            message: ${ last_message }
            emoji: \:alarm_clock\:
          with:
            env:
              last_msg: ${{ steps.get_previous().message }}
    # delete orig, send bot message
    - ignore:
    # delete the ephemeral message
    - stamp_convert:
    # do [convert] but add timezone timestamp

update examples

the flow of the bot has changed from automatic conversion on time detection to waiting on a reaction to do the conversion in the rewrite, the examples should reflect that

change links in embeds to buttons

idk why i didnt think of this before, but this mostly applies to /help, adding it to every embed (instead of the common footer) would probably get annoying

use a proxy

there are two benefits to this:

  • if multiple bots are hosted on the same server, theres no way to handle global ratelimits without running them over a proxy
  • http latency metrics can be collected using a proxy

remove timeout from message conversions

with #32 and non-author conversions accounting for over a third of all conversions, it'd be better ux to let them convert times at any time (and so has the server decided)

the only downside is that the reactions will stay in the message even when not applicable, unless a moderator removes them

also fixes #35 if implemented statelessly (+1 request and time scan on reaction of clock emoji)

revert the timezone setting flow to use autocomplete

for those of you that don't know/remember, timezoner used to suggest timezones as you typed into the /timezone command, it was simpler and faster

but even tho it said to type your city/state/country people kept typing timezone abbreviations like EST, which can't be used since it is (or it might be in the future) ambiguous whether the location uses daylight saving, so this brings us to 3 options

  1. keep it as it is, its fine
  2. add this, show the individual locations on EST etc and hope that no more than 20 locations exist (i will hate you if you pick this)
  3. add this, add an option "don't see your timezone?" which falls back to the current approach
  4. idk suggest ur idea

automagically respond to messages

If a message has a number followed by AM or PM, or if it's in 24 hour fmt, like 24:00, respond with a timestamp if that user has registered their timezone, if not, ignore

For example:
me: I need to leave home at 8 AM tomorrow
Bot: timestamp
me: I return at 22:00
Bot: timestamp

collect, store, view, notify on metrics

all/most of this can be extracted to a lib, why is this an issue here then? idk

  1. collect and store metrics in a db periodically:
    • gateway latency
    • discord http latency (#47)
    • discord http ratelimit hits
  2. automate graphs:
    • create line graphs from all data periodically
    • serve them over prometheus
  3. notify:
    • periodically check the average of metrics in the last period, if it's above manually set thresholds, execute a webhook
    • periodically execute a webhook with the prometheus link (basically a reminder)

allow inline time conversation

for example

wanna watch something at 5pm

becomes

wanna watch something at <t:1648908000:t>

with the bot impersonating the sender using webhooks

also supports multiple times

wanna watch something between 5pm and 8pm?

becomes

wanna watch something between <t:1648908000:t> and <t:1648918800:t>?

Add me as a contributor so I can add blockquotes to your README

title!! I'm known for such great work as



anyway please do it & congrats on timezoner being added to so many servers!


P.S. I also feel like it could have more concrete separations between sections -- I think the main headers should probably he using h2s, and I'll probably neurotically label issues and stuff

inspect timezone being none in an interaction

backtrace:

core::option::Option<chrono::datetime::DateTime<chrono_tz::timezones::Tz>> is None

Stack backtrace:
   0: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   1: timezoner::interaction::<impl timezoner::Context>::handle_interaction::{{closure}}
   2: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   3: tokio::runtime::task::core::Core<T,S>::poll
   4: tokio::runtime::task::harness::Harness<T,S>::poll
   5: tokio::runtime::scheduler::multi_thread::worker::Context::run_task
   6: tokio::runtime::scheduler::multi_thread::worker::Context::run
   7: tokio::macros::scoped_tls::ScopedKey<T>::set
   8: tokio::runtime::scheduler::multi_thread::worker::run
   9: tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut
  10: tokio::runtime::task::core::Core<T,S>::poll
  11: tokio::runtime::task::harness::Harness<T,S>::poll
  12: tokio::runtime::blocking::pool::Inner::run
  13: std::sys_common::backtrace::__rust_begin_short_backtrace
  14: core::ops::function::FnOnce::call_once{{vtable.shim}}
  15: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9
      <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9
      std::sys::unix::thread::Thread::new::thread_start
             at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/unix/thread.rs:108:17
  16: start_thread
  17: clone

Add Ability to Toggle Auto Message React

Background/Rationale

My discord server has been loving this bot, however, there is one issue. This server is a speedrunning server and as such messages with speedrun times such as 2:52 or 1:35 are common. While these messages are not about time/timezone, they trigger the bot to react and allow people to convert the times, which gets a little annoying.

The Solution

The ability to turn off the automatic message reaction when a time is detected either as a user by user preference or as a server-wide setting.

timeout reaction waits

im stupid and i forgot, i realized when i saw it was using 86mb ram instead of the usual 4.7mb

allow non-message authors to convert times

when a user reacts on the message and the user isn't the message author, dm the user the message would include a footer saying if the author reacted on the message, the bot could "edit" the message itself

other time formating options

currently the bot demands date with year and current time in order to produce <t:1674613920:F> stamp which translates to "Tuesday, 24 January 2023 18:32"

but discord has several other time formatting options including:

f - 24 January 2023 18:32
R - in X days/hours / X hours/days ago
D - 24 January 2023
d - 24/01/2023
T - 18:32:00
t - 18:32

it would be great to be able to choose which format was desired - or even potentially multiple formats in a row (like F followed by R)

allow changing of automatic/manual conversion behavior

since the rewrite, the bot now adds a reaction to the message with time detected in it and waits for a reaction from the author to convert it, this is to reduce conversions where it doesn't make sense i.e i have to wake up at 5am tomorrow (sadly very commonly said sentence in our nightowlphobic world) while i still believe this is the good UX for most people, many people were upset by this change

add /toggle_automatic_conversion (where: sent by me | channel | server) command to toggle automatic conversion for messages sent by the user running the command (sent by me) or in the channel the command is ran in (channel) or in the server (server), the latter two choices requiring manage guild permission

add usage stats

  • track usage in the bot, in the database probably
  • show the usage in presence, updated periodically
  • show it in readme with an action probably
  • look into showing it in top.gg and app discovery

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.