-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored code, fixed models and added new commands for levelling role
- Loading branch information
Showing
18 changed files
with
252 additions
and
272 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,9 @@ | ||
from bot.core import DiscordBot | ||
|
||
from .commands import PersistentRoles | ||
from .events import PersistentEvents | ||
|
||
|
||
async def setup(bot: DiscordBot) -> None: | ||
await bot.add_cog(PersistentRoles(bot=bot)) | ||
await bot.add_cog(PersistentEvents(bot=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,10 @@ | ||
from discord.ext import commands | ||
|
||
|
||
class PersistentRoles(commands.Cog): | ||
def __init__(self, bot): | ||
self.bot = bot | ||
|
||
|
||
async def setup(bot: commands.Bot): | ||
await bot.add_cog(PersistentRoles(bot=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
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,20 @@ | ||
from .model import Model | ||
|
||
|
||
class CustomRoles(Model): | ||
id: int | ||
role_id: int | ||
guild_id: int | ||
name: str | ||
color: str | ||
|
||
@classmethod | ||
async def insert_by_guild(cls, role_id: int, guild_id: int, name: str, color: str): | ||
query = """INSERT INTO custom_roles (role_id, guild_id, name, color) | ||
VALUES($1, $2, $3, $4)""" | ||
await cls.execute(query, role_id, guild_id, name, color) | ||
|
||
@classmethod | ||
async def delete_by_guild(cls, guild_id: int, role_id: int): | ||
query = """DELETE FROM custom_roles WHERE guild_id = $1 and role_id = $2""" | ||
await cls.execute(query, guild_id, role_id) |
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.