Added basic twitter bot and spin, updated readme, other various changes
This commit is contained in:
parent
d661b58271
commit
f7756f1b52
14 changed files with 416 additions and 48 deletions
|
@ -75,9 +75,9 @@ module.exports = async (message) => {
|
|||
await client.createMessage(generalChannel.id, message.content);
|
||||
}
|
||||
}
|
||||
const odyMessages = ["Nope!", "No jojo gif here", "sorry ody, this gif is illegal", "get owned"];
|
||||
// || (message.attachments && message.attachments[0].filename === "1561668913236-3.gif")
|
||||
if (message.channel.guild.id === "322114245632327703" && (message.content.match(/https?:\/\/(media|cdn)\.discordapp\.(net|com)\/attachments\/596766080014221373\/606176845871972383\/1561668913236-3.gif/))) {
|
||||
const odyMessages = ["Nope!", "No jojo gif here", "sorry ody, this gif is illegal", "get owned"];
|
||||
await message.delete("anti-jojo mechanism");
|
||||
await client.createMessage(message.channel.id, misc.random(odyMessages));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ const database = require("../utils/database.js");
|
|||
const logger = require("../utils/logger.js");
|
||||
const messages = require("../messages.json");
|
||||
const misc = require("../utils/misc.js");
|
||||
const twitter = process.env.TWITTER === "true" ? require("../utils/twitter.js") : null;
|
||||
|
||||
// run when ready
|
||||
module.exports = async () => {
|
||||
|
@ -47,5 +48,29 @@ module.exports = async () => {
|
|||
setTimeout(activityChanger, 900000);
|
||||
})();
|
||||
|
||||
// tweet stuff
|
||||
if (twitter !== null) {
|
||||
(async function tweet() {
|
||||
const tweetContent = await misc.getTweet(twitter);
|
||||
const info = await twitter.client.post("statuses/update", { status: tweetContent });
|
||||
logger.log(`Tweet with id ${info.data.id_str} has been tweeted with status code ${info.resp.statusCode} ${info.resp.statusMessage}`);
|
||||
setTimeout(tweet, 1800000);
|
||||
})();
|
||||
const stream = twitter.client.stream("statuses/filter", {
|
||||
track: `@${process.env.HANDLE}`
|
||||
});
|
||||
stream.on("tweet", async (tweet) => {
|
||||
if (tweet.user.screen_name !== "esmBot_") {
|
||||
const tweetContent = await misc.getTweet(twitter, true);
|
||||
const payload = {
|
||||
status: `@${tweet.user.screen_name} ${tweetContent}`,
|
||||
in_reply_to_status_id: tweet.id_str
|
||||
};
|
||||
const info = await twitter.client.post("statuses/update", payload);
|
||||
logger.log(`Reply with id ${info.data.id_str} has been tweeted with status code ${info.resp.statusCode} ${info.resp.statusMessage}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
logger.log("info", `Successfully started ${client.user.username}#${client.user.discriminator} with ${client.users.size} users in ${client.guilds.size} servers.`);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue