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:
@bot.command(name='say')
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(' ');
message.channel.send(sayMessage);
}
Discord.py 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
Get Unique Values from Arraylist in Java
Save Child Objects Automatically Using JPA Hibernate
Remove Trailing Comma from Comma-Separated String
Better Way to Detect If a String Contains Multiple Words
How to Parse Json Boolean Value
Could Not Extract Resultset in Hibernate
Spring Junit: How to Mock Autowired Component in Autowired Component
@Responsebody , Responseentity Spring Return Object as Json
How to Find Distinct Rows With Field in List Using JPA and Spring
How to Click an Li Inside a Ul Using Selenium Webdriver
How to Skip the First Line of a CSV in Java
A Method to Check If a Collection or Map Is Empty or Null
Showing Morning, Afternoon, Evening, Night Message Based on Time in Java
Replace Whitespace in Json Keys
Arraylist - How to Check If an Index Exists
Set Zoom Level to 100% in Selenium Webdriver When Default Is Not 100