-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
698 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"enabled": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
# This script will install all packages listed | ||
# in the files in the plugins/packages directory. | ||
# The files should contain a list of packages, one per line. | ||
# The files should be named the same as the plugin | ||
# they are associated with and have a .txt extension. | ||
|
||
apt-get update | ||
|
||
for file in ./plugins/packages/*; do | ||
|
||
# Skip this file | ||
if [ "$file" == "./plugins/packages/install.sh" ]; then | ||
continue | ||
fi | ||
|
||
# Check if the file is a regular file and not a directory | ||
if [ -f "$file" ]; then | ||
# Ensure the file has LF line endings | ||
sed -i 's/\r$//' "$file" | ||
|
||
echo "Installing packages for $file" | ||
apt-get --no-install-recommends install -y $(cat "$file") | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Packages from $file installed successfully." | ||
else | ||
echo "Failed to install packages from $file." >&2 | ||
fi | ||
else | ||
echo "$file is not a valid file and will be skipped." >&2 | ||
fi | ||
|
||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
# This script will install all packages listed | ||
# in the files in the plugins/requirements directory. | ||
# The files should contain a list of packages, one per line. | ||
# The files should be named the same as the plugin | ||
# they are associated with and have a .txt extension. | ||
|
||
for file in ./plugins/requirements/*; do | ||
|
||
# Skip this file | ||
if [ "$file" == "./plugins/requirements/install.sh" ]; then | ||
continue | ||
fi | ||
|
||
# Check if the file is a regular file and not a directory | ||
if [ -f "$file" ]; then | ||
echo "Installing Python packages for $file" | ||
|
||
# Install the packages listed in the current file using pip | ||
python -m pip install -r "$file" | ||
|
||
# Check if the pip installation was successful | ||
if [ $? -eq 0 ]; then | ||
echo "Packages from $file installed successfully." | ||
else | ||
echo "Failed to install packages from $file." >&2 | ||
fi | ||
else | ||
echo "$file is not a valid file and will be skipped." >&2 | ||
fi | ||
|
||
done |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.