X-Git-Url: https://ruin.nu/git/%3CTMPL_VAR%20NAME=PAGE%3E?a=blobdiff_plain;f=DiscordContext.pm;h=f8a0a089ea6a5427f4d53834b17725840538bf43;hb=faaa3329a3df738727b7ff63831c195a3c81ad09;hp=8de77c09c17cc2ff37052d3959c3b2686dbf6802;hpb=8211693b922ad772efc64463431f667d3baaceea;p=NDIRC.git
diff --git a/DiscordContext.pm b/DiscordContext.pm
index 8de77c0..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 {
@@ -57,6 +79,11 @@ sub message {
$self->bot->discordMessage($target, $msg ); # Send the response.
}
+sub replyId {
+ my $self = shift;
+ return "D-".$self->channel_id;
+}
+
sub _build_uid {
my ($self) = @_;