Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from discord.ext import commands
- import discord
- _cd = commands.CooldownMapping.from_cooldown(1.0, 60.0, commands.BucketType.member)
- #Bot command prefix, I set to c? for now, I'll change if they want me to.
- bot = commands.Bot(command_prefix='c?')
- bot.remove_command("help")
- authorid = user.id
- #Above allows for the things to work, and removes the already existing default help command, to be custom.
- @bot.event
- async def on_ready():
- print("Logged in as {0.user}".format(bot))
- @bot.event
- async def on_message(message):
- if message.author == bot.user:
- return
- await bot.process_commands(message)
- if message.content.startswith("c?hello"):
- await message.channel.send("Hello!")
- #Above are a few of "trigger test commands", these are not commands, however are executed if a message starts with the content
- #specified.
- #Please do notice that I will be coding mostly private bots.
- # Syntax for command. (For myself)
- #@bot.command()
- #async def commandname(ctx, arg):
- # await ctx.send(arg)
- @bot.command()
- async def ping(ctx):
- await ctx.send("Pong! Bot latency is {0}".format(round(bot.latency, 1)))
- #Above is the ping check command, this also specifies the latency.
- @bot.command()
- async def easteregg(ctx):
- await ctx.send("You have discovered a bot easter egg!")
- #Below is the say command, which repeats the user's arguments, in this case, quotes will NOT be required for more than 1 word.
- #The setmodmail command currently does NOT work, these commands are IN PROGRESS, and may possibly be cancelled due to the fact
- #they may be useless.
- @bot.command()
- async def say(ctx, *, message: str):
- await ctx.send(message)
- @bot.command()
- async def help(ctx):
- await ctx.author.send("Thanks for using this bot, a list of available commands are: \
- `ping, say, help, apply, submit, modmail`. \
- Help Command: This! \
- Say Command: Makes the bot say things. \
- Ping Command: Checks and gives you the bot latency.\
- Apply: Shows you the application.\
- Submit: Submit your application.\
- ")
- # The backslash creates a new line, making it easier for me to write it in a great format. This directly messages the person who
- #executed the command.
- @bot.command()
- async def apply(ctx):
- await message.author.send("This server's set application is: TEXT.\
- Submit by running `submit <application>`.)
- #The application above is not customizable through commands, I'll be mostly creating private bots, and upon request, I will set
- #up their applications the way they want, although this bot is just an example. I'll also be hired for VERY cheap, and they'll
- #the code, however I will not host the bot for them, rather give them the code they need and tell/show them how to host it.
- #I will add a command that allows them to change the application, rather than having to tweak the code if requested. Enough of
- #that, here's the submit command.
- @bot.command()
- async def submit(ctx, *, appsubmit: str):
- channel = client.get_channel("Channel's id. I'll replace it for them, read comments though")
- await channel.send('Application received from <@' + authorid '>:'\
- + appsubmit)
- #I use bot.run rather than client.run, because I use bot rather than client. The login is still successful.
- #The app submit looks pretty weird, this will mention the submitter, which gives their permanent ID and username may show.
- #I do know authorid is not valid, however if you look, there's a variable.
- bot.run('bottoken')
Add Comment
Please, Sign In to add comment