Skip to content

Commit 4821c72

Browse files
authored
Add Discord bot with interactive commands
Implementa um bot do Discord com comandos interativos.
1 parent 7157455 commit 4821c72

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

main.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import discord
2+
from discord.ext import commands
3+
from dotenv import load_dotenv
4+
import os
5+
6+
# Carrega as variáveis do arquivo .env
7+
load_dotenv()
8+
TOKEN = os.getenv("DISCORD_TOKEN")
9+
10+
intents = discord.Intents.default()
11+
intents.members = True
12+
13+
bot = commands.Bot(command_prefix='+', intents=intents)
14+
15+
@bot.event
16+
async def on_ready():
17+
print(f"Pronto! {bot.user}")
18+
await bot.tree.sync()
19+
20+
21+
@bot.tree.command(name="ping", description="Veja o ping do bot")
22+
async def ping(interaction: discord.Interaction):
23+
latency = round(bot.latency * 1000)
24+
await interaction.response.send_message(f"AU AU!! \nLatência: {latency}ms")
25+
26+
27+
@bot.tree.command(name="morder", description="Dá uma mordida carinhosa em alguém")
28+
async def morder(interaction: discord.Interaction, user: discord.Member):
29+
await interaction.response.send_message(
30+
f"🐾 A Lua correu e deu uma mordidinha carinhosa em {user.mention}!!"
31+
)
32+
33+
34+
@bot.tree.command(name="chinelos", description="Lua mostra um chinelo destruído")
35+
async def chinelos(interaction: discord.Interaction):
36+
embed = discord.Embed(title="O Chinelo virou pó!")
37+
embed.set_image(
38+
url="https://i.postimg.cc/fL8khMgX/Opera-Instant-neo-2025-09-16-194923-www-canva-com.png"
39+
)
40+
await interaction.response.send_message(embed=embed)
41+
42+
43+
@bot.tree.command(name="carinho", description="Faça carinho na Lua!!")
44+
async def carinho(interaction: discord.Interaction):
45+
await interaction.response.send_message(
46+
"💖 A Lua aceitou seu carinho!! (mas cuidado, ela ainda pode te morder hehe:P)"
47+
)
48+
49+
50+
@bot.tree.command(name="latir", description="Lua manda latidos para você")
51+
async def latir(interaction: discord.Interaction):
52+
await interaction.response.send_message("AU AU AUUUUUUUUUUUUUUUUUUUUUUUUUUU!")
53+
54+
55+
@bot.event
56+
async def on_member_join(member):
57+
try:
58+
await member.send(
59+
f"AU AU! {member.name} ... AU AU! Quem é você? Espero que não tenha trazido chinelos... :P"
60+
)
61+
except discord.Forbidden:
62+
print(f"Não consegui latir para {member.name} 🥹")
63+
64+
bot.run(TOKEN)

0 commit comments

Comments
 (0)