Update Smayzou.py

This commit is contained in:
Smayzy 2025-02-25 11:36:52 +00:00
parent 96a14f7733
commit 14707e4363

View File

@ -1,102 +1,102 @@
print("Bot starting ...") print("Bot starting ...")
import discord import discord
from discord.ext import commands from discord.ext import commands
import random import random
TOKEN = "Your TOKEN" TOKEN = "your_TOKEN"
intents = discord.Intents.all() intents = discord.Intents.all()
client = commands.Bot(command_prefix='/', intents=intents) client = commands.Bot(command_prefix='/', intents=intents)
@client.event @client.event
async def on_ready(): async def on_ready():
print("[INFO] Bot is ready !") print("[INFO] Bot is ready !")
@client.command() @client.command()
async def help_command(ctx): async def help_command(ctx):
"""Display a list of avalible commands of Smayzou""" """Display a list of avalible commands of Smayzou"""
command_list = [ command_list = [
"/help - Display this help message", "/help - Display this help message",
"/kick - Kick a member", "/kick - Kick a member",
"/ban - ban a member", "/ban - ban a member",
"/unban - Unban a member", "/unban - Unban a member",
"/nickname - Change your name", "/nickname - Change your name",
"/ping - View the ping", "/ping - View the ping",
"/question - You say question and I say yes or no", "/question - You say question and I say yes or no",
"/slowmode - Set slowmode in this channel", "/slowmode - Set slowmode in this channel",
"/vote - Create a vote" "/vote - Create a vote"
] ]
await ctx.respond("Here's a list of available commands:\n```{}```".format('\n'.join(command_list))) await ctx.respond("Here's a list of available commands:\n```{}```".format('\n'.join(command_list)))
@client.command() @client.command()
async def kick(ctx, user:discord.User, reason): async def kick(ctx, user:discord.User, reason):
"""Kick a member""" """Kick a member"""
if ctx.author.guild_permissions.kick_members: if ctx.author.guild_permissions.kick_members:
await ctx.guild.kick(user) await ctx.guild.kick(user)
await ctx.respond(f"I have kick {user} for the raison : {reason} !") await ctx.respond(f"I have kick {user} for the raison : {reason} !")
else: else:
await ctx.respond("You can't kick a member !") await ctx.respond("You can't kick a member !")
@client.command() @client.command()
async def ban(ctx, user:discord.User, reason): async def ban(ctx, user:discord.User, reason):
"""Ban a member""" """Ban a member"""
if ctx.author.guild_permissions.ban_members: if ctx.author.guild_permissions.ban_members:
await ctx.guild.ban(user) await ctx.guild.ban(user)
await ctx.respond(f"I have ban {user} for the raison : {reason} !") await ctx.respond(f"I have ban {user} for the raison : {reason} !")
else: else:
await ctx.respond("You can't ban a member !") await ctx.respond("You can't ban a member !")
@client.command() @client.command()
async def unban(ctx, user:discord.User, reason): async def unban(ctx, user:discord.User, reason):
"""Unban a member""" """Unban a member"""
if ctx.author.guild_permissions.ban_members: if ctx.author.guild_permissions.ban_members:
await ctx.guild.unban(user) await ctx.guild.unban(user)
await ctx.respond(f"I have unban {user} for the raison : {reason} !") await ctx.respond(f"I have unban {user} for the raison : {reason} !")
else: else:
await ctx.respond("You can't kick a member !") await ctx.respond("You can't kick a member !")
@client.command() @client.command()
async def ping(ctx): async def ping(ctx):
"""View the ping""" """View the ping"""
await ctx.respond(f'Your ping is {round(client.latency * 1000)}ms') await ctx.respond(f'Your ping is {round(client.latency * 1000)}ms')
@client.command() @client.command()
async def question(ctx, question): async def question(ctx, question):
responses = ['Yes', responses = ['Yes',
'No', 'No',
'Without a doubt', 'Without a doubt',
'Count on it', 'Count on it',
'My sources say no', 'My sources say no',
'My sources say yes',] 'My sources say yes',]
await ctx.respond(f'Question: {question} Answer: {random.choice(responses)}') await ctx.respond(f'Question: {question} Answer: {random.choice(responses)}')
@client.command() @client.command()
async def slowmode(ctx, seconds: int): async def slowmode(ctx, seconds: int):
await ctx.channel.edit(slowmode_delay=seconds) await ctx.channel.edit(slowmode_delay=seconds)
await ctx.respond(f"Set the slowmode delay in this channel to {seconds} seconds!") await ctx.respond(f"Set the slowmode delay in this channel to {seconds} seconds!")
@client.command() @client.command()
async def nickname(ctx, member: discord.Member, nick): async def nickname(ctx, member: discord.Member, nick):
await member.edit(nick=nick) await member.edit(nick=nick)
await ctx.respond(f'Nickname was changed for {member.mention} ') await ctx.respond(f'Nickname was changed for {member.mention} ')
@client.command() @client.command()
async def vote(ctx, message): async def vote(ctx, message):
emb=discord.Embed(title=" VOTE ", description=f"{message}") emb=discord.Embed(title=" VOTE ", description=f"{message}")
msg=await ctx.channel.send(embed=emb) msg=await ctx.channel.send(embed=emb)
await msg.add_reaction('👍') await msg.add_reaction('👍')
await msg.add_reaction('👎') await msg.add_reaction('👎')
client.run(TOKEN) client.run(TOKEN)