Telegram Bot for Cinnamon College. Telegram
- Show NUS Internal Shuttle Bus Timings 🚍
/nusbus
- Show Singapore Public Bus Timings 🚍
/publicbus
- Check facilities booking/events in Cinnamon College 🏫
/spaces
- 2h Weather Forecast based on your location. ☀️ ☔
/weather
- Lost? View maps of various parts of NUS 🏫
/map
- Check laundry machine availability in Cinnamon College 👕
/laundry
Got a feature to suggest? 💡 Bug to report? 🐛 You are welcome to file an issue here.
We will first need to install git and golang. First install git using your favourite package manager:
sudo apt install git
brew install git
Then, install Golang version 1.15. You can either download it from the official website or download it using a package manager (remember to check the go version provided by the package manager).
For Linux systems, you can follow the steps if you downloaded go from the website:
cd Downloads # or wherever you downloaded the file
sudo tar -C /usr/local -xzf go1.15.2.linux-amd64.tar.gz
# change the lines below to the shell you are using
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
source ~/.bashrc
To verify that Golang is installed properly:
$ which go # only for Mac/Linux
/usr/local/go/bin/go # it's okay for this to differ, it just shouldn't be blank
$ go version
go version go1.15.2 linux/amd64 # version, operating system/architecture
Go the the directory where you want to store the cinnabot code, and run this command to download the cinnabot repository into a new directory called 'cinnabot':
git clone https://github.com/usdevs/cinnabot.git
# or [email protected]:usdevs/cinnabot.git if you are using a ssh key
Voila! Now we have cinnabot on our machine. Ready to go!! 🎉
Overview:
All instructions below assume you are at the cinnabot root path, unless stated otherwise.
Ask for the blessings of the Botfather here, as you register for one of the bots.
You will be provided, with honor, an API token where you should put into main/config.json
.
In other words, click on the link and choose a Telegram handle for your bot, which ends with ...bot
and is not taken yet. Once you are done, you will be provided with the API Token.
Then, we create our config.json
file using the example file config.json.example
, and replacing the dummy API Token with the one we just registered.
cd main
cp config.json.example config.json
Fire up your favourite text editor and replace the dummy string in config.json
with your API Token as a string.
cd main
go run main.go
And start testing! Fire up your favourite Telegram client, and find the bot by the name you registered it with. You can now test all cinnabot functionalities on your testbot.
When you are done, press Ctrl+C on your terminal to end testing.