diff options
author | romangraef <romangraef@loves.dicksinhisan.us> | 2018-11-26 22:29:05 +0100 |
---|---|---|
committer | romangraef <romangraef@loves.dicksinhisan.us> | 2018-11-26 22:29:05 +0100 |
commit | 299c907aba7c79b014554993e9160ec82ecbe5da (patch) | |
tree | ad5fb4957ca0d32be77abdf1fad94390c1f0733e | |
parent | 0800872c0add1671cbeb15258eec283767b4161a (diff) | |
download | drutils-299c907aba7c79b014554993e9160ec82ecbe5da.tar.gz drutils-299c907aba7c79b014554993e9160ec82ecbe5da.tar.bz2 drutils-299c907aba7c79b014554993e9160ec82ecbe5da.zip |
awaiter fix
-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) |