X-Git-Url: https://ruin.nu/git/%3CTMPL_VAR%20NAME=PAGE%3E?a=blobdiff_plain;f=DiscordContext.pm;h=f8a0a089ea6a5427f4d53834b17725840538bf43;hb=5e3d1d34e92582e05cc242356b60aeef5bc76a34;hp=c6e4959a2343c2e700661dc33c8f5096da0f142e;hpb=dcb7d5ee3791ae43e7fcaf3639ce5b70f6c659ab;p=NDIRC.git
diff --git a/DiscordContext.pm b/DiscordContext.pm
index c6e4959..f8a0a08 100644
--- a/DiscordContext.pm
+++ b/DiscordContext.pm
@@ -38,17 +38,39 @@ has channel_id => (
required => 1
);
+has author_id => (
+ is => 'ro',
+ isa => 'Str',
+ required => 1
+);
+
has discord => (
is => 'ro',
isa => 'Object',
required => 1
);
+has dm_reply => (
+ is => 'rw',
+ isa => 'Bool',
+ required => 0,
+ default => 0
+);
+
sub reply {
my ($self,$msg) = @_;
- $self->message($self->channel_id, $msg);
+ if ($self->dm_reply)
+ {
+ $msg =~ s`(.*?)`**$1**`gi;
+ $msg =~ s`(.*?)`*$2*`gi;
+ $self->discord->send_dm($self->author_id, $msg);
+ }
+ else
+ {
+ $self->message($self->channel_id, $msg);
+ }
}
sub message {