Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to KoalaBot will be documented in this file.
A lot of these commands will only be available to administrators

## [Unreleased]
### KoalaBot
#### Added
- `tutorial` View a tutorial of a specific extension or the bot as a whole if not specified
#### Changed
- `help` Include a small tutorial on adding and removing extensions.
- `help <extension>` Include a small tutorial on how to use the extension.
### Other
- Testing updated to use builders in dpytest 0.5.0

Expand Down
6 changes: 4 additions & 2 deletions KoalaBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
PERMISSION_ERROR_TEXT = "This guild does not have this extension enabled, go to http://koalabot.uk, " \
"or use `k!help enableExt` to enable it"
KOALA_IMAGE_URL = "https://cdn.discordapp.com/attachments/737280260541907015/752024535985029240/discord1.png"
DESCRIPTION = "To enable an extension, use k!enableExt.\nTo disable an extension, use k!disableExt.\n" \
"To list all possible extensions to add, use k!listExt." # Can be seen in k!help command
# Variables
started = False
if discord.__version__ != "1.3.4":
Expand All @@ -59,10 +61,10 @@
intent.members = True
intent.guilds = True
intent.messages = True
client = commands.Bot(command_prefix=COMMAND_PREFIX, intents=intent)
client = commands.Bot(command_prefix=COMMAND_PREFIX, intents=intent, description=DESCRIPTION)
else:
logging.info("discord.py v1.3.4: Intents Disabled")
client = commands.Bot(command_prefix=COMMAND_PREFIX)
client = commands.Bot(command_prefix=COMMAND_PREFIX, description=DESCRIPTION)
database_manager = DBManager(DATABASE_PATH, DB_KEY)
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)-8s %(message)s')
logger = logging.getLogger('discord')
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ These instructions will get you a copy of the project up and running on your loc

### Prerequisites

