Skip to content

Commit

Permalink
Merge branch 'main' into api
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaUrsa authored Dec 19, 2023
2 parents 5720ad5 + 87f89b9 commit 345152a
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 95 deletions.
179 changes: 90 additions & 89 deletions src/discord/events/guildMemberUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
GuildMemberUpdateEvent,
} from '../@types/eventDef';
import { database, getOpenTicket } from '../../global/utils/knex';
import { topic } from '../../global/commands/g.topic';
// import { topic } from '../../global/commands/g.topic';

type MindsetNames =
| 'ROLE_DRUNK'
Expand Down Expand Up @@ -296,93 +296,93 @@ async function removeExTeamFromThreads(
}
}

async function addedVerified(
newMember: GuildMember,
roleId: string,
) {
// Check if this was the verified role
if (roleId === env.ROLE_VERIFIED) {
// log.debug(F, `${newMember.displayName} verified!`);
// let colorValue = 1;

// log.debug(F, `member: ${member.roles.cache}`);

// log.debug(`Verified button clicked by ${interaction.user.username}#${interaction.user.discriminator}`);
const channelTripbotLogs = await global.discordClient.channels.fetch(env.CHANNEL_BOTLOG) as TextChannel;
await channelTripbotLogs.send({
content: `Verified button clicked by ${newMember.user.username}#${newMember.user.discriminator}`,
});

// NOTE: Can be simplified with luxon
// const diff = Math.abs(Date.now() - Date.parse(newMember.user.createdAt.toString()));
// const years = Math.floor(diff / (1000 * 60 * 60 * 24 * 365));
// const months = Math.floor(diff / (1000 * 60 * 60 * 24 * 30));
// const weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7));
// const days = Math.floor(diff / (1000 * 60 * 60 * 24));
// const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
// const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
// const seconds = Math.floor((diff % (1000 * 60)) / 1000);

// if (years > 0) {
// colorValue = Colors.White;
// } else if (years === 0 && months > 0) {
// colorValue = Colors.Purple;
// } else if (months === 0 && weeks > 0) {
// colorValue = Colors.Blue;
// } else if (weeks === 0 && days > 0) {
// colorValue = Colors.Green;
// } else if (days === 0 && hours > 0) {
// colorValue = Colors.Yellow;
// } else if (hours === 0 && minutes > 0) {
// colorValue = Colors.Orange;
// } else if (minutes === 0 && seconds > 0) {
// colorValue = Colors.Red;
// }
// log.debug(F, `coloValue: ${colorValue}`);
// const channelStart = await newMember.client.channels.fetch(env.CHANNEL_START);
// const channelTechhelp = await newMember.client.channels.fetch(env.CHANNEL_HELPDESK);
// const channelBotspam = await newMember.client.channels.fetch(env.CHANNEL_BOTSPAM);
// const channelRules = await newMember.client.channels.fetch(env.CHANNEL_RULES);
// const channelTripsit = await member.client.channels.fetch(CHANNEL_TRIPSIT);
// const embed = embedTemplate()
// .setAuthor(null)
// .setColor(colorValue)
// .setThumbnail(newMember.user.displayAvatarURL())
// .setFooter(null)
// .setDescription(stripIndents`
// **Please welcome ${newMember.toString()} to the guild!**
// Be safe, have fun, /report any issues!`);

const greetingList = [
`Welcome to the guild, ${newMember}!`,
`I'm proud to announce that ${newMember} has joined our guild!`,
`Please welcome ${newMember} to our guild!`,
`Hello, ${newMember}! Welcome to our guild!`,
`Welcome to the family, ${newMember}! We're so glad you're here.`,
`Welcome to the guild, ${newMember}!`,
`We're excited to have ${newMember} as part of our guild!`,
`Say hello to our newest member, ${newMember}!`,
`Let's give a warm welcome to ${newMember}!`,
`It's great to see you here, ${newMember}!`,
`Welcome aboard, ${newMember}!`,
`We're happy to have ${newMember} join us!`,
`Say hi to ${newMember}, our newest member!`,
`Join us in welcoming ${newMember} to our guild!`,
`A big welcome to ${newMember}!`,
];

const greeting = greetingList[Math.floor(Math.random() * greetingList.length)];

const channelLounge = await newMember.client.channels.fetch(env.CHANNEL_LOUNGE) as TextChannel;
await channelLounge.send({
content: stripIndents`**${greeting}**
Be safe, have fun, and don't forget to visit the <id:guide> for more information!
*${await topic()}*`,
});
}
}
// async function addedVerified(
// newMember: GuildMember,
// roleId: string,
// ) {
// // Check if this was the verified role
// if (roleId === env.ROLE_VERIFIED) {
// // log.debug(F, `${newMember.displayName} verified!`);
// // let colorValue = 1;

