{"id":29770503,"url":"https://github.com/codingtrain/discord-bot-choo-choo","last_synced_at":"2026-03-15T01:44:16.511Z","repository":{"id":46085527,"uuid":"301537591","full_name":"CodingTrain/Discord-Bot-Choo-Choo","owner":"CodingTrain","description":"Coding Train Example Discord Bot","archived":false,"fork":false,"pushed_at":"2021-08-20T07:12:47.000Z","size":797,"stargazers_count":35,"open_issues_count":3,"forks_count":13,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-27T05:54:00.575Z","etag":null,"topics":["discord","discord-bot","discord-js","discordbot","discordjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CodingTrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-05T20:55:54.000Z","updated_at":"2025-07-03T00:16:10.000Z","dependencies_parsed_at":"2022-09-23T06:51:43.007Z","dependency_job_id":null,"html_url":"https://github.com/CodingTrain/Discord-Bot-Choo-Choo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CodingTrain/Discord-Bot-Choo-Choo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingTrain%2FDiscord-Bot-Choo-Choo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingTrain%2FDiscord-Bot-Choo-Choo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingTrain%2FDiscord-Bot-Choo-Choo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingTrain%2FDiscord-Bot-Choo-Choo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodingTrain","download_url":"https://codeload.github.com/CodingTrain/Discord-Bot-Choo-Choo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodingTrain%2FDiscord-Bot-Choo-Choo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30526381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-15T00:42:01.247Z","status":"ssl_error","status_checked_at":"2026-03-15T00:42:00.300Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["discord","discord-bot","discord-js","discordbot","discordjs"],"created_at":"2025-07-27T05:09:56.253Z","updated_at":"2026-03-15T01:44:16.503Z","avatar_url":"https://github.com/CodingTrain.png","language":"JavaScript","readme":"# Choo Choo Discord Bot!\n\n[\u003cimg src=\"https://i.ytimg.com/vi/7A-bnPlxj4k/maxresdefault.jpg\" alt=\"Discord Bot Tutorial\" width=\"320\"\u003e](https://www.youtube.com/playlist?list=PLRqwX-V7Uu6avBYxeBSwF48YhAnSn_sA4)\n\n🚂🌈💖🤖 All aboard! [Coding Train Tutorial Videos](https://www.youtube.com/playlist?list=PLRqwX-V7Uu6avBYxeBSwF48YhAnSn_sA4) 🚂🌈💖🤖\n\n## Steps to create new bot \n\n1. Create node project and install discord.js module.\n\n```\n$ npm init\n$ npm install discord.js\n```\n\n2. [Create an application](https://discord.com/developers/applications/) - optionally set name, description, avatar.\n\n3. Select Bot from left navigation and \"Add Bot\" - set name and icon.\n\n4. Add bot to the A2Z server with the url: `https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID\u0026scope=bot`\n\n5. Write the code!\n\nLogin to bot account:\n```javascript\nconst Discord = require('discord.js');\nconst client = new Discord.Client();\nclient.login('YOUR BOT TOKEN');\n```\n\nCallback for when the bot is connected and ready:\n```javascript\nclient.once('ready', () =\u003e {\n  console.log('Ready!');\n});\n```\n\nCallback for when a message is posted:\n```javascript\nclient.on('message', gotMessage);\n\nfunction gotMessage(msg) {\n  console.log(msg.content);\n}\n```\n\n9. Run the bot!\n\n```\n$ node index.js\n```\n\n## Limit to one server and one channel\n\n1. Enable developer mode in Discord (Settings-\u003eAppearance-\u003eEnable Developer Mode).\n2. Copy server ID.\n3. Copy channel ID.\n\n```javascript\nconst serverID = 'SERVER ID';\nconst channelID = 'CHANNEL ID';\n\nclient.on('message', gotMessage);\n\nfunction gotMessage(msg) {\n  // Only for this server and this channel\n  if (msg.guild.id === serverID \u0026\u0026 msg.channel.id === channelID) {\n    // Reply to the message ping!\n    if (msg.content === 'ping') {\n      msg.channel.send('pong');\n    }\n  }\n}\n```\n\n## Store token and other secrets in .env file.\n\n1. Install [dotenv package](https://www.npmjs.com/package/dotenv).\n```\n$ npm install dotenv\n```\n\n2. Create `.env` file:\n\n```\nSERVERID=123456789\nCHANNELID=123456789\nTOKEN=123456789\n```\n\n3. Load environment variables using `dotenv` and `.env`:\n\n```javascript\nrequire('dotenv').config();\nconst serverID = process.env.SERVERID;\nconst channelID = process.env.CHANNELID;\nconst TOKEN = process.env.TOKEN;\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingtrain%2Fdiscord-bot-choo-choo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingtrain%2Fdiscord-bot-choo-choo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingtrain%2Fdiscord-bot-choo-choo/lists"}