This application uses python 3.8 which you can download [here](https://www.python.org/downloads/)
This application supports Python 3.7-3.9 which you can download [here](https://www.python.org/downloads/)

All python packages you need can be found in the [requirements.txt](requirements.txt).
Before running the bot you must install these as so:
Expand Down
5 changes: 4 additions & 1 deletion cogs/Announce.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def announce_is_enabled(ctx):
return result or (str(ctx.guild) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)


class Announce(commands.Cog):
class Announce(commands.Cog,
description=f"Use `{KoalaBot.COMMAND_PREFIX}announce create` to create an announcement\n"
f"Use `{KoalaBot.COMMAND_PREFIX}announce send` to send it.\n"
):
"""
Send DM announcements to certain roles and people.
"""
Expand Down
30 changes: 29 additions & 1 deletion cogs/BaseCog.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def list_ext_embed(guild_id):
return embed


class BaseCog(commands.Cog, name='KoalaBot'):
class BaseCog(commands.Cog, name='KoalaBot', description=KoalaBot.DESCRIPTION):
"""
A discord.py cog with general commands useful to managers of the bot and servers
"""
Expand Down Expand Up @@ -226,6 +226,34 @@ async def list_koala_ext(self, ctx):

await ctx.send(embed=embed)

@commands.command()
@commands.guild_only()
async def tutorial(self, ctx, koala_extension = None):
"""
Gives a tutorial for a given koala extension, or a generic one if no extension is given.
:param ctx: Context of the command
:param koala_extension: The name of the koala
"""
failed = True
all_extensions = KoalaBot.database_manager.get_all_available_guild_extensions(ctx.guild.id)
if not koala_extension or koala_extension == "KoalaBot":
message = KoalaBot.DESCRIPTION
failed = False
elif (koala_extension,) in all_extensions and ctx.bot.get_cog(koala_extension):
message = ctx.bot.get_cog(koala_extension).description.strip() + \
f"\n\nSee `{KoalaBot.COMMAND_PREFIX}help {koala_extension}` for more information."
failed = False
else:
message = f"{koala_extension} is not a valid extension."

embed = discord.Embed(
title=koala_extension,
description=message,
colour=KOALA_GREEN if not failed else ERROR_RED
)
await ctx.send(embed=embed)



def setup(bot: KoalaBot) -> None:
"""
Expand Down
5 changes: 4 additions & 1 deletion cogs/ColourRole.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def colour_is_enabled(ctx):

return result or (str(ctx.author) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)

class ColourRole(commands.Cog):
class ColourRole(commands.Cog,
description=f"Use `{KoalaBot.COMMAND_PREFIX}customColour <hex code>` to change your display colour.\n"
f"and `{KoalaBot.COMMAND_PREFIX}listCustomColourAllowedRoles` to list all roles permitted to have custom colours.\n"
):
"""
A discord.py cog with commands to allow server members to change their display name colours to something of their choosing.
"""
Expand Down
2 changes: 1 addition & 1 deletion cogs/IntroCog.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_non_bot_members(guild: discord.Guild):
return [member for member in guild.members if not member.bot]


class IntroCog(commands.Cog, name="KoalaBot"):
class IntroCog(commands.Cog, name="KoalaBot", description=KoalaBot.DESCRIPTION):
"""
A discord.py cog with commands pertaining to the welcome messages that a member will receive
"""
Expand Down
6 changes: 5 additions & 1 deletion cogs/ReactForRole.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ def rfr_is_enabled(ctx):
return result or (str(ctx.author) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)


class ReactForRole(commands.Cog):
class ReactForRole(commands.Cog,
description = f"Use `{KoalaBot.COMMAND_PREFIX}rfr create` to create a new React for Roles message.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}rfr addRoles` and `{KoalaBot.COMMAND_PREFIX}rfr removeRoles` "
f"to add and remove roles respectively from the reaction message.\n"
):
"""
A discord.py cog pertaining to a React for Role system to allow for automation in getting roles.
"""
Expand Down
6 changes: 5 additions & 1 deletion cogs/TextFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def text_filter_is_enabled(ctx):
return result or (str(ctx.author) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)


class TextFilter(commands.Cog, name="TextFilter"):
class TextFilter(commands.Cog, name="TextFilter",
description=f"Use `{KoalaBot.COMMAND_PREFIX}filter` to add a word to the filtered text list.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}unfilter` to remove a word from the unfiltered text list.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}checkFilteredWords` to display the list of filtered words.\n"
):
"""
A discord.py cog with commands pertaining to the a Text Filter for admins to monitor their server
"""
Expand Down
5 changes: 4 additions & 1 deletion cogs/TwitchAlert.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def twitch_is_enabled(ctx):
return result


class TwitchAlert(commands.Cog):
class TwitchAlert(commands.Cog,
description = f"Use `{KoalaBot.COMMAND_PREFIX}twitchAdd <channel ID> <username> <live message> to add a Twitch user to the Twitch Alert.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}twitchEditMsg <channel ID> <live message> to edit the default Twitch Alert message when somebody goes live.\n"
):
"""
A discord.py cog for alerting when someone goes live on twitch
"""
Expand Down
5 changes: 4 additions & 1 deletion cogs/Verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def verify_is_enabled(ctx):

return result or (str(ctx.author) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)

class Verification(commands.Cog, name="Verify"):
class Verification(commands.Cog, name="Verify",
description=f"Use `{KoalaBot.COMMAND_PREFIX}verify <email>` to verify your email in order to get a verified role.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}verifyAdd <domain> <@role>` to setup the verification system and assign a specific domain to a role."
):

def __init__(self, bot, db_manager=None):
self.bot = bot
Expand Down
8 changes: 7 additions & 1 deletion cogs/Voting.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ async def get_results(bot, vote):
return results


class Voting(commands.Cog, name="Vote"):
class Voting(commands.Cog, name="Vote",
description=f"Use `{KoalaBot.COMMAND_PREFIX}create <title>` to create a new vote.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}setEndTime <time>` to set a time for the vote to end.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}cancel <title>` to cancel a vote.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}list` to list all votes.\n"
f"Use `{KoalaBot.COMMAND_PREFIX}close <title>` to close a specified vote.\n"
):
def __init__(self, bot, db_manager=None):
"""
discord cog to manage the voting interface
Expand Down
5 changes: 5 additions & 0 deletions documentation.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@
"command": "support",
"parameters": [],
"description": "Returns a link to the KoalaBot Support Discord Server"
},
{
"command": "tutorial",
"parameters": ["koala_extension"],
"description": "Gives a tutorial for a given koala extension, or a generic one if no extension is given."
}
]
},
Expand Down