From 5670a12d2c6fe1b480aaca4221c7e24f5e94e1a0 Mon Sep 17 00:00:00 2001
From: Remco <SteamingMutt@users.noreply.github.com>
Date: Thu, 17 Dec 2015 18:49:08 +0100
Subject: [PATCH] Hopefully fixing crashing when using deletion in DM

---
 README.md      | 2 +-
 discord_bot.js | 5 ++++-
 package.json   | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md
index eac6499..f27c874 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
 # DougleyBot
-[![Version](https://img.shields.io/badge/Version-1.3.3-green.svg?style=flat-square)](https://github.com/SteamingMutt/DougleyBot/releases)
+[![Version](https://img.shields.io/badge/Version-1.3.4-green.svg?style=flat-square)](https://github.com/SteamingMutt/DougleyBot/releases)
 [![Status](https://img.shields.io/badge/Status-Ready-green.svg?style=flat-square)]()
 [![Node](https://img.shields.io/badge/Node-4.2.2-blue.svg?style=flat-square)](http://nodejs.org)
 [![NPM](https://img.shields.io/badge/NPM-3.5.0-blue.svg?style=flat-square)](http://nodejs.org)
diff --git a/discord_bot.js b/discord_bot.js
index 91bc4dd..0c50e77 100644
--- a/discord_bot.js
+++ b/discord_bot.js
@@ -294,6 +294,7 @@ var commands = {
         }
         if (imgArray.indexOf(suffix) !== -1) {
           bot.sendFile(msg.channel, "./images/" + suffix);
+          if (!msg.channel.server){return;}
           var bot_permissions = msg.channel.permissionsOf(bot.user);
           if (bot_permissions.hasPermission("manageMessages")) {
             bot.deleteMessage(msg);
@@ -376,7 +377,8 @@ var commands = {
     process: function(bot, msg, suffix) {
       var bot_permissions = msg.channel.permissionsOf(bot.user);
       if (suffix.search("!say") === -1) {
-        bot.sendMessage(msg.channel, suffix, true);
+        bot.sendMessage(msg.channel, suffix, true + "-" + msg.author + " " + Date.getFullYear());
+        if (!msg.channel.server){return;}
         if (bot_permissions.hasPermission("manageMessages")) {
           bot.deleteMessage(msg);
           return;
@@ -491,6 +493,7 @@ var commands = {
       imgflipper.generateMeme(meme[memetype], tags[1] ? tags[1] : "", tags[3] ? tags[3] : "", function(err, image) {
         //CmdErrorLog.log("debug", arguments);
         bot.sendMessage(msg.channel, image);
+        if (!msg.channel.server){return;}
         var bot_permissions = msg.channel.permissionsOf(bot.user);
         if (bot_permissions.hasPermission("manageMessages")) {
           bot.deleteMessage(msg);
diff --git a/package.json b/package.json
index 3bf7dae..8dc6007 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "DougleyBot",
-  "version": "1.3.3",
+  "version": "1.3.4",
   "description": "Bot for Discord app",
   "readme": "README.md",
   "maintainers": [],