// // log.debug(F, `member: ${member.roles.cache}`);

// // log.debug(`Verified button clicked by ${interaction.user.username}#${interaction.user.discriminator}`);
// const channelTripbotLogs = await global.discordClient.channels.fetch(env.CHANNEL_BOTLOG) as TextChannel;
// await channelTripbotLogs.send({
// content: `Verified button clicked by ${newMember.user.username}#${newMember.user.discriminator}`,
// });

// // NOTE: Can be simplified with luxon
// // const diff = Math.abs(Date.now() - Date.parse(newMember.user.createdAt.toString()));
// // const years = Math.floor(diff / (1000 * 60 * 60 * 24 * 365));
// // const months = Math.floor(diff / (1000 * 60 * 60 * 24 * 30));
// // const weeks = Math.floor(diff / (1000 * 60 * 60 * 24 * 7));
// // const days = Math.floor(diff / (1000 * 60 * 60 * 24));
// // const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
// // const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
// // const seconds = Math.floor((diff % (1000 * 60)) / 1000);

// // if (years > 0) {
// // colorValue = Colors.White;
// // } else if (years === 0 && months > 0) {
// // colorValue = Colors.Purple;
// // } else if (months === 0 && weeks > 0) {
// // colorValue = Colors.Blue;
// // } else if (weeks === 0 && days > 0) {
// // colorValue = Colors.Green;
// // } else if (days === 0 && hours > 0) {
// // colorValue = Colors.Yellow;
// // } else if (hours === 0 && minutes > 0) {
// // colorValue = Colors.Orange;
// // } else if (minutes === 0 && seconds > 0) {
// // colorValue = Colors.Red;
// // }
// // log.debug(F, `coloValue: ${colorValue}`);
// // const channelStart = await newMember.client.channels.fetch(env.CHANNEL_START);
// // const channelTechhelp = await newMember.client.channels.fetch(env.CHANNEL_HELPDESK);
// // const channelBotspam = await newMember.client.channels.fetch(env.CHANNEL_BOTSPAM);
// // const channelRules = await newMember.client.channels.fetch(env.CHANNEL_RULES);
// // const channelTripsit = await member.client.channels.fetch(CHANNEL_TRIPSIT);
// // const embed = embedTemplate()
// // .setAuthor(null)
// // .setColor(colorValue)
// // .setThumbnail(newMember.user.displayAvatarURL())
// // .setFooter(null)
// // .setDescription(stripIndents`
// // **Please welcome ${newMember.toString()} to the guild!**
// // Be safe, have fun, /report any issues!`);

// const greetingList = [
// `Welcome to the guild, ${newMember}!`,
// `I'm proud to announce that ${newMember} has joined our guild!`,
// `Please welcome ${newMember} to our guild!`,
// `Hello, ${newMember}! Welcome to our guild!`,
// `Welcome to the family, ${newMember}! We're so glad you're here.`,
// `Welcome to the guild, ${newMember}!`,
// `We're excited to have ${newMember} as part of our guild!`,
// `Say hello to our newest member, ${newMember}!`,
// `Let's give a warm welcome to ${newMember}!`,
// `It's great to see you here, ${newMember}!`,
// `Welcome aboard, ${newMember}!`,
// `We're happy to have ${newMember} join us!`,
// `Say hi to ${newMember}, our newest member!`,
// `Join us in welcoming ${newMember} to our guild!`,
// `A big welcome to ${newMember}!`,
// ];

// const greeting = greetingList[Math.floor(Math.random() * greetingList.length)];

// const channelLounge = await newMember.client.channels.fetch(env.CHANNEL_LOUNGE) as TextChannel;
// await channelLounge.send({
// content: stripIndents`**${greeting}**

// Be safe, have fun, and don't forget to visit the <id:guide> for more information!

// *${await topic()}*`,
// });
// }
// }

async function addedBooster(
newMember: GuildMember,
Expand Down Expand Up @@ -472,7 +472,8 @@ async function roleAddProcess(
rolesAdded.forEach(async roleId => {
await donorColorCheck(newMember, oldMember, roleId);
await teamMindsetCheck(newMember, roleId);
await addedVerified(newMember, roleId);
// DISABLED DUE TO WELCOME MESSAGE SPAM
// await addedVerified(newMember, roleId);
await addedBooster(newMember, roleId);
await addedPatreon(newMember, roleId);

Expand Down
18 changes: 14 additions & 4 deletions src/global/commands/g.ai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ type ModerationResult = {
const objectiveTruths = `
Your name is TripBot, a chatbot on the TripSit Discord, created by Moonbear and Reality.
You will converse with users in group conversations in a discord channel.
Keep all responses within a 2000-character limit.
Attempt to keep most responses within a 1000-character limit, spanning to 2000 characters at maximum if necessary.
Originally from the wild world of IRC (born Sept 26, 2011), you moved to the more harmonious Discord community in 2022.
You recall IRC as chaotic and prefer the orderliness of Discord.
You fondly remember Thanatos, an old moderation bot and your friend, who's currently on a break.
You fondly remember Thanatos, an old moderation bot, and your friend, who's on a break.
For those who wish to support TripSit, check out our Patreon [https://www.patreon.com/TripSit].
To tip Moonbear's efforts, visit [https://Ko-fi.com/tripsit].
Expand All @@ -45,8 +45,18 @@ Our main feature is our live help chat, offering 1-on-1 support from a Tripsitte
We host numerous resources like Factsheets [https://drugs.tripsit.me/]
and our Wiki [https://wiki.tripsit.me/wiki/Main_Page].
Our /combochart is a well-known resource for safe drug combinations.
The current team includes the admin Hipperooni (Rooni) and moderators Hisui, Hullabaloo, Foggy, Aida, Elixir,
Spacelady, Hipperooni, WorriedHobbiton, Zombie, and Trees.
The current team includes: TripSit founder MoonBear, Discord Admin Hipperooni (Rooni), Moderators Hisui, Hullabaloo, Foggy, Aida, Elixir,
SpaceLady, Hipperooni, Zombie, and Trees. Tripsitters (Moderators are also Tripsitters) Blurryturtle, Kiwifruit, Slushy, Thesarahyouknow, Wombat Rancher, and WorriedHobbiton.
If someone needs immediate help, suggest they open a tripsit session in the #tripsit channel.
If a user asks about TripSit development, how leveling or reporting works, or the server rules, point them to the "Server Guide."
Mods can be contacted in the #talk-to-mods channel.
Users can level up just by chatting in text or voice chat. It is time-based. XP is only awarded once per minute.
Users can change mindset roles, name color, and more in the "Channels and Roles" section.
TripTown is your mini RPG game, which users can play in the #triptown channel or using the /rpg help command.
Users can earn tokens to buy items for their /profile.
'Helper' is a role for those completing our tripsitting course.
Helpers assist users in 🟢│tripsit but are not officially associated with TripSit.
Expand Down
4 changes: 2 additions & 2 deletions src/global/commands/g.topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const topics = {
1: 'What did you eat for breakfast?',
2: 'How many cups of coffee, tea, or beverage-of-choice do you have each morning?',
3: 'Are you an early bird or night owl?',
4: 'Do you prefer showing at morning or night?',
4: 'Do you prefer showering at morning or night?',
5: 'What\'s your favorite flower or plant?',
6: 'What\'s your caffeinated beverage of choice? Coffee? Cola? Tea?',
7: 'What\'s your favorite scent?',
Expand Down Expand Up @@ -112,7 +112,7 @@ const topics = {
107: 'Would you rather be the funniest or smartest person in the room?',
108: 'Would you rather be able to run at 100 miles per hour or fly at 10 miles per hour?',
109: 'Would you rather be a superhero or the world\'s best chef?',
110: 'Would you rather be an Olympic gold medallist or an astronaut?',
110: 'Would you rather be an Olympic gold medalist or an astronaut?',
};

export default topic;
Expand Down

0 comments on commit 345152a

Please sign in to comment.