X-Git-Url: https://ruin.nu/git/%3CTMPL_VAR%20NAME=PAGE%3E?a=blobdiff_plain;f=DiscordContext.pm;h=f8a0a089ea6a5427f4d53834b17725840538bf43;hb=26cc9349b7b35318231d1dc8f236a7ac3dc8dcf2;hp=4418959c021878dff7b396bfd668ae1b95c52e4f;hpb=bd6624a4e56ad6968b57b76786ebd8787433ead4;p=NDIRC.git
diff --git a/DiscordContext.pm b/DiscordContext.pm
index 4418959..f8a0a08 100644
--- a/DiscordContext.pm
+++ b/DiscordContext.pm
@@ -38,28 +38,51 @@ 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 {
my ($self, $target, $msg) = @_;
- $msg =~ s`(.*?)`**$1**`gi;
- $msg =~ s`(.*?)`*$2*`gi;
-
- $self->discord->send_message($target, $msg ); # Send the response.
+ $self->bot->discordMessage($target, $msg ); # Send the response.
}
+sub replyId {
+ my $self = shift;
+ return "D-".$self->channel_id;
+}
sub _build_uid {
my ($self) = @_;