Discord Suggestions Bot

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

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

# Global variable to store suggestion channel ID
suggestion_channel_id = None

async def suggest(ctx, *, suggestion: str):
    # Send suggestion to a designated channel or log it elsewhere
    # If suggestion_channel_id is None, use a channel named 'suggestions'
    channel = bot.get_channel(suggestion_channel_id) if suggestion_channel_id else discord.utils.get(ctx.guild.channels, name='suggestions')
    if channel:
        await channel.send(f'Suggestion from {ctx.author.mention}: {suggestion}')

async def set_suggestion_channel(ctx, channel: discord.TextChannel):
    global suggestion_channel_id
    suggestion_channel_id = channel.id

About this template

The Discord Suggestions Bot is designed to manage suggestions on Discord. The suggester can perform the following commands: - !suggest : Sends a suggestion to a designated channel. - !set_suggestion_channel : Sets the default suggestion channel. The bot token is securely stored in environment variables and requires the DISCORD_BOT_TOKEN to work properly.

Introduction to the Discord Suggestions Bot Template

Welcome to the Discord Suggestions Bot template! This bot is designed to streamline the process of collecting and managing suggestions within your Discord server. With this template, you can easily set up a bot that allows users to submit suggestions using a simple command. Additionally, administrators can designate a specific channel for collecting these suggestions. Let's get started on how to use this template to enhance your Discord community's experience.

Clicking Start with this Template

To begin using the Discord Suggestions Bot template, click on the "Start with this Template" button. This will initialize the template within the Lazy platform, pre-populating the code necessary for your bot.

Initial Setup

Before you can test and deploy 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.

  1. Go to the Discord Developer Portal and create a new application.
  2. Under the "Bot" tab, click "Add Bot" and confirm the creation.
  3. Copy the token provided for your new bot.
  4. Within the Lazy platform, navigate to the Environment Secrets tab.
  5. Create a new secret with the key `DISCORD_BOT_TOKEN` and paste the token you copied as the value.

With the environment secret set, your bot is now ready to connect to Discord.

Test: Pressing the Test Button

After setting up your environment secret, press the "Test" button. This will deploy your application and start the bot. You will not need to provide any additional input at this stage.

Using the App

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

  • !suggest <suggestion>: Allows users to submit a suggestion. The bot will send this suggestion to a designated channel or a default channel named 'suggestions' if no channel has been set.
  • !set_suggestion_channel <#channel>: Administrators can use this command to set the default channel for collecting suggestions.

Integrating the App

After testing the bot and confirming it works as expected, you can start using it within your Discord server. There is no further external integration required for the bot to function. However, ensure that the bot has the necessary permissions to read messages and send messages in the designated suggestions channel.

That's it! You've successfully set up the Discord Suggestions Bot using the Lazy template. Your server members can now easily submit their suggestions, and you can manage them effectively in one place.

Last published
July 20, 2024

More templates like this

AlphaBot Financial Summary

AlphaBot Financial Summary: A Discord bot that utilizes the Alpha Vantage API to provide AI-generated summaries of income statements, balance sheets, and cash flow for renowned US companies.


Discord Moderation Bot

The Discord bot monitors all messages in the server. If a message contains profanity, the bot deletes it and sends a warning to the channel. The bot also notifies the host about the deletion via a direct message. Additionally, the bot outputs a helpful error message to a channel if there is a permissions error, guiding the server admin to enable the required permission in the Discord Developer portal.


Discord Bot

This powerful app skeleton is a great starting place for a Discord bot

Discord Suggestions Bot