woodburn-bot/bot.py

40 lines
760 B
Python
Raw Normal View History

2023-08-11 15:55:44 +10:00
import os
from dotenv import load_dotenv
import discord
from discord import app_commands
load_dotenv()
TOKEN = os.getenv('DISCORD_TOKEN')
intents = discord.Intents.default()
client = discord.Client(intents=intents)
tree = app_commands.CommandTree(client)
# Commands
@tree.command(name="ping", description="Check bot connection")
async def ping(ctx):
await ctx.response.send_message("Pong!",ephemeral=True)
def updateStatus():
activity = discord.Activity(name="Nathan try to get set me up", type=discord.ActivityType.watching)
client.loop.create_task(client.change_presence(activity=activity))
# When the bot is ready
@client.event
async def on_ready():
await tree.sync()
print("Ready!")
updateStatus()
client.run(TOKEN)