Celestial_Dodo

Discord commands help me please

Jun 10th, 2023
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1.  
  2. ## Imports
  3.  
  4. from replit import db
  5. import discord
  6. from discord.ext import commands
  7. import os
  8. import random
  9. import json
  10. from keep_alive import keep_alive
  11. import time
  12.  
  13. keep_aliveVal = 0
  14.  
  15. TOKEN = os.environ['BOT_TOKEN']
  16.  
  17. ## Prefix
  18.  
  19. bot = commands.Bot(command_prefix="/",intents=discord.Intents.all())
  20.  
  21. ## Removes default commands
  22.  
  23. bot.remove_command('help')
  24.  
  25. ## Adds new default commands
  26.  
  27.  
  28.  
  29. ## Examples
  30.  
  31. @bot.command()
  32. async def hello(ctx):
  33. TimesUsed = db[ctx.message.author,1]
  34. db[ctx.message.author,1]
  35. await ctx.channel.send(ctx.author.mention," has used this command ",TimesUsed," Times")
  36.  
  37. @bot.command()
  38. async def help(ctx):
  39. embed = discord.Embed(title="Help Command!", description="'test' - a test command", color=discord.Color.random())
  40. await ctx.channel.send(embed=embed)
  41.  
  42. @bot.command()
  43. async def test(ctx):
  44. await ctx.channel.send("This is a test command!")
  45.  
  46. ## Run
  47.  
  48. # Keeps bot running for one hour then the bot automatically turns off
  49.  
  50. keep_alive()
  51.  
  52. bot.run(TOKEN)
  53.  
Advertisement
Add Comment
Please, Sign In to add comment