Menu

Learn how to start playing on JartexNetwork in just 60 seconds!
Play Now
Learn how to join our server
and start playing in 60 seconds
Play Now
CLICK TO JOIN JOIN OUR DISCORD
0
0

Imagine A communtiy Guided bot

not_Nuggets

Addicted Member
Banned
Donator
Joined
August 14, 2020
Messages
2,123
Points
249
Age
18
IGN
not_Nuggets
Part 2


Python:
# Directory : C:\User\name\Desktop\Jartex Community Bot\bot.py
import discord
from discord.ext import commands

bot = commands.Bot(command_prefix="?", description="A JartexNetwork Community Bot", case_insensitive=true)


@bot.event
async def on_ready():
    print("Python is better than JS")
 

@bot.command()
async def hello(ctx):
    await ctx.send("Hello " + ctx.author.mention + "!")
    # this can be done in a much simpler way. But the above is just basic code
    #"complex code"
    # await ctx.send(f"Hello {ctx.author.mention}!")
 
    # Output: Hello @Nuggets#0001!
  
# Loading Cogs
for filename in os.listdir('./cogs'):
    if filename.endswith('.py'):
        bot.load_extension(f'cogs.{filename[:-3]}')

      
      
bot.run("token")


Python:
# Directory : C:\User\name\Desktop\Jartex Community Bot\cogs\Moderation.py

import discord
from discord.ext import commands


class Moderation(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
      
      
# Now making commands

@commands.command()
async def ban(self, ctx, member : discord.Member, *, reason=None):
    if reason is None:
        reason = "No reason given."
    await member.ban(reason=reason)
    await ctx.send(f"{ctx.author.mention} has banned {member} from the server!")
  
    # Using ?ban @TestAccount
    # @Nuggets has banned TestAccount#1234 from the server!
    # Ban reason = No reason given
  
    # Using ?ban @TestAccount lmao
    # @Nuggets has banned TestAccount#1234 from the server!
    # Ban reason = lmao
def setup(bot):
    bot.add_cog(Moderation(bot))
 
Last edited:

Top