diff options
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | drutils/awaiter.py | 9 |
2 files changed, 13 insertions, 4 deletions
@@ -1,3 +1,9 @@ ## Romans discord.py utilities -Yes thats it. +### Awaiter +the `drutils.awaiter` module contains a bunch of nice utils to await a message containing datatypes like roles, channels, etc. + +### Eval +a very nice eval + + diff --git a/drutils/awaiter.py b/drutils/awaiter.py index bad7c79..5e490e0 100644 --- a/drutils/awaiter.py +++ b/drutils/awaiter.py @@ -182,16 +182,19 @@ class AdvancedAwaiter: emoji = await self.emoji_choice(text, [YES_REACTION, NO_REACTION]) return emoji == YES_REACTION - async def text(self, text: str): + async def text(self, text: str) -> str: return (await self(text)).content - async def guild_channel(self, text: str, check=lambda channel: True, writable=False) -> object: + async def guild_channel(self, text: str, check=lambda channel: True, writable=False) -> TextChannel: async def converter(mes: Message): return discord.utils.get(self.guild.channels, id=int(mes.content.translate(digit_keeper))) + if not self.guild: + raise ValueError("This can only be used in guilds") + async def all_checks(channel: TextChannel): - if writable and not channel.permissions_for(self.bot.user).send_messages: + if writable and channel.guild == self.guild and not channel.permissions_for(channel.guild.me).send_messages: return False return await await_if(check, channel) |