Posts

Showing posts with the label discord

Random quote command remodel

Random quote command remodel I'm fairly new to JS, I found this piece of code for a Discord bot, and I was wondering how I could make it so when someone typed !quote, the response doesn't tag the user, and require additional text to be typed along with the command from the user. Thanks if (command == "quote") { if (args[1] != null) message.reply(quote[Math.floor(Math.random() * quote.length).toString(16)]); // if args[1], post random answer else message.channel.send("!quote <your text here>"); } Sorry, but the code you posted doesn't seem to have anything to do with your question. What user are you talking about? What command? – Mark Meyer Jul 1 at 6:52 I guess reply replies to the user, and channel.send sends a message to the channel?! I'm fairly new to JS .....

Why does on_message stop commands from working?

Why does on_message stop commands from working? Basically, everything appears to work fine and start up, but for some reason I can't call any of the commands. I've been looking around for easily an hour now and looking at examples/watching videos and I can't for the life of me figure out what is wrong. Code below: import discord import asyncio from discord.ext import commands bot = commands.Bot(command_prefix = '-') @bot.event async def on_ready(): print('Logged in as') print(bot.user.name) print(bot.user.id) print('------') @bot.event async def on_message(message): if message.content.startswith('-debug'): await message.channel.send('d') @bot.command(pass_context=True) async def ping(ctx): await ctx.channel.send('Pong!') @bot.command(pass_context=True) async def add(ctx, *, arg): await ctx.send(arg) The debug output I have in on_message actually does work and responds, and the whole bot run...