Skip to content

Commit 0597e4e

Browse files
authored
Merge pull request #179 from kyb3r/proxy-typing
Add simple typing interactions
2 parents ab58036 + d50e639 commit 0597e4e

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ 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.7
8+
9+
### 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+
715
# 2.13.6
816

917
### Fixed

bot.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,20 @@ async def on_message(self, message):
578578
'Command "{}" is not found'.format(ctx.invoked_with)
579579
)
580580
self.dispatch('command_error', ctx, exc)
581+
582+
async def on_typing(self, channel, user, when):
583+
if isinstance(channel, discord.DMChannel):
584+
if not self.config.get('user_typing'):
585+
return
586+
thread = await self.threads.find(recipient=user)
587+
if thread:
588+
await thread.channel.trigger_typing()
589+
else:
590+
if not self.config.get('mod_typing'):
591+
return
592+
thread = await self.threads.find(channel=channel)
593+
if thread and thread.recipient:
594+
await thread.recipient.trigger_typing()
581595

582596
async def on_guild_channel_delete(self, channel):
583597
if channel.guild != self.modmail_guild:

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)