-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* clean up * clean up * configure fallback emojis * nuke coin emojis * fix emissions, use generic coin icon
- Loading branch information
1 parent
1b6da45
commit 9f623ac
Showing
19 changed files
with
294 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,4 +160,7 @@ cython_debug/ | |
#.idea/ | ||
|
||
# VS Code | ||
.vscode | ||
.vscode | ||
|
||
# Mac | ||
.DS_Store |
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
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from .pools import PoolsDropdown # noqa | ||
from .pool_stats import PoolStats # noqa | ||
from .emojis import Emojis # noqa |
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,30 @@ | ||
from typing import Sequence | ||
from discord import Emoji | ||
|
||
|
||
class Emojis: | ||
"""Loads all custom emojis associated with current server and | ||
makes them available via get method""" | ||
|
||
def __init__(self, emojis: Sequence[Emoji]): | ||
"""Load all custom emojis | ||
Args: | ||
emojis (Sequence[Emoji]): custom emojis attached to a server | ||
""" | ||
self.emojis = {} | ||
for emoji in emojis: | ||
# based on: https://github.com/Rapptz/discord.py/issues/390 | ||
self.emojis[emoji.name] = str(emoji) | ||
|
||
def get(self, name: str, fallback: str = "*") -> str: | ||
"""Get custom emoji by name or return fallback string | ||
Args: | ||
name (str): name of the custom emoji to get | ||
fallback (str, optional): fallback value to return. Defaults to "*". | ||
Returns: | ||
str: _description_ | ||
""" | ||
return self.emojis[name] if name in self.emojis else fallback |
Oops, something went wrong.