Compare commits

..

2 Commits

Author SHA1 Message Date
ec6e6e0f60 thing for access archived channls 2021-12-02 12:11:29 -08:00
028395b9b2 t 2021-12-02 11:59:57 -08:00
2 changed files with 27 additions and 8 deletions

View File

@ -6,14 +6,20 @@ var client = module.exports = new Discord.Client({
intents: 32767 //all intents: 32767 //all
}); });
client.login(config.token).then(async () => {
console.log("ready");
(await client.channels.fetch(config.bot_channel))?.send('a');
});
/* small misc stuff here */
// small misc stuff here ////////////////////////////////////////////////////////////////////////////////////////
client.on("guildMemberAdd", member => { client.on("guildMemberAdd", member => {
if (member.guild.id != config.guild) return; if (member.guild.id != config.guild) return;
// add role
member.roles.add(member.user.bot ? config.bot_role : config.human_role); member.roles.add(member.user.bot ? config.bot_role : config.human_role);
// join message
client.channels.resolve(config.default_channel)?.send(random([ client.channels.resolve(config.default_channel)?.send(random([
`${member.user.username} join`, `${member.user.username} join`,
`${member.user.username} joined`, `${member.user.username} joined`,
@ -23,17 +29,24 @@ client.on("guildMemberAdd", member => {
}); });
client.on("guildMemberRemove", member => { client.on("guildMemberRemove", member => {
if (member.guild.id != config.guild) return; if (member.guild.id != config.guild) return;
// leave message
client.channels.resolve(config.default_channel)?.send(random([ client.channels.resolve(config.default_channel)?.send(random([
`${member.user.username} left`, `${member.user.username} left`,
`${member.user.username} disappear`, `${member.user.username} disappear`,
`${member.user.username.toLowerCase()} gone` `${member.user.username.toLowerCase()} gone`
])); ]));
}); });
client.on("messageCreate", message => { client.on("messageCreate", message => {
// comment thread on announcements
message.channel.id == config.announcement_channel && message.startThread({name: "Comments"}); message.channel.id == config.announcement_channel && message.startThread({name: "Comments"});
// stupid m bot
message.author.id == "732072478519722096" && message.content.endsWith("is bad letter m is much better") && message.delete(); message.author.id == "732072478519722096" && message.content.endsWith("is bad letter m is much better") && message.delete();
}); });
// add reactions to video and audio
{ {
let a = async m => { let a = async m => {
if (m.guild?.id != config.guild) return; if (m.guild?.id != config.guild) return;
@ -50,10 +63,14 @@ client.on("messageCreate", message => {
client.on("messageUpdate", (r, q) => a(q)); client.on("messageUpdate", (r, q) => a(q));
} }
// thing to access archived channels
client.on("voiceStateUpdate", (oldState, newState) => {
if (newState.guild.id != config.guild) return;
client.login(config.token).then(async () => { if (oldState.channelId != config.archive_portal_voice_channel && newState.channelId == config.archive_portal_voice_channel) {
console.log("ready"); // join
(await client.channels.fetch(config.bot_channel))?.send('a'); newState.member?.roles.add(config.view_archived_channels_role);
} else if (oldState.channelId == config.archive_portal_voice_channel && newState.channelId != config.archive_portal_voice_channel) {
// leave
newState.member?.roles.remove(config.view_archived_channels_role);
}
}); });

View File

@ -8,6 +8,7 @@ module.exports = {
human_role: "672956630962274306", human_role: "672956630962274306",
bot_role: "673671040010027034", bot_role: "673671040010027034",
inactive_role: "892869309603389500", inactive_role: "892869309603389500",
view_archived_channels_role: "916056534402863125",
eval_undefined_emoji: "707729833601531935", eval_undefined_emoji: "707729833601531935",
mi_emoji: "887931046086185060", mi_emoji: "887931046086185060",
ki_emoji: "887935846710394910", ki_emoji: "887935846710394910",
@ -19,6 +20,7 @@ module.exports = {
announcement_channel: "876010629490683955", announcement_channel: "876010629490683955",
miku_channel: "900583427483516938", miku_channel: "900583427483516938",
archive_category: "887838689533771776", archive_category: "887838689533771776",
archive_portal_voice_channel: "916057450313023508",
data_dir: process.cwd() + "/data/", data_dir: process.cwd() + "/data/",
base_uri: "https://ldb.owo69.me", base_uri: "https://ldb.owo69.me",
world_clock: [ world_clock: [