Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update discord py * feat: monkey-patch embeds to give more init param options * feat: add dmrelay cog for relaying dms to channel some values are hardcoded until the configuration system is reimplemented * feat: Add close command and enhance dmrelay support via webhooks * fix: add missing config value to default config temporary fix until the configuration system is rewritten * chore: use correct types, pass thread, archive after message. * chore: remove support for webhooks Using webhooks to send messages do not add much if any benefit, as a webhook with the member username and pfp is a bit harder to tell apart from staff at first glance. This is also the only benefit that using webhooks give, for the multiple disadventages they give, as now the bot has to manage a webhook too. We may support webhooks in the future as an official plugin, but for now we are focusing on the core functionality of the bot. * chore: rename DmRelay to Tickets * chore: move thread decorator to threads.py * threads: add ticket model * chore: update discordpy * chore: [temp fix] add members intent * chore: don't have any hardcoded config * threads: rewrite thread decorator Thread decorator now also checks if it is a modmail thread or not, to ensure ticket only commands aren't enabled on some other thread. * chore[DMs]: add helper method to check if a user can be dmed * chore[dependencies]: run poetry update * minor: rename utils.user to utils.users * feat: add ticket system to relay messages from dms to server, and back IT LIVES!! As of this commit, the bot can now function as a modmail bot, albiet it is not fully implemented, and is somewhat buggy, but the basic implementation is there. * minor: add empty test file for threads/tickets * chore: add required variable to .env.template * minor: get rid of unused parameter * nit: fix docstring in not-yet-written tests * changes: document threads existence, and breaking env var * nit: fix dms blocked alert message * minor: make open a top level command named contact * minor: add logging statements to threads.py * minor: use TYPE_CHECKING * threads: add on_typing relay * tools: run poetry update * threads: add typing event relay * threads: add embed format stub methods * breaking: refactor threads * threads: move Ticket objects to be stored on the bot obj * chore: make the embed creator an object This is for when configuration will need to be passed to the embed creator. Most embed options will be customisable, and it is easier to pass a configuration object to the embed creator once than it is to pass configuration parameters to every single method. * threads: implement more embeds, add buggy edit command * fix: send error message when thread can't be created * chore: update docstring of contact command * fix: add delete command, make edit command work * fix: channel name now matches recipient * threads: add user-side close embed * chore: update discord.py and use Member.display_avatar * add closing on thread archive events closes tickets on thread archive events also implements a lock for adding and removing threads * fix: use audit logs so its possible to detect the user who archived the thread * minor: make audit log optional at expense of not knowing who closed a thread * nit: remove duped author info from embeds * scrap thread embed creator was too complicated, didn't serve a good use at the moment, could possibly make a return in the future but very unlikely * minor: type the message dict return type properly * chore: show ids on server relay but not on dm relay * minor changes to support relaying embeds between servers * chore: get rid of useless message ID * fix: patch getitem method of messagedict * minor: split relay into two methods * chore: patch message dict to only allow discord.Message objects * feat: listen to edit and deletion dm events and relay them to guild * fix: edit works even if the last message was deleted and delete can delete multiple messages * nit: save users to dm_channel to user mapping if they don't exist * fix: handle stickers and developer debug command. * minor: use built in discord timestamps with arrow * add better attachment support and thread to dm deletion relay * relay attachments from guild to dm * fix handling of stickers and attachments * fix: multiple tickets can't be opened with a user * fix: send thread open message on opens * minor: don't relay a thread close msg if no messages were sent * fix: allow mods to provide contents when closing a thread * fix: add missing type annotations * fix: message sent in server is now better looking * fix: rename thread debug command to prevent future conflicts * nit: change user_dms_closed message * Partially Revert 18d4f93 * chore: update comments and docs as requested * chore: relock the lockfile * nit: add missing period and use f-string * fix: different colours for received and sent message embeds * minor: move opened-at timestamp to a field * nit: don't specify None when using get() on a dict * make first wave of suggested changes I need to commit and push, will squash these after * make second wave of suggested changes I need to commit and push, will squash these after * fix: ignore all checkfailures from dm commands * fix: remove unused converters these converters may be useful, but they are not needed at this time * nit: better detail 100% error rate on check_can_dm_user * chore: unprivatize most thread methods * minor: privatize ticket dict * fix: remove additional files as part of 03ec70f * nit: rename thread test file * chore: make some requsted changes - rename kwargs 'raise_for_preexisting_ticket' to 'raise_for_preexisting' - don't use discord.ext.tasks for a simple bot.loop.create_task event - fix a few typos in commands - define and label the sets used for handling deleted messages * minor: use modmail.utils.time for timestamps * minor: fix edited messages not being relayed to guild * fix: method now returns instance of class instead of class other minor changes including annotations and comments * tests: add some tests for threads * tests: add tests for utils.thread.decorators * tests: add tests for the contact command * nit: remove some extra trailing commas and move typing indicator * tests: add general test for reply_to_user * fix: use async rather than sync method for fetching tickets * chore: rename variables, use named format strings, and touch up error ui * nit: use valid kwargs footer_text instead of footer * chore: standardize and dedupe code for edit and delete commands * chore: refactor fetch_ticket to return None if no ticket found * chore: rename variables, fix logic bug, make constant * fix: use correct logic a few if statements were checking a variable is not None, they should be checking the variable is None Co-authored-by: Shivansh-007 <shivansh-007@outlook.com>
- Loading branch information