This repository has been archived by the owner on Oct 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added simple versioning system (1.0.1.0)
- Loading branch information
Showing
5 changed files
with
73 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import logging | ||
|
||
from discord.ext import commands | ||
|
||
from helpers import descriptions as desc, simplify as s | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class Versioning: | ||
""" | ||
This versioning system probably isn't perfect, but since this is not a pip package, | ||
I didn't find any good practices online. I'm open to discussion | ||
""" | ||
version = "" | ||
changelog = "" | ||
|
||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
with open('cogs/versioning/changelog.md', 'r') as changes: | ||
Versioning.changelog = changes.read() | ||
log.debug("Changelog loaded from file") | ||
|
||
with open('cogs/versioning/version.txt', 'r') as v: | ||
Versioning.version = v.readline() | ||
log.debug("version loaded from file") | ||
|
||
@commands.command(name='version', description=desc.v_command, brief=desc.v_command) | ||
async def v(self): | ||
await self.bot.say("Current version: {}".format(Versioning.version)) | ||
|
||
@commands.command(name='changelog', pass_context=True, description=desc.changelog, brief=desc.changelog) | ||
async def chlog(self, ctx): | ||
# Test that your markdown looks pretty in ```md``` tag in Discord | ||
# Split minor versions (major.minor.patch.bugfixes) with '** **' | ||
chlog = "```md\n{0}```".format(Versioning.changelog.split("** **")[0]) | ||
await s.whisper(ctx.message.author, chlog, self.bot) | ||
|
||
|
||
def setup(bot): | ||
bot.add_cog(Versioning(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,13 @@ | ||
Changelog | ||
========= | ||
|
||
1.0 | ||
=== | ||
|
||
1.0.1 | ||
----- | ||
* Added Versioning system | ||
* Everything up to this point is only found in commits | ||
* [!version][] says bot's version out loud | ||
* [!changelog][] whispers caller last changes | ||
** ** |
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 @@ | ||
1.0.1.0 |
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