-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (24 loc) · 754 Bytes
/
Copy pathmain.py
File metadata and controls
31 lines (24 loc) · 754 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
import discord
from discord.ext import commands
import os
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='!', intents=intents)
@bot.event
async def on_ready():
print(f'Yeay! Bot {bot.user.name} sudah online dan siap digunakan!')
@bot.command()
async def halo(ctx):
await ctx.send(f'Halo juga {ctx.author.name}! Ada yang bisa dibantu?')
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content.lower() == 'ping':
await message.channel.send('Pong! 🏓')
await bot.process_commands(message)
if __name__ == '__main__':
bot.run(TOKEN)