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 OAuth client credentials JSON

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 add the following content:

DISCORD_BOT_TOKEN=your_discord_bot_token_here
DISCORD_CHANNEL_ID=your_channel_id_here
# Paste the OAuth client credentials JSON from Google Cloud Console
GOOGLE_CREDENTIALS_JSON={"installed":{"client_id":"...","client_secret":"...","redirect_uris":["http://localhost"]}}

Important

Browser authentication is required on first run only. After authentication, token information will be displayed. Save it to .env as GOOGLE_TOKEN_YAML_BASE64.

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: OAuth client credentials JSON from Google Cloud Console
  • GOOGLE_TOKEN_YAML_BASE64: Base64-encoded token displayed after first authentication

Running the Application

Local Execution

First run (browser authentication required):

bundle exec rake run:once

After authentication, token information will be displayed in the console:

======================================================================
認証が完了しました。以下のトークンを.envファイルに保存してください:
----------------------------------------------------------------------
GOOGLE_TOKEN_YAML_BASE64=LS0tCmRlZmF1bHQ6IC4uLg==
----------------------------------------------------------------------

.envファイルに自動で保存しますか? (y/N):
======================================================================

If you enter y, the token will be automatically saved to your .env file. If you enter N or want to save manually, add the displayed GOOGLE_TOKEN_YAML_BASE64=... line to your .env file.

Subsequent runs (no re-authentication needed):

bundle exec rake run:once

To fetch events for a specific date:

DATE=2025-12-25 bundle exec rake run:date

Important

Once you set GOOGLE_TOKEN_YAML_BASE64 in .env, you can run without browser authentication.

Tip

If you want to suppress websocket-related log messages from the Discord library, you can filter them using grep:

bundle exec rake run:once 2>&1 | grep -v '\[.*websocket\|et-[0-9]\+'

Running with irb

If installed as a gem:

irb
irb(main):001> require "syodosima"
=> true
irb(main):002> Syodosima.run                    # Today's events
irb(main):003> Syodosima.run(Date.new(2025, 12, 25))  # Specific date

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.