Skip to content

Commit

Permalink
test command
Browse files Browse the repository at this point in the history
  • Loading branch information
Selyss committed Nov 23, 2023
1 parent 145538a commit 4737e71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
15 changes: 15 additions & 0 deletions cogs/ticket.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from nextcord import Interaction, slash_command
from nextcord.ext.commands import Bot, Cog


class Ticket(Cog):
def __init__(self, bot: Bot) -> None:
self.bot = bot

@slash_command(name="ping", description="A simple ping command.")
async def ping(self, inter: Interaction) -> None:
await inter.send(f"Pong! {self.bot.latency * 1000:.2f}ms")


def setup(bot: Bot) -> None:
bot.add_cog(Ticket(bot))
9 changes: 5 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import os
from nextcord import PermissionOverwrite, TextChannel
from typing import List
import nextcord
from nextcord.ext import commands
from nextcord.ext.commands import Bot
from nextcord import SlashOption
from dotenv import load_dotenv

load_dotenv()

TOKEN = os.getenv("BOT")
EMBED_COLOR = 0xfffe88ff

intents = nextcord.Intents.default()
intents.message_content = True

print("[System] Beginning load...")
bot = commands.Bot(command_prefix="!", intents=intents)
bot = Bot(command_prefix="!", intents=intents)
bot.load_extension("cogs.ticket")

@bot.event
async def on_ready():
print(f"[System] Logged in as {bot.user.name}.")

@bot.command()
async def ping(ctx):
await ctx.reply("pong!")

if not TOKEN:
print("[System] Missing TOKEN environment variable.")
Expand Down

0 comments on commit 4737e71

Please sign in to comment.