All Projects → screepers → screeps_notify

screepers / screeps_notify

Licence: MIT License
Send messages (SMS, Slack) from inside Screeps Scripts

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects
Makefile
30231 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to screeps notify

aliyun-sms
阿里云 SMS 短信 Java SDK 封装
Stars: ✭ 67 (+219.05%)
Mutual labels:  sms
fake-sms-notifier
Fake SMS (as email during development) Notifier Bridge
Stars: ✭ 16 (-23.81%)
Mutual labels:  sms
go sgip
This is an implementation of SGIP 1.2 for Go
Stars: ✭ 17 (-19.05%)
Mutual labels:  sms
mimo-ce
MIMO Community Edition
Stars: ✭ 20 (-4.76%)
Mutual labels:  sms
SlackWebhooksGithubCrawler
Search for Slack Webhooks token publicly exposed on Github
Stars: ✭ 21 (+0%)
Mutual labels:  slack-webhook
vonage-node-code-snippets
NodeJS code examples for using Nexmo
Stars: ✭ 46 (+119.05%)
Mutual labels:  sms
totalvoice-php
Client em PHP para API da Totalvoice
Stars: ✭ 30 (+42.86%)
Mutual labels:  sms
screeps-obsolete
Obsolete - Codebase for screeps game.
Stars: ✭ 16 (-23.81%)
Mutual labels:  screeps
jasmin-web-panel
📨 Jasmin Web Panel for Jasmin SMS Gateway
Stars: ✭ 33 (+57.14%)
Mutual labels:  sms
go-mitake
A Mitake SMS library for Golang
Stars: ✭ 15 (-28.57%)
Mutual labels:  sms
smpp.net
Short Message Peer-to-Peer (SMPP) .NET library
Stars: ✭ 29 (+38.1%)
Mutual labels:  sms
slack-texts
SMS notifications for Slack groups
Stars: ✭ 19 (-9.52%)
Mutual labels:  sms
sms
高可用短信微服务
Stars: ✭ 57 (+171.43%)
Mutual labels:  sms
mobizon-node
Biblioteca NodeJS para trabalhar com os serviços Mobizon API
Stars: ✭ 17 (-19.05%)
Mutual labels:  sms
owt
Update Version 3.1 added free SMS messaging.
Stars: ✭ 339 (+1514.29%)
Mutual labels:  sms
sample-template-nodejs
A template repository serving as the base for new Twilio sample apps
Stars: ✭ 16 (-23.81%)
Mutual labels:  sms
SnorkTracker
GPS IoT tracker board for scanning gps and environment information and sending this to a MQTT server via GPRS.
Stars: ✭ 38 (+80.95%)
Mutual labels:  sms
ionic-native-sms-retriever-plugin-master
Cross-platform plugin for Cordova / PhoneGap to Retrieve SMS. Available for Android.
Stars: ✭ 16 (-23.81%)
Mutual labels:  sms
uptime.js
Uptime monitor in Node.js that send status changes to Chatbots
Stars: ✭ 52 (+147.62%)
Mutual labels:  slack-webhook
sms
API server to send SMS using GSM modem. Written in Go
Stars: ✭ 26 (+23.81%)
Mutual labels:  sms

screeps_notify

This project allows players to send text message alerts from inside their Screeps scripts.

Requirements

This project depends on Twilio for sending SMS. You will need an account, which will end up costing $1 a month plus an additional $0.0075 per text message.

Settings

The settings file is a yaml file. Begin by copying the settings.dist file to .settings.yaml in the directory you will be calling notify.py from.

cp .settings.dist.yaml .settings.yaml

Screeps Settings

This project works with authorization tokens that have the /api/user/memory permission. If you are using the ivm module it will need "full permissions" (see below).

# Screeps account info
screeps_token:'6c4c2aac-6247-4dff-b4b8-fc456a720d62'
screeps_ivm: true
screeps_ptr: false

If you are using the ivm engine the Screeps Notify Server will also run a console command to remove sent messages. This is important because many users on the ivm engine do not reparse memory each tick, so memory based API calls do not work.

Define Services

