Added streaminfo message and system info module

This commit is contained in:
WatDuhHekBro 2021-04-08 16:43:58 -05:00
parent dd6f04fb25
commit a7aea6a28e
5 changed files with 71 additions and 58 deletions

View File

@ -8,8 +8,15 @@ export default new NamedCommand({
if (streamList.has(userID)) {
const stream = streamList.get(userID)!;
stream.description = args.join(" ") || "No description set.";
const description = args.join(" ") || "No description set.";
stream.description = description;
stream.update();
channel.send(`Successfully set the stream description to:`, {
embed: {
description,
color: member!.displayColor
}
});
} else {
// Alternatively, I could make descriptions last outside of just one stream.
channel.send("You can only use this command when streaming.");

View File

@ -66,7 +66,7 @@ import "./modules/ready";
import "./modules/presence";
import "./modules/lavalink";
import "./modules/emoteRegistry";
import "./modules/channelListener";
import "./modules/systemInfo";
import "./modules/intercept";
import "./modules/messageEmbed";
import "./modules/guildMemberAdd";

View File

@ -1,20 +0,0 @@
import {client} from "../index";
import {GuildChannel} from "discord.js";
client.on("channelCreate", async (channel) => {
const botGuilds = client.guilds;
if (channel instanceof GuildChannel) {
const createdGuild = await botGuilds.fetch(channel.guild.id);
console.log(`Channel created in '${createdGuild.name}' called '#${channel.name}'`);
}
});
client.on("channelDelete", async (channel) => {
const botGuilds = client.guilds;
if (channel instanceof GuildChannel) {
const createdGuild = await botGuilds.fetch(channel.guild.id);
console.log(`Channel deleted in '${createdGuild.name}' called '#${channel.name}'`);
}
});

View File

@ -1,7 +1,6 @@
import {client} from "../index";
import FileManager from "./storage";
import {EmoteRegistryDump, Config} from "../structures";
import {TextChannel} from "discord.js";
import {EmoteRegistryDump} from "../structures";
function updateGlobalEmoteRegistry(): void {
const data: EmoteRegistryDump = {version: 1, list: []};
@ -39,43 +38,13 @@ client.on("emojiUpdate", () => {
updateGlobalEmoteRegistry();
});
client.on("guildCreate", (guild) => {
console.log(
`[GUILD JOIN] ${guild.name} (${guild.id}) added the bot. Owner: ${guild.owner!.user.tag} (${
guild.owner!.user.id
}). Updated emote registry.`
);
if (Config.systemLogsChannel) {
const channel = client.channels.cache.get(Config.systemLogsChannel);
if (channel && channel.type === "text") {
(channel as TextChannel).send(
`TravBot joined: \`${guild.name}\`. The owner of this guild is: \`${guild.owner!.user.tag}\` (\`${
guild.owner!.user.id
}\`)`
);
} else {
console.warn(`${Config.systemLogsChannel} is not a valid text channel for system logs!`);
}
}
client.on("guildCreate", () => {
console.log("Updated emote registry.");
updateGlobalEmoteRegistry();
});
client.on("guildDelete", (guild) => {
console.log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot. Updated emote registry.`);
if (Config.systemLogsChannel) {
const channel = client.channels.cache.get(Config.systemLogsChannel);
if (channel && channel.type === "text") {
(channel as TextChannel).send(`\`${guild.name}\` (\`${guild.id}\`) removed the bot.`);
} else {
console.warn(`${Config.systemLogsChannel} is not a valid text channel for system logs!`);
}
}
client.on("guildDelete", () => {
console.log("Updated emote registry.");
updateGlobalEmoteRegistry();
});

57
src/modules/systemInfo.ts Normal file
View File

@ -0,0 +1,57 @@
import {client} from "../index";
import {GuildChannel, TextChannel} from "discord.js";
import {Config} from "../structures";
client.on("channelCreate", async (channel) => {
const botGuilds = client.guilds;
if (channel instanceof GuildChannel) {
const createdGuild = await botGuilds.fetch(channel.guild.id);
console.log(`Channel created in '${createdGuild.name}' called '#${channel.name}'`);
}
});
client.on("channelDelete", async (channel) => {
const botGuilds = client.guilds;
if (channel instanceof GuildChannel) {
const createdGuild = await botGuilds.fetch(channel.guild.id);
console.log(`Channel deleted in '${createdGuild.name}' called '#${channel.name}'`);
}
});
client.on("guildCreate", (guild) => {
console.log(
`[GUILD JOIN] ${guild.name} (${guild.id}) added the bot. Owner: ${guild.owner!.user.tag} (${
guild.owner!.user.id
}).`
);
if (Config.systemLogsChannel) {
const channel = client.channels.cache.get(Config.systemLogsChannel);
if (channel && channel.type === "text") {
(channel as TextChannel).send(
`TravBot joined: \`${guild.name}\`. The owner of this guild is: \`${guild.owner!.user.tag}\` (\`${
guild.owner!.user.id
}\`)`
);
} else {
console.warn(`${Config.systemLogsChannel} is not a valid text channel for system logs!`);
}
}
});
client.on("guildDelete", (guild) => {
console.log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot.`);
if (Config.systemLogsChannel) {
const channel = client.channels.cache.get(Config.systemLogsChannel);
if (channel && channel.type === "text") {
(channel as TextChannel).send(`\`${guild.name}\` (\`${guild.id}\`) removed the bot.`);
} else {
console.warn(`${Config.systemLogsChannel} is not a valid text channel for system logs!`);
}
}
});