Skip to content

Commit 5ca8e50

Browse files
authored
Merge branch 'master' into status
2 parents 30df631 + 0597e4e commit 5ca8e50

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,27 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
# 2.13.6
7+
# 2.13.7
88

99
### Added
10+
11+
- The ability to enable typing interactions.
12+
13+
If you want the bot to type in the thread channel if the user is also typing, add the config variable `user_typing`, the value doesnt matter, just it's presence. use `config del` to disable the functionality. The same thing in reverse is also possible, if you want the use to see the bot type when someone is typing in the thread channel add the `mod_typing` config variable.
14+
1015
- New `status` command, change the bot's status to `online`, `idle`, `dnd`, `invisible`, or `offline`.
1116
- To remove the status (change it back to default), use `status clear`.
1217
- This also introduces a new internal configuration variable: `status`. Possible values are `online`, `idle`, `dnd`, `invisible`, and `offline`.
18+
1319
### Changed
1420
- The internals for `activity` has drastically changed to accommodate the new `status` command.
1521

22+
# 2.13.6
23+
24+
### Fixed
25+
26+
Fixed a bug in the contact command where the response message did not send.
27+
1628
# 2.13.5
1729

1830
### Added

bot.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,20 @@ async def on_message(self, message):
542542
'Command "{}" is not found'.format(ctx.invoked_with)
543543
)
544544
self.dispatch('command_error', ctx, exc)
545+
546+
async def on_typing(self, channel, user, when):
547+
if isinstance(channel, discord.DMChannel):
548+
if not self.config.get('user_typing'):
549+
return
550+
thread = await self.threads.find(recipient=user)
551+
if thread:
552+
await thread.channel.trigger_typing()
553+
else:
554+
if not self.config.get('mod_typing'):
555+
return
556+
thread = await self.threads.find(channel=channel)
557+
if thread and thread.recipient:
558+
await thread.recipient.trigger_typing()
545559

546560
async def on_guild_channel_delete(self, channel):
547561
if channel.guild != self.modmail_guild:

cogs/modmail.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,11 @@ async def edit(self, ctx, message_id: Optional[int] = None,
602602
async def contact(self, ctx,
603603
category: Optional[discord.CategoryChannel] = None, *,
604604
user: Union[discord.Member, discord.User]):
605-
"""Create a thread with a specified member."""
605+
"""Create a thread with a specified member.
606+
607+
If the optional category argument is passed, the thread
608+
will be created in the specified category.
609+
"""
606610

607611
if user.bot:
608612
embed = discord.Embed(
@@ -622,6 +626,7 @@ async def contact(self, ctx,
622626
else:
623627
thread = self.bot.threads.create(user, creator=ctx.author,
624628
category=category)
629+
await thread.wait_until_ready()
625630
embed = discord.Embed(
626631
title='Created thread',
627632
description=f'Thread started in {thread.channel.mention} '

core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ConfigManager(ConfigManagerABC):
1313
'twitch_url',
1414
# bot settings
1515
'main_category_id', 'disable_autoupdates', 'prefix', 'mention',
16-
'main_color',
16+
'main_color', 'user_typing', 'mod_typing',
1717
# logging
1818
'log_channel_id',
1919
# threads

0 commit comments

Comments
 (0)