Discord Multi Channel Message Bot

 import os
import discord
from discord.ext import commands
from discord.ext.commands import has_permissions

intents = discord.Intents.all()
intents.members = True

bot = commands.Bot(command_prefix='!', intents=intents)

# List to store multiple channel IDs
multi_channel_ids = []

async def add_channel(ctx, channel: discord.TextChannel):
    if channel.id not in multi_channel_ids:
    await ctx.send(f'Channel {channel.mention} added to the multiple msg channel list.')

async def remove_channel(ctx, channel: discord.TextChannel):
    if channel.id in multi_channel_ids:

About this template

This bot is designed to perform a variety of tasks on Discord. It can add or remove channels from a list of channels to which it can send messages. It can send a message to all channels in this list. Before sending a message, it will ask for confirmation. The bot token(DISCORD_BOT_TOKEN) is securely taken from environment variables .

Introduction to the Discord Multi Channel Message Bot Template

Welcome to the Discord Multi Channel Message Bot template! This template is designed to help you create a Discord bot that can manage a list of channels and send messages to all of them with a single command. This is particularly useful for server administrators who need to broadcast announcements or updates across multiple channels efficiently.

Getting Started with the Template

To begin using this template, simply click on the "Start with this Template" button. This will set up the template in your Lazy builder interface, pre-populating the code so you can start customizing and deploying your bot without any hassle.

Initial Setup

Before you can test and use your bot, you need to set up an environment secret for your Discord bot token. This token allows your bot to interact with the Discord API.

  • Go to the Discord Developer Portal and create a new application.
  • Under the "Bot" tab, click "Add Bot" and confirm the creation.
  • Copy the token provided for your new bot.
  • In the Lazy Builder interface, navigate to the Environment Secrets tab.
  • Create a new secret with the key `DISCORD_BOT_TOKEN` and paste your bot token as the value.

Test: Pressing the Test Button

Once you have set up your environment secret, you can press the "Test" button. This will deploy your application and launch the Lazy CLI. The CLI will not prompt for any user input at this stage, as the bot uses commands within Discord to operate.

Using the App

After testing and deploying your bot, you can invite it to your Discord server using the OAuth2 URL generated in the Discord Developer Portal. Once the bot is in your server, you can use the following commands:

  • !add_channel #channel-name - Adds a channel to the list of channels where messages will be sent.
  • !remove_channel #channel-name - Removes a channel from the list.
  • !send_message Your message here - Sends a message to all channels in the list after confirmation.

Note: These commands require administrator permissions to use.

Integrating the App

There are no additional external integration steps required for this template. Once your bot is added to your Discord server and you have set up the environment secret with your bot token, you are ready to use the bot's commands to manage your message distribution across multiple channels.

If you need further assistance or have any questions, refer to the discord.py documentation for more details on how to customize and enhance your bot's capabilities.

Last published
June 15, 2024

More templates like this

PDF Data Extraction and Excel Transfer

An app for extracting name, phone number, and email data from PDF files and transferring it to Excel.


Discord Ticketbot Template

A simple Discord Ticketbot for your Discord Support Department. This Template and Bot is fully customizable but already build so that you can use it right away. You need a bot token from https://discord.com/developers/applications for your bot to work. These are the steps needed to get your token: "1. 🌐 Go to the Discord Developer Portal. 🌐\n" + "2. 🆕 Create a new application and navigate to the 'Bot' section. 🤖\n" + "3. 📋 Under the 'TOKEN' section, click 'Reset Token' to get your Discord bot token and confirm by clicking 'Yes, do it'. 🔑\n" + "4. 🤖 If your bot will have any ability to read/reply to messages, then under the 'BOT' section, enable the slider titled 'Message Content Intent' ✅" + "5. 🔐 Set the 'DISCORD_BOT_TOKEN' in the Env Secrets tab with your bot token from step 3. 🔐\n" + "For bot permissions, it's recommended to start with basic permissions and adjust as needed for your app's functionality.🚀") If you encounter any bugs, please tell Lazy to fix them and report them on the Official Lazy AI Discord to @D4vidG4merLP. Credits: @meow - the Discord bot slash command template @mrlazy.notlazy - supporting me And the Biggest Thank you. You for using this template ❤️


GPT-4 Exam Generator

This app uses GPT-4 to generate a PDF of a new exam based on an uploaded PDF of a past exam.

Discord Multi Channel Message Bot