Services are used by the system to send messages. Currently there are three service types (HTTP, Slack, and SMS), each of which can be used multiple times (for instance, you can define multiple slack hooks to send different types of messages to different channels).

services:

  sms:
    # Set driver to twilio
    type: sms

    # Your Account SID from www.twilio.com/console
    twilio_sid:

    # Your Auth Token from www.twilio.com/console
    twilio_token:

    # You SMS number from twilio. https://www.twilio.com/console/phone-numbers/dashboard
    sms_from: '+15555555555'

    # This should be the number you want to receive the texts.
    sms_to: '+15555555555'

  alliance:
    # Set driver to HTTP
    type: http

    # Specify a url
    url: https://example.execute-api.us-east-1.amazonaws.com/prod/service

    # Provide an API key for AWS Gateway (optional)
    api-key:

  logs:
    # Set driver to HTTP
    type: http

    # Specify a url
    url: https://example.execute-api.us-east-1.amazonaws.com/prod/service

    # Provide an API key for AWS Gateway (optional)
    api-key:

  slack:
    # Set driver to SLACK
    type: slack

    # Specify a url
    webhook_url:

    # Optionally set a channel. If not set the webhook default will be used.
    channel:

    # Optionally set a username.
    username:

    # Optionally specify an emoji as a user icon
    icon_emoji:

Define Groups

Groups define which services get used when a notification is sent. At a minimum a default group should be set.

Groups can either be an array of services or the string all (which will make sure the group sends a message to all available services).

groups:

  default:
    - sms
    - logs
    - slack

  economy:
    - sms
    - logs

  defense: all

Installation

vagrant

This service can be enabled on a desktop machine using vagrant. First setup the configuration file as per the instruction below, then provision the machine.

vagrant up

docker

  1. Clone the repository.
  2. Copy settings file - cp .screeps_settings.dist.yaml .settings.yaml
  3. Edit settings with the appropriate API keys.
  4. Build your docker image- docker build -t screepsnotify .
  5. Test to make sure it works- docker run --rm screepsnotify
  6. Add a cronjob to call docker run --rm screepsnotify as often as you wish.

Self Hosting

  1. Download - wget $(curl -L -s https://api.github.com/repos/screepers/screeps_notify/releases/latest | grep tarball_url | head -n 1 | cut -d '"' -f 4) -O screepsnotify.tgz
  2. Unpack - mkdir screepsnotify; tar zxvf screepsnotify.tgz -C ./screepsnotify --strip 1.
  3. Move - sudo mv screepsnotify /opt/screepsnotify.
  4. Change Directory - cd /opt/screepsnotify
  5. OPTIONAL: Install Dependencies sudo ./provisioning/provision.sh.
  6. Configure - cp .screeps_settings.dist.yaml .screeps_settings.yaml and then edit.
  7. Build - make
  8. Install - sudo make install

AWS Lambda

Even when run every second the load is more than low enough to qualify for the free tier.

  1. Clone the repository.
  2. Copy settings file - cp .screeps_settings.dist.yaml .settings.yaml
  3. Edit settings with the appropriate API keys.
  4. Build the lambda package- make lambda
  5. Upload zip to lambda using notify.lambda_handler as the handler

Running

To run the program simply call notify.py from the directory your local settings are in. You may simply wish to add this to a cronjob.

$ ./screeps_notify/notify.py

Sending Notifications from Screeps

This project includes a javascript module named 'Notify' that is used to queue messages to be sent.

Notify = require('notify.js')

// Will send immediately
Notify('Test Message')

// Will send immediately, but only once every 100 ticks.
Notify('Rate Limited Message', 100)

// Will send only to the economy group services, and only once every 100 ticks.
Notify('Rate Limited Group Message', 100, ['economy'])

// Will send immediately but only to the defense group services
Notify('Rate Limited Group Message', false, ['defense'])

Cleanup

In order to make the rate limiting work copies of rate limited messages are kept in memory. The Notify module has a function to clean this up.

Notify = require('notify.js')
Notify.clean()

Thanks!

Special thanks to dhzu for putting together the python code to access the Screeps API .

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].