Skip to content

Commit

Permalink
Add example plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Rivixer committed Sep 8, 2024
1 parent ae04e4a commit 5ec37ee
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
37 changes: 37 additions & 0 deletions plugins/example/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: MIT
"""An example plugin cog.
This cog is an example of how to create a plugin cog.
It is ignored and cannot be loaded by the bot.
"""

from __future__ import annotations

from typing import TYPE_CHECKING

import nextcord
from nextcord.ext import commands
from nextcord.interactions import Interaction

if TYPE_CHECKING:
from sggwbot.sggw_bot import SGGWBot


class ExampleCog(commands.Cog):
"""An example plugin cog."""

__slots__ = ("bot",)

_bot: SGGWBot

def __init__(self, bot: SGGWBot):
self._bot = bot

@nextcord.slash_command(name="example", description="Example command")
async def _example(self, interaction: Interaction) -> None:
await interaction.response.send_message("Hello, world!", ephemeral=True)


def setup(bot: SGGWBot):
"""Loads the ExampleCog cog."""
bot.add_cog(ExampleCog(bot))
3 changes: 3 additions & 0 deletions plugins/example/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enabled": true
}

0 comments on commit 5ec37ee

Please sign in to comment.