-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot.py
More file actions
35 lines (28 loc) · 920 Bytes
/
bot.py
File metadata and controls
35 lines (28 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import discord
from discord.ext import commands
import os
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f"Bot connected as {bot.user}")
@bot.command()
async def ping(ctx):
await ctx.send("Pong! 🏓")
@bot.command()
async def info(ctx):
embed = discord.Embed(
title="Utility Bot",
description="A simple Discord utility bot built with Python.",
color=0x5865F2
)
embed.add_field(name="Commands", value="!ping, !info", inline=False)
await ctx.send(embed=embed)
@bot.event
async def on_member_join(member):
channel = discord.utils.get(member.guild.text_channels, name="general")
if channel:
await channel.send(f"Welcome {member.mention} to the server!")
TOKEN = os.getenv("DISCORD_TOKEN")
bot.run(TOKEN)