How Would You Make a !!Say Command for a Discord Bot

How can I make a !say command for a discord bot

First, import all the libraries:

import discord
from discord.ext import commands

Then, set a prefix in this manner:

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

After that, you can use the following code:

async def say(ctx, *, content):
await ctx.send(content)

How can you make a "say" command on discord.js?

Use a combination of String#split(), Array#slice() and Array#join()

else if (command === 'say') {
const sayMessage = message.content.split(' ').slice(1).join(' ');;
} can you make a say command that goes into a specific channel be usable with the #?

It would probably be best to use ids (as you mentioned in your previous comments). You can use channel = bot.get_channel(channel_id) to get the channel object, and then call channel.send() on that. No intents should be necessary to simply get a channel. You just need to make sure that the bot has access to the channel and permission to send there.

Related Topics

Leave a reply