I have a python discord bot and I need it to get user input after a command, how can I do this? I am new to python and making discord bots. Here is my code:
import discord, datetime, time
from discord.ext import commands
from datetime import date, datetime
prefix = "!!"
client = commands.Bot(command_prefix=prefix, case_insensitive=True)
times_used = 0
@client.event
async def on_ready():
print(f"I am ready to go - {client.user.name}")
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name=f"{client.command_prefix}python_help. This bot is made by drakeerv."))
@client.command(name="ping")
async def _ping(ctx):
global times_used
await ctx.send(f"Ping: {client.latency}")
times_used = times_used + 1
@client.command(name="time")
async def _time(ctx):
global times_used
from datetime import date, datetime
now = datetime.now()
if (now.strftime("%H") <= "12"):
am_pm = "AM"
else:
am_pm = "PM"
datetime = now.strftime("%m/%d/%Y, %I:%M")
await ctx.send("Current Time:" + ' ' + datetime + ' ' + am_pm)
times_used = times_used + 1
@client.command(name="times_used")
async def _used(ctx):
global times_used
await ctx.send(f"Times used since last reboot:" + ' ' + str(times_used))
times_used = times_used + 1
@client.command(name="command") #THIS LINE
async def _command(ctx):
global times_used
await ctx.send(f"y or n")
times_used = times_used + 1
@client.command(name="python_help")
async def _python_help(ctx):
global times_used
msg = '\r\n'.join(["!!help: returns all of the commands and what they do.",
"!!time: returns the current time.",
"!!ping: returns the ping to the server."])
await ctx.send(msg)
times_used = times_used + 1
client.run("token")
I am using python version 3.8.3. I have already looked at other posts but they did not answer my question or gave me errors. Any help would be greatly appreciated!