Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.shardcloud.app/llms.txt

Use this file to discover all available pages before exploring further.

Introduction

This guide covers creating and deploying Discord bots on Shard Cloud with examples in both Node.js and Python.

Creating a Discord Bot Application

1

Create Application

Go to the Discord Developer Portal and click “New Application”. Give your bot a name and create it.
2

Get Bot Token

Navigate to the “Bot” tab and click “Reset Token” to generate your bot token. Copy and save it securely.
3

Enable Intents

In the “Bot” tab, scroll to “Privileged Gateway Intents” and enable:
  • Presence Intent
  • Server Members Intent
  • Message Content Intent
Security: Never share your bot token publicly. It grants full control over your bot.

Creating Your Bot

Setup

npm init -y
npm install discord.js

Basic Bot Code

index.js
const { Client, GatewayIntentBits } = require('discord.js');

const client = new Client({
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
  ],
});

client.on('ready', () => {
  console.log(`Logged in as ${client.user.tag}!`);
});

client.on('messageCreate', (message) => {
  if (message.content === '!ping') {
    message.reply('Pong!');
  }
});

client.login('YOUR_BOT_TOKEN');

Package.json

package.json
{
  "name": "discord-bot",
  "version": "1.0.0",
  "main": "index.js",
  "dependencies": {
    "discord.js": "^14.0.0"
  }
}

Shard Cloud Configuration

.shardcloud
DISPLAY_NAME=Discord Bot
DESCRIPTION=My Discord Bot
MAIN=index.js
MEMORY=512
VERSION=recommended

Inviting Your Bot

  1. Go to the Developer Portal
  2. Select your bot → OAuth2URL Generator
  3. Check “bot” scope
  4. Select required permissions
  5. Copy and open the generated URL to invite your bot

Deploying

1

Prepare Your Files

Ensure you have:
  • Your bot code file
  • package.json (Node.js) or requirements.txt (Python)
  • .shardcloud
2

Exclude Unnecessary Files

Remove: node_modules/, __pycache__/, venv/
3

Create ZIP Archive

Compress your project folder.
4

Upload to Shard Cloud

Go to Shard Cloud Dashboard and upload.

Testing

After deployment, test your bot by sending !ping in a server where your bot is present. It should reply with “Pong!”.

Additional Resources

Troubleshooting

  • Verify your bot token is correct
  • Check that intents are enabled in Developer Portal
  • Review logs in the Shard Cloud dashboard
Re-invite your bot with the necessary permissions enabled.