├── .gitignore
├── LICENSE
├── README.md
├── config.json.example
├── discord_bot.js
├── images
├── clubpenguin.jpeg
├── dankocmeme.jpg
├── happening.gif
├── highqualitybait.png
├── johncena.gif
├── kappa.png
├── newfeaturespls.jpg
├── subparmeme.jpg
├── topkek.png
└── trollingtheinterwebs.png
├── logs
└── Beta.txt
├── memes.txt
├── music
├── Beta.txt
└── Monkeys Spinning Monkeys.mp3
├── package.json
├── runtime
├── abbreviations.json
├── logger.js
├── memes.json
├── rss.json.example
├── versioncheck.js
└── youtube_plugin.js
└── test.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # Runtime data
2 | pids
3 | *.pid
4 | *.seed
5 |
6 | # Directory for instrumented libs generated by jscoverage/JSCover
7 | lib-cov
8 |
9 | # Coverage directory used by tools like istanbul
10 | coverage
11 |
12 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
13 | .grunt
14 |
15 | # node-waf configuration
16 | .lock-wscript
17 |
18 | # Compiled binary addons (http://nodejs.org/api/addons.html)
19 | build/Release
20 |
21 | # Dependency directory
22 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
23 | node_modules
24 | build
25 |
26 | # Auth file shouldn't be checked in!
27 | config.json
28 |
29 | # Other runtime config files
30 | rss.json
31 |
32 | # Files not ment for this git
33 | discord_bot_experimental.js
34 | *.coffee
35 | discord_bot_production.js
36 | auth.json
37 | alias.json
38 | *.tern-project
39 | npm-debug.log
40 |
41 | # Folders with UGC should not be uploaded
42 | images
43 | music
44 | logs
45 | memes.txt
46 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DougleyBot is now obsolete, and has been replaced with [WildBeast](https://github.com/SteamingMutt/WildBeast), this repo WON'T recieve any updating of any kind!
2 | ## DougleyBot
3 |
4 | [](https://github.com/SteamingMutt/DougleyBot/releases)
5 | []()
6 | [](http://nodejs.org)
7 | [](http://nodejs.org)
8 | []()
9 | []()
10 | [ ](https://codeship.com/projects/123519)
11 |
12 | A chat bot for discord app based off Chalda's DiscordBot, which is based off discord.js.
13 | More info can be found on DougleyBot's wiki, or on the [site.](http://steamingmutt.github.io/DougleyBot)
14 |
15 | # If you're not very technical
16 | **For the sake of decentralisation, consider using your own copy of DougleyBot.**
17 |
18 | If you plan on just using DougleyBot as a chatbot, and don't plan on using the files, you can make DougleyBot join your server via DougleyBot's Test server (https://discord.gg/0cFoiR5QVh57Spqg). Use `!join-server DougleyBot ` to make DougleyBot join your server.
19 | **Note** that admin restricted commands, like `!pullanddeploy`, `!online` and `!idle`, don't work on this instance.
20 |
21 | # Contributing
22 | All contributions are more than welcome!
23 | Check the wiki for more info.
24 |
25 | ## Todo
26 |
27 | - [x] Make it that bot runs without some of the code from the original DiscordBot.
28 | - [x] Clean up the code a bit.
29 | - [ ] Clean up the code some more.
30 | - [x] Make it so that !help takes arguments, so it can explain functions independently.
31 | - [x] Add permissions to certain commands. (Like !pullanddeploy, !online, !idle)
32 | - [ ] Make permissions more advanced.
33 | - [x] Add more memes and abbreviations for the !meme and !game commands.
34 | - [ ] Add even more memes and abbreviations.
35 | - [ ] Create a function that will pull the popular memes from Imgflip, and integrate them automatically.
36 | - [x] Integrate !memehelp into !help.
37 | - [ ] Integrate a WolframAlpha command. The original DiscordBot had one, but that didn't work.
38 | - [x] Make it so that log files are written when !log is used, instead of printing them to the console.
39 | - [x] Make it so that !help outputs into a DM, instead of printing it into the channel.
40 | - [x] Integrate Cleverbot support, but restrict it to a certain channel.
41 | - [ ] Integrate a function to make DougleyBot stream music to a certain voice channel. (discord.js is being rewritten to support voice.)
42 | - [ ] Create a function to make DougleyBot create text/voice channels, but restrict it to a certain permission.
43 |
--------------------------------------------------------------------------------
/config.json.example:
--------------------------------------------------------------------------------
1 | {
2 | "discord_email" : "E-mail address from the bot's Discord account",
3 | "discord_password" : "Password from the bot's Discord account",
4 | "youtube_api_key": "Create one here: https://console.developers.google.com",
5 | "imgflip_username": "Imgflip username",
6 | "imgflip_password": "Imgflip password",
7 | "wolfram_api_key": "Optional, not currently needed",
8 | "myapifilms_token": "http://api.myapifilms.com/requestToken.do",
9 | "steam_api_key": "http://steamcommunity.com/dev/apikey",
10 | "google_custom_search": "https://github.com/SteamingMutt/DougleyBot/wiki/CSE",
11 | "command_prefix": "Enter a symbol you want to use as the command prefix",
12 | "log_chat": false,
13 | "join_servers_on_startup": "Enter a instant-invite here that you want the bot to join on start-up",
14 | "admin_ids": ["108125505714139136", "107904023901777920", "110147170740494336"],
15 | "image_folder": "./images",
16 | "music_folder": "./music"
17 | }
18 |
--------------------------------------------------------------------------------
/discord_bot.js:
--------------------------------------------------------------------------------
1 | /*
2 | ========================
3 | This is a "ping-pong bot"
4 | Everytime a message matches a command, the bot will respond.
5 | ========================
6 | */
7 | var VersionChecker = require("./runtime/versioncheck");
8 |
9 | var Cleverbot = require('cleverbot-node');
10 | var cleverbot = new Cleverbot();
11 |
12 | var ChatLog = require("./runtime/logger.js").ChatLog;
13 | var Logger = require("./runtime/logger.js").Logger;
14 |
15 | var maintenance;
16 |
17 | var version = require("./package.json").version;
18 |
19 | var Discord = require("discord.js");
20 |
21 | var yt = require("./runtime/youtube_plugin");
22 | var youtube_plugin = new yt();
23 |
24 | var min = 1;
25 | var max = 671;
26 |
27 | var cmdPrefix = require("./config.json").command_prefix;
28 |
29 | var aliases;
30 |
31 | //Allowed send file types for !iff
32 | var ext = [".jpg", ".jpeg", ".gif", ".png"];
33 | var imgDirectory = require("./config.json").image_folder;
34 |
35 | // Get the email and password
36 | var ConfigFile = require("./config.json");
37 | var qs = require("querystring");
38 |
39 | var htmlToText = require('html-to-text');
40 |
41 | var config = {
42 | "api_key": "dc6zaTOxFJmzC",
43 | "rating": "r",
44 | "url": "http://api.giphy.com/v1/gifs/search",
45 | "permission": ["NORMAL"]
46 | };
47 |
48 | var meme = require("./runtime/memes.json");
49 |
50 | var game_abbreviations = require("./runtime/abbreviations.json");
51 |
52 | var cmdLastExecutedTime = {};
53 |
54 | var admin_ids = require("./config.json").admin_ids;
55 |
56 | /*
57 | ========================
58 | Commands.
59 |
60 | These are the commands, as described in the wiki, they can be adjusted to your needs.
61 | None of the commands given here are required for the bot to run.
62 | ========================
63 | */
64 |
65 | var commands = {
66 | "gif": {
67 | name: "gif",
68 | description: "Returns a random gif matching the tags passed.",
69 | extendedhelp: "I will search Giphy for a gif matching your tags.",
70 | usage: "",
71 | process: function(bot, msg, suffix) {
72 | var tags = suffix.split(" ");
73 | get_gif(tags, function(id) {
74 | if (typeof id !== "undefined") {
75 | bot.sendMessage(msg.channel, "http://media.giphy.com/media/" + id + "/giphy.gif [Tags: " + (tags ? tags : "Random GIF") + "]");
76 | } else {
77 | bot.sendMessage(msg.channel, "Invalid tags, try something different. For example, something that exists [Tags: " + (tags ? tags : "Random GIF") + "]");
78 | }
79 | });
80 | }
81 | },
82 | "maintenance-mode": {
83 | name: "maintenance-mode",
84 | description: "Enables maintenance mode.",
85 | extendedhelp: "This will disable my command interpeter for a given amount of seconds, making me inable to execute commands.",
86 | usage: "",
87 | adminOnly: true,
88 | process: function(bot, msg, suffix) {
89 | Logger.log("warn", "Maintenance mode activated for " + suffix + " seconds.");
90 | bot.sendMessage(msg.channel, "The bot is now in maintenance mode, commands **will NOT** work!");
91 | bot.setPlayingGame(525);
92 | bot.setStatusIdle();
93 | maintenance = "true";
94 | setTimeout(continueExecution, Math.round(suffix * 1000));
95 |
96 | function continueExecution() {
97 | Logger.log("info", "Maintenance ended.");
98 | bot.sendMessage(msg.channel, "Maintenance period ended, returning to normal.");
99 | bot.setPlayingGame(308);
100 | bot.setStatusOnline();
101 | maintenance = null;
102 | }
103 | }
104 | },
105 | "info": {
106 | name: "info",
107 | description: "Tells a bit of info about the bot.",
108 | extendedhelp: "I'll tell you some information about myself.",
109 | process: function(bot, msg) {
110 | var msgArray = [];
111 | msgArray.push("Hello, I'm " + bot.user.username + ", a Discord bot.");
112 | msgArray.push("I'm currently running on DougleyBot version " + version + ", which utilizes the latest version of Discord.js, an *unofficial* Discord libary by hydrabolt.");
113 | msgArray.push("The developers of my source code are Dougley and Perpetucake, you can contact them via the test server.");
114 | msgArray.push("https://discord.gg/0cFoiR5QVh4agupi");
115 | msgArray.push("To see what I can do, use `" + ConfigFile.command_prefix + "help`");
116 | msgArray.push("My invocation method is using prefixes, currently, I only respond to messages beginning with `" + ConfigFile.command_prefix + "`");
117 | bot.sendMessage(msg.author, msgArray);
118 | }
119 | },
120 | "ping": {
121 | name: "ping",
122 | description: "Responds pong, useful for checking if bot is alive.",
123 | extendedhelp: "I'll reply to you with ping, this way you can see if I'm still able to take commands.",
124 | process: function(bot, msg, suffix) {
125 | bot.sendMessage(msg.channel, " " + msg.sender + " pong!");
126 | if (suffix) {
127 | bot.sendMessage(msg.channel, "note that !ping takes no arguments!");
128 | }
129 | }
130 | },
131 | "cleverbot": {
132 | name: "cleverbot",
133 | description: "Talk to Cleverbot!",
134 | extendedhelp: "I'll act as Cleverbot when you execute this command, remember to enter a message as suffix.",
135 | usage: "",
136 | process: function(bot, msg, suffix) {
137 | Cleverbot.prepare(function() {
138 | bot.startTyping(msg.channel);
139 | cleverbot.write(suffix, function(response) {
140 | bot.sendMessage(msg.channel, response.message);
141 | bot.stopTyping(msg.channel);
142 | });
143 | });
144 | }
145 | },
146 | "devs": {
147 | name: "devs",
148 | description: "Prints the devs of DougleyBot to the channel.",
149 | extendedhelp: "This will print the Discord ID's from the developers of DougleyBot to the channel.",
150 | process: function(bot, msg, suffix) {
151 | bot.sendMessage(msg.channel, "Made with love by <@107904023901777920> and <@108125505714139136>. <3 <@110147170740494336> did stuff too.");
152 | }
153 | },
154 | "status": {
155 | name: "status",
156 | description: "Prints the stats from the instance into the chat.",
157 | extendedhelp: "This will print some information about the instance of the bot to the channel, like uptime and currently connected users.",
158 | process: function(bot, msg, suffix) {
159 | var msgArray = [];
160 | msgArray.push("My uptime is " + (Math.round(bot.uptime / (1000 * 60 * 60))) + " hours, " + (Math.round(bot.uptime / (1000 * 60)) % 60) + " minutes, and " + (Math.round(bot.uptime / 1000) % 60) + " seconds.");
161 | msgArray.push("Currently, I'm in " + bot.servers.length + " servers, and in " + bot.channels.length + " channels.");
162 | msgArray.push("Currently, I'm serving " + bot.users.length + " users.");
163 | msgArray.push("To Discord, I'm known as " + bot.user + ", and I'm running DougleyBot version " + version);
164 | Logger.log("debug", msg.sender.username + " requested the bot status.");
165 | bot.sendMessage(msg, msgArray);
166 | }
167 | },
168 | "hello": {
169 | name: "hello",
170 | description: "Gives a friendly greeting, including github link.",
171 | extendedhelp: "I'll respond to you with hello along with a GitHub link, handy!",
172 | process: function(bot, msg) {
173 | bot.sendMessage(msg.channel, "Hello " + msg.sender + "! I'm " + bot.user.username + ", help me grow by contributing to my GitHub: https://github.com/SteamingMutt/DougleyBot");
174 | }
175 | },
176 | "server-info": {
177 | name: "server-info",
178 | description: "Prints the information of the current server.",
179 | extendedhelp: "I'll tell you some information about the server and the channel you're currently in.",
180 | process: function(bot, msg, suffix) {
181 | // if we're not in a PM, return some info about the channel
182 | if (msg.channel.server) {
183 | var msgArray = [];
184 | msgArray.push("You are currently in " + msg.channel + " (id: " + msg.channel.id + ")");
185 | msgArray.push("on server **" + msg.channel.server.name + "** (id: " + msg.channel.server.id + ") (region: " + msg.channel.server.region + ")");
186 | msgArray.push("owned by " + msg.channel.server.owner + " (id: " + msg.channel.server.owner.id + ")");
187 | if (msg.channel.topic) {
188 | msgArray.push("The current topic is: " + msg.channel.topic);
189 | }
190 | bot.sendMessage(msg, msgArray);
191 | } else {
192 | bot.sendMessage(msg, "You can't do that in a DM, dummy!.");
193 | }
194 | }
195 | },
196 | "birds": {
197 | name: "birds",
198 | description: "What are birds?",
199 | extendedhelp: "The best stale meme evahr, IDST.",
200 | process: function(bot, msg) {
201 | var msgArray = [];
202 | msgArray.push("https://www.youtube.com/watch?v=Kh0Y2hVe_bw");
203 | msgArray.push("We just don't know");
204 | bot.sendMessage(msg, msgArray);
205 | }
206 | },
207 | "game": {
208 | name: "game",
209 | description: "Pings channel asking if anyone wants to play.",
210 | extendedhelp: "I'll ask the channel you're currently in if they want to play the game you provide me, try some abbreviations, some might work!",
211 | usage: "",
212 | process: function(bot, msg, suffix) {
213 | var game = game_abbreviations[suffix];
214 | if (!game) {
215 | game = suffix;
216 | }
217 | if (!msg.channel.permissionsOf(bot.user).hasPermission("mentionEveryone")) {
218 | bot.sendMessage(msg.channel, msg.sender + " would like to know if anyone is up for " + game);
219 | Logger.log("debug", "Sent game invites without @everyone for " + game);
220 | } else {
221 | bot.sendMessage(msg.channel, "@everyone, " + msg.sender + " would like to know if anyone is up for " + game);
222 | Logger.log("debug", "Sent game invites with @everyone for " + game);
223 | }
224 | }},
225 | "servers": {
226 | name: "servers",
227 | description: "Lists servers bot is connected to.",
228 | extendedhelp: "This will list all the servers I'm currently connected to, but if I'm in a lot of servers, don't expect a response.",
229 | adminOnly: true,
230 | process: function(bot, msg) {
231 | bot.sendMessage(msg.channel, bot.servers);
232 | }
233 | },
234 | "channels": {
235 | name: "channels",
236 | description: "Lists channels bot is connected to.",
237 | extendedhelp: "This will list all the channels I'm currently connected to, but if I'm in a lot of channels, don't expect a response.",
238 | adminOnly: true,
239 | process: function(bot, msg) {
240 | bot.sendMessage(msg.channel, bot.channels);
241 | }
242 | },
243 | "myid": {
244 | name: "myid",
245 | description: "Returns the user id of the sender.",
246 | extendedhelp: "This will print your Discord ID to the channel, useful if you want to define admins in your own instance.",
247 | process: function(bot, msg) {
248 | bot.sendMessage(msg.channel, msg.author.id);
249 | }
250 | },
251 | "idle": {
252 | name: "idle",
253 | description: "Sets bot status to idle.",
254 | extendedhelp: "This will change my status to idle.",
255 | adminOnly: true,
256 | process: function(bot, msg) {
257 | bot.setStatusIdle();
258 | Logger.log("debug", "My status has been changed to idle.");
259 | }
260 | },
261 | "killswitch": {
262 | name: "killswitch",
263 | description: "Kills all running instances of DougleyBot.",
264 | extendedhelp: "This will instantly terminate all of the running instances of the bot without restarting.",
265 | adminOnly: true,
266 | process: function(bot, msg) {
267 | bot.sendMessage(msg.channel, "An admin has requested to kill all instances of DougleyBot, exiting...");
268 | bot.logout();
269 | Logger.log("warn", "Disconnected via killswitch!");
270 | process.exit(0);
271 | } //exit node.js without an error
272 | },
273 | "addmeme": {
274 | name: "addmeme",
275 | description: "Adds a meme.",
276 | adminOnly: true,
277 | extendedhelp: "Type !addmeme followed by text to add that text to the memelist.", //Just uses memes.txt in root folder.
278 | process: function(bot, msg, suffix) {
279 | var fs = require ("fs");
280 | fs.appendFile('memes.txt', suffix + " ~END\n", function(err) {
281 | });
282 | bot.sendMessage(msg.channel, "Added '" + suffix + "' as a meme.");
283 | }
284 | },
285 | "saymeme":{
286 | name: "saymeme",
287 | description: "Say a meme",
288 | extendedhelp: "Makes the bot say a random meme from the meme list",
289 | process: function(bot, msg) {
290 | var fs = require ("fs");
291 | fs.readFile('memes.txt', "utf8", function(err, fileContents) {
292 | var lines = fileContents.split(" ~END\n");
293 | bot.sendMessage(msg.channel, lines[Math.floor(Math.random()*lines.length) -1]);
294 | });
295 | }
296 | },
297 | "purge": {
298 | name: "purge",
299 | usage: " [force]",
300 | extendedhelp: "I'll delete a certain ammount of messages.",
301 | process: function(bot, msg, suffix) {
302 | if (!msg.channel.server) {
303 | bot.sendMessage(msg.channel, "You can't do that in a DM, dummy!");
304 | return;
305 | }
306 | if (!suffix){
307 | bot.sendMessage(msg.channel, "Please define an ammount of messages for me to delete!");
308 | return;
309 | }
310 | if (!msg.channel.permissionsOf(msg.sender).hasPermission("manageMessages")) {
311 | bot.sendMessage(msg.channel, "Sorry, your permissions doesn't allow that.");
312 | return;
313 | }
314 | if (!msg.channel.permissionsOf(bot.user).hasPermission("manageMessages")) {
315 | bot.sendMessage(msg.channel, "I don't have permission to do that!");
316 | return;
317 | }
318 | if (suffix.split(" ")[0] > 20 && msg.content != "force"){
319 | bot.sendMessage(msg.channel, "I can't delete that much messages in safe-mode, add `force` to your message to force me to delete.");
320 | return;
321 | }
322 | if (suffix.split(" ")[0] > 100){
323 | bot.sendMessage(msg.channel, "The maximum is 100, 20 without `force`.");
324 | return;
325 | }
326 | if (suffix.split(" ")[0] == "force"){
327 | bot.sendMessage(msg.channel, "Please put `force` at the end of your message.");
328 | return;
329 | }
330 | bot.getChannelLogs(msg.channel, suffix.split(" ")[0], function(error, messages){
331 | if (error){
332 | bot.sendMessage(msg.channel, "Something went wrong while fetching logs.");
333 | return;
334 | } else {
335 | Logger.info("Beginning purge...");
336 | var todo = messages.length,
337 | delcount = 0;
338 | for (msg of messages){
339 | bot.deleteMessage(msg);
340 | todo--;
341 | delcount++;
342 | if (todo === 0){
343 | bot.sendMessage(msg.channel, "Done! Deleted " + delcount + " messages.");
344 | Logger.info("Ending purge, deleted " + delcount + " messages.");
345 | return;
346 | }}
347 | }
348 | }
349 | );}},
350 | "kappa": {
351 | name: "kappa",
352 | description: "Kappa all day long!",
353 | extendedhelp: "KappaKappaKappaKappaKappaKappaKappaKappaKappaKappa",
354 | process: function(bot, msg, suffix) {
355 | bot.sendFile(msg.channel, "./images/kappa.png");
356 | if (msg.channel.server){
357 | var bot_permissions = msg.channel.permissionsOf(bot.user);
358 | if (bot_permissions.hasPermission("manageMessages")) {
359 | bot.deleteMessage(msg);
360 | return;
361 | } else {
362 | bot.sendMessage(msg.channel, "*This works best when I have the permission to delete messages!*");
363 | }}
364 | }
365 | },
366 | "iff": {
367 | name: "iff",
368 | description: "Send an image from the ./images/ directory!",
369 | extendedhelp: "I'll send an image from the image directory to the chat.",
370 | usage: "[image name] -ext",
371 | process: function(bot, msg, suffix) {
372 | var fs = require("fs");
373 | var path = require("path");
374 | var imgArray = [];
375 | fs.readdir(imgDirectory, function(err, dirContents) {
376 | for (var i = 0; i < dirContents.length; i++) {
377 | for (var o = 0; o < ext.length; o++) {
378 | if (path.extname(dirContents[i]) === ext[o]) {
379 | imgArray.push(dirContents[i]);
380 | }
381 | }
382 | }
383 | if (imgArray.indexOf(suffix) !== -1) {
384 | bot.sendFile(msg.channel, "./images/" + suffix);
385 | if (msg.channel.server){
386 | var bot_permissions = msg.channel.permissionsOf(bot.user);
387 | if (bot_permissions.hasPermission("manageMessages")) {
388 | bot.deleteMessage(msg);
389 | return;
390 | } else {
391 | bot.sendMessage(msg.channel, "*This works best when I have the permission to delete messages!*");
392 | }}
393 | } else {
394 | bot.sendMessage(msg.channel, "*Invalid input!*");
395 | }
396 | });
397 | }
398 | },
399 | "imglist": {
400 | name: "imglist",
401 | description: "List's ./images/ dir!",
402 | extendedhelp: "I'll list the images in the images directory for you, use them with the " + ConfigFile.command_prefix + "iff command!",
403 | process: function(bot, msg, suffix) {
404 | var fs = require("fs");
405 | var path = require("path");
406 | var imgArray = [];
407 | fs.readdir(imgDirectory, function(err, dirContents) {
408 | for (var i = 0; i < dirContents.length; i++) {
409 | for (var o = 0; o < ext.length; o++) {
410 | if (path.extname(dirContents[i]) === ext[o]) {
411 | imgArray.push(dirContents[i]);
412 | }
413 | }
414 | }
415 | bot.sendMessage(msg.channel, imgArray);
416 | });
417 | }
418 | },
419 | "leave": {
420 | name: "leave",
421 | description: "Asks the bot to leave the current server.",
422 | extendedhelp: "I'll leave the server in which the command is executed, you'll need the *Manage server* permission in your role to use this command.",
423 | process: function(bot, msg, suffix) {
424 | if (msg.channel.server) {
425 | if (msg.channel.permissionsOf(msg.sender).hasPermission("manageServer")) {
426 | bot.sendMessage(msg.channel, "Alright, see ya!");
427 | bot.leaveServer(msg.channel.server);
428 | Logger.log("info", "I've left a server on request of " + msg.sender.username + ", I'm only in " + bot.servers.length + " servers now.");
429 | return;
430 | } else {
431 | bot.sendMessage(msg.channel, "Can't tell me what to do. (Your role in this server needs the permission to manage the server to use this command.)");
432 | Logger.log("warn", "A non-privileged user (" + msg.sender.username + ") tried to make me leave a server.");
433 | return;
434 | }
435 | } else {
436 | bot.sendMessage(msg.channel, "I can't leave a DM, dummy!");
437 | return;
438 | }
439 | }
440 | },
441 | "online": {
442 | name: "online",
443 | description: "Sets bot status to online.",
444 | extendedhelp: "I'll change my status to online.",
445 | adminOnly: true,
446 | process: function(bot, msg) {
447 | bot.setStatusOnline();
448 | Logger.log("debug", "My status has been changed to online.");
449 | }
450 | },
451 | "youtube": {
452 | name: "youtube",
453 | description: "Gets a Youtube video matching given tags.",
454 | extendedhelp: "I'll search YouTube for a video matching your given tags.",
455 | usage: "