Project

syodosima

0.0
No release in over 3 years
There's a lot of open issues
A Ruby gem that sends notifications to a Discord channel about events from a specified Google Calendar.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

>= 2.7.2
>= 5.26.0
>= 13.3.0
>= 1.81.1
>= 0.57.0

Runtime

>= 3.5.0
>= 3.1.8
>= 0.2.0
>= 1.9.1
 Project Readme

Syodosima

Syodosima gem is a tool to notify Discord of appointments on a given Google Calendar and provides a CLI wrapper.

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add syodosima

If bundler is not being used to manage dependencies, install the gem by executing:

gem install syodosima

For manual installation, follow these steps.

  1. Clone the repository:
git clone https://github.com/Desert-sabaku/syodosima.git
cd syodosima
  1. Install dependencies:
bundle install

Usage

Syodosima automatically retrieves today's appointments from Google Calendar and sends notifications to a Discord channel.

Features

  • Automatically retrieve today's appointments from Google Calendar
  • Properly display timed events and all-day events
  • Send notifications to Discord channels
  • Support for automatic execution in GitHub Actions

Configuration

Google Calendar API Setup

  1. Create a new project in Google Cloud Console
  2. Enable Google Calendar API
  3. Create credentials (OAuth 2.0 Client ID)
  4. Download the credentials.json file

Discord Bot Setup

  1. Create a new application in Discord Developer Portal
  2. Create a bot and obtain the token
  3. Invite the bot to the server and obtain the channel ID

Environment Variable Setup

Please set the following environment variables:

For Local Execution

Create a .env file and describe the following:

DISCORD_BOT_TOKEN=your_discord_bot_token_here
DISCORD_CHANNEL_ID=your_channel_id_here
GOOGLE_CREDENTIALS_JSON={"type":"service_account","project_id":"..."}  # contents of credentials.json
GOOGLE_TOKEN_YAML=credentials_yaml_content_here  # contents of token.yaml

For GitHub Actions Execution

Set the following secrets in GitHub repository Settings > Secrets and variables > Actions:

  • DISCORD_BOT_TOKEN: Discord Bot token
  • DISCORD_CHANNEL_ID: Discord channel ID to send notifications to
  • GOOGLE_CREDENTIALS_JSON: Contents of credentials.json file
  • GOOGLE_TOKEN_YAML: Contents of token.yaml file

Running the Application

Local Execution

  1. For the first run, Google authentication is required. First, launch irb:
irb(main):001> require "syodosima"
=> true
irb(main):002> Syodosima.run
  1. Perform Google authentication in the browser and enter the displayed code in the console
  2. Authentication information will be saved in token.yaml

Important

Do you have a .env file in the current directory? Without this, syodosima will not work!

For manual installation, use the rake task instead of irb.

bundle exec rake run:once

Note

This rake task internally calls Syodosima.run.

Automatic Execution in GitHub Actions

Create a GitHub Actions workflow file (e.g., .github/workflows/notify.yml):

name: Daily Calendar Notification

on:
    schedule:
        - cron: "0 0 * * *" # Run daily at 0:00 (UTC)
    workflow_dispatch: # Manual execution also possible

jobs:
    notify:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - uses: ruby/setup-ruby@v1
              with:
                  ruby-version: "3.4"
            - name: Install dependencies
              run: bundle install
            - name: Run notification bot
              run: bundle exec rake run:once
              env:
                  DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
                  DISCORD_CHANNEL_ID: ${{ secrets.DISCORD_CHANNEL_ID }}
                  GOOGLE_CREDENTIALS_JSON: ${{ secrets.GOOGLE_CREDENTIALS_JSON }}
                  GOOGLE_TOKEN_YAML: ${{ secrets.GOOGLE_TOKEN_YAML }}

Notification Example

Example of messages sent by the bot:

Good morning!
I'll let you know today's schedule.

【09:00〜10:00】 Team Meeting
【13:00〜14:00】 Project Review
【All Day】 Holiday

Notes

  • Google authentication is required for the first run
  • Timezone follows system settings
  • Only appointments from the primary calendar in Google Calendar are retrieved

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/desert-sabaku/syodosima. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.