Commit Graph

1251 Commits

Author SHA1 Message Date
bae6f80327 [commands] Split Cooldown state processing to two different functions.
This allows us to check if we are rate limited without
creating a new cool-down window for the command.
2017-10-03 03:57:06 -04:00
b22f7c76c5 Further clarify how bots can interact with emoji endpoints
Clarifies that bot accounts can only interact with emoji they have
created.
2017-10-03 00:22:06 +02:00
51a696e674 Remove reference to "whitelisted" bots for emoji endpoints
Due to a recent change in the Discord API, bots can now create
guild-specific emoji, so I've removed the parts of the documentation
referencing this restriction.
2017-10-03 00:10:01 +02:00
13632faf97 Fix AppInfo.id being a string 2017-10-02 13:38:05 -07:00
065f408a10 Move pre-emptive message to DEBUG log level. 2017-10-01 13:43:20 -04:00
711dfb83ab Allow creating a channel with a category. 2017-09-29 05:54:29 -04:00
6d6ce14d7c Fix Guild.system_channel always returning None.
Fixes #811
2017-09-26 22:56:26 -04:00
f86ac47b28 Don't use Bulk Channel Edit endpoint if not actually moving channels.
Should make the category-only edit cases more straightforward since
it does not rely on other guilds in the cache, outside of the category
itself.
2017-09-24 04:55:10 -04:00
148816c4e8 Temporarily add created channels to cache.
This should fix issues when doing a `abc.GuildChannel.edit` immediately
afterwards and then when the corresponding CHANNEL_CREATE comes in the
channel instance should hopefully be overwritten by the authoritative
figure, the WebSocket.
2017-09-23 18:54:12 -04:00
fd531297d2 Changed discord.Client.event to debug log success instead of info log.
This is suggested to prevent spamming the console unnecesarilly.

Info should be used to output information to the user that is important, but
not a warning or an error. If I am bundling a bot as a modular package then
it doesn't really make sense to spam their console with every time a coroutine
is subscribed to, as it likely will not mean anything to the user. If they are
interested in this, it would make more sense to just to enable debugging first.

I have made this change, as I am writing a wrapper for this library for a
private project, and that will handle dispatching events, thus, I do not
need a prompt for each event that is subscribed to in this module outside of
DEBUG. Currently, with logging set to INFO, I am getting 47 lines reading:

    INFO:discord.client:coroutine has successfully been registered as an event

...being output as my bot starts, and without having to disable INFO logging
altogether, I am currently having to temporarily change the verbosity of the
logger as the events are initialised, which is not desirable as it could
potentially cover up any other INFO messages that would be useful to have
output.

Using a filter seems like a bit of a hacky workaround. If this isn't acceptable
then another alternative would be to add a parameter to the constructor of
discord.Client to enable or disable printing this information.
2017-09-23 12:50:12 +01:00
458cb83b47 Properly handle cases where a category is removed. 2017-09-21 22:15:47 -04:00
95c28f08e4 Fix sorting for channels. 2017-09-21 00:11:36 -04:00
3e00e7fe8a [guild] use a defaultdict in by_category 2017-09-20 21:08:46 -07:00
415ca9a774 Add webhook.url 2017-09-18 19:31:20 +02:00
025136076a Add an example for on_reaction_add waiting.
Apparently people would rather read examples than the actual
documentation.
2017-09-18 05:46:51 -04:00
5e913b265b Change how coroutines are detected internally. 2017-09-16 13:35:00 -04:00
305cc3acfa Clarify VoiceClient.disconnect docs a little more. 2017-09-16 13:29:36 -04:00
91e2163523 Fix typo in http.create_channel 2017-09-13 18:05:09 -05:00
7b2e06c263 Fix error when creating guild channels. 2017-09-13 18:47:40 -04:00
e614f6b4cd [commands] Add CategoryChannelConverter 2017-09-13 17:19:30 -04:00
7df8897e3d Add Guild.create_category.
An alias, Guild.create_category_channel is provided.
2017-09-13 17:01:42 -04:00
233c2d80ef Fix grammar in abc docs, add new implementation 2017-09-13 13:54:09 -04:00
53b4890435 Add category support.
This adds:

* CategoryChannel, which represents a category
* Guild.by_category() which traverses the channels grouping by category
* Guild.categories to get a list of categories
* abc.GuildChannel.category to get the category a channel belongs to
* sync_permissions keyword argument to abc.GuildChannel.edit to sync
  permissions with a pre-existing or new category
* category keyword argument to abc.GuildChannel.edit to move a channel
  to a category
2017-09-13 09:44:36 -04:00
e24914be0b [commands] Fix NameError when given an invalid prefix.
Closes #775
2017-09-12 04:22:13 -04:00
3cd1fdc1eb Document new features for guilds. 2017-09-12 04:21:15 -04:00
1367877d36 Fix crashing for now when a category is created.
A full implementation will come later.
2017-09-08 21:30:25 -04:00
8912625428 Fix docstrings for Webhook.send 2017-09-08 04:23:11 -04:00
21fd94a449 Attempt to change how member functions are detected for Member objects 2017-09-04 20:03:50 -04:00
dcde896e14 Fix __hash__ for Invite objects. 2017-09-04 20:03:07 -04:00
10696a275b [commands] Have (bot_)has_permissions provide better failure responses 2017-08-30 23:20:59 -04:00
8646bddc90 [commands] Add MissingPermissions and BotMissingPermissions 2017-08-30 23:20:55 -04:00
63bca6604b Manually format reason parameter for kick and ban.
Related to: https://github.com/aio-libs/aiohttp/issues/2235
2017-08-30 17:58:53 -04:00
ede1771960 Fix utils.get example. 2017-08-30 01:37:25 -04:00
62df23633a Sort roles by hierarchy instead of by ID.
Fixes #741
2017-08-29 16:24:04 -04:00
221df0ab02 Update embed property doc grammar 2017-08-29 15:48:10 -04:00
63fcfa6d02 [commands] Add CooldownMapping.from_cooldown factory classmethod. 2017-08-27 16:59:04 -04:00
1c967e9a7c [commands] Export cooldown classes as well. 2017-08-27 16:55:23 -04:00
5e2d915375 Add pinning to manage_messages doc 2017-08-27 16:08:06 -04:00
99bd595f5e Rename webhook parameters to payload to avoid shadowing.
The old names clashed with the `json` module.
2017-08-24 22:23:14 -04:00
e7d3085445 Webhook URLs can have dashes and underscores. 2017-08-22 17:52:10 -04:00
7ee63a26f0 Fix docstring 2017-08-22 04:45:52 -04:00
7ee5dc22fb Fix a couple docstrings 2017-08-22 04:45:52 -04:00
8eb6fa0329 Fix multi-part sending with aiohttp in webhooks. 2017-08-22 00:26:43 -04:00
754f3a2ae9 Don't make session a keyword only argument. 2017-08-21 14:57:57 -04:00
84f38b166e Add atomic keyword argument for member role editing operations.
This affects:

* Member.add_roles
* Member.remove_roles

This is the main attempt of fixing long standing bugs like #56. Since
cache consistency is too hard to ask for due to eventual consistency
and this generally being one of the only main roadblocks that the
cache ruins, it's best to just implement it in terms of the atomic
endpoint instead.

Fixes #56
2017-08-21 10:40:33 -04:00
e5ebea75a9 Lazily fetch Emoji.roles and Emoji.guild to prevent memory leaks.
The global emoji cache still managed to somehow cause memory leaks. By
storing IDs directly and lazily evaluating them when needed this
essentially removes all strong references to Guild objects which would
cause an explosion in memory usage.
2017-08-21 06:16:50 -04:00
f1e59ea933 Game objects are really dumb. 2017-08-21 02:49:49 -04:00
b5d987347a Fix some docstrings. 2017-08-21 02:11:00 -04:00
310cb05040 Fix Webhook.execute alias. 2017-08-21 02:04:44 -04:00
37b0fdb898 Add webhook support.
Allows for usage of either `requests` and `aiohttp` when used in
"Standalone" mode.

Fixes #704
2017-08-21 01:57:07 -04:00