Skip to content

Commit

Permalink
Merge branch 'hipperooni-branch' of https://github.com/tripsit/TripBot
Browse files Browse the repository at this point in the history
…into hipperooni-branch
  • Loading branch information
LunaUrsa committed Oct 5, 2023
2 parents f66695f + 768f2cf commit 279c52a
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 62 deletions.
10 changes: 5 additions & 5 deletions src/discord/commands/guild/d.rpg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1939,7 +1939,7 @@ export async function rpgArcade(
.addComponents(
customButton(`rpgCoinFlip,user:${interaction.user.id}`, 'CoinFlip', 'buttonCoinflip', ButtonStyle.Secondary),
customButton(`rpgRoulette,user:${interaction.user.id}`, 'Roulette', 'buttonRoulette', ButtonStyle.Secondary),
// customButton(`rpgTrivia,user:${interaction.user.id}`, 'Trivia', 'buttonTrivia', ButtonStyle.Secondary),
customButton(`rpgTrivia,user:${interaction.user.id}`, 'Trivia', 'buttonTrivia', ButtonStyle.Secondary),
// customButton(`rpgBlackjack,user:${interaction.user.id}`, 'Blackjack', '🃏', ButtonStyle.Primary),
// customButton(`rpgSlots,user:${interaction.user.id}`, 'Slots', '🎰', ButtonStyle.Primary),
customButton(`rpgTown,user:${interaction.user.id}`, 'Town', 'buttonTown', ButtonStyle.Primary),
Expand Down Expand Up @@ -3171,10 +3171,10 @@ export const dRpg: SlashCommand = {
.setDescription('Go to the coinflip game'))
.addSubcommand(subcommand => subcommand
.setName('roulette')
.setDescription('Go to the roulette game')),
// .addSubcommand(subcommand => subcommand
// .setName('trivia')
// .setDescription('Go to the trivia parlor')),
.setDescription('Go to the roulette game'))
.addSubcommand(subcommand => subcommand
.setName('trivia')

Check failure on line 3176 in src/discord/commands/guild/d.rpg.ts

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 6 spaces but found 5
.setDescription('Go to the trivia parlor')),

Check failure on line 3177 in src/discord/commands/guild/d.rpg.ts

View workflow job for this annotation

GitHub Actions / Lint

Expected indentation of 6 spaces but found 5
async execute(interaction) {
log.info(F, await commandContext(interaction));
const channelRpg = await interaction.guild?.channels.fetch(env.CHANNEL_TRIPTOWN as string) as TextChannel;
Expand Down
132 changes: 81 additions & 51 deletions src/discord/commands/guild/d.voice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import {
VoiceChannel,
ChannelType,
Guild,
VoiceChannel,

Check failure on line 2 in src/discord/commands/guild/d.voice.ts

View workflow job for this annotation

GitHub Actions / Lint

'VoiceChannel' is defined but never used
ChannelType,

Check failure on line 3 in src/discord/commands/guild/d.voice.ts

View workflow job for this annotation

GitHub Actions / Lint

'ChannelType' is defined but never used
Guild,
Expand All @@ -18,7 +15,7 @@ import commandContext from '../../utils/context';

const F = f(__filename);

type VoiceActions = 'lock' | 'hide' | 'ban' | 'rename' | 'mute' | 'cohost' | 'radio' | 'bitrate';
type VoiceActions = 'lock' | 'hide' | 'add' | 'ban' | 'rename' | 'mute' | 'cohost' | 'radio' | 'bitrate';

async function tentRename(
voiceChannel: VoiceBasedChannel,
Expand All @@ -34,30 +31,27 @@ async function tentRename(
.setDescription(`${voiceChannel} has been renamed to ${newName}`);
}

// async function tentLock(
// voiceChannel: VoiceBasedChannel,
// ):Promise<EmbedBuilder> {
// let verb = '';

// if (
// voiceChannel
// .permissionsFor(voiceChannel.guild.roles.everyone)
// .has(PermissionsBitField.Flags.ViewChannel) === true
// ) {
// voiceChannel.permissionOverwrites.edit(voiceChannel.guild.roles.everyone, { ViewChannel: false });
// verb = 'hidden';
// } else {
// voiceChannel.permissionOverwrites.edit(voiceChannel.guild.roles.everyone, { ViewChannel: true });
// verb = 'unhidden';
// }

// // log.debug(F, `Channel is now ${verb}`);

// return embedTemplate()
// .setTitle('Success')
// .setColor(Colors.Green)
// .setDescription(`${voiceChannel} has been ${verb}`);
// }
async function tentLock(
voiceChannel: VoiceBasedChannel,
):Promise<EmbedBuilder> {
let verb = '';
if (
voiceChannel
.permissionsFor(voiceChannel.guild.roles.everyone)
.has(PermissionsBitField.Flags.Connect) === true
) {
voiceChannel.permissionOverwrites.edit(voiceChannel.guild.roles.everyone, { Connect: false });
verb = 'locked';
} else {
voiceChannel.permissionOverwrites.edit(voiceChannel.guild.roles.everyone, { Connect: true });
verb = 'unlocked';
}
// log.debug(F, `Channel is now ${verb}`);
return embedTemplate()
.setTitle('Success')
.setColor(Colors.Green)
.setDescription(`${voiceChannel} has been ${verb}`);
}

async function tentHide(
voiceChannel: VoiceBasedChannel,
Expand All @@ -84,21 +78,49 @@ async function tentHide(
.setDescription(`${voiceChannel} has been ${verb}`);
}

// async function tentAdd(
// voiceChannel: VoiceBasedChannel,
// target: GuildMember,
// ):Promise<EmbedBuilder> {
// let verb = '';
//

Check failure on line 86 in src/discord/commands/guild/d.voice.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
// if (voiceChannel.permissionsFor(target).has(PermissionsBitField.Flags.ViewChannel) === false){
// return embedTemplate()
// .setTitle('Error')
// .setColor(Colors.Red)
// .setDescription(`${target} is banned from ${voiceChannel}, unban them first!`);
// }
//

Check failure on line 93 in src/discord/commands/guild/d.voice.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
// if (!voiceChannel.permissionsFor(target).has(PermissionsBitField.Flags.ViewChannel) === true){
// voiceChannel.permissionOverwrites.create(target, { ViewChannel: true, Connect: true });
// verb = 'added';
// } else {
// voiceChannel.permissionOverwrites.delete(target);
// verb = 'unadded';
// }
// // log.debug(F, `${target.displayName} is now ${verb}`);
//

Check failure on line 102 in src/discord/commands/guild/d.voice.ts

View workflow job for this annotation

GitHub Actions / Lint

Trailing spaces not allowed
// return embedTemplate()
// .setTitle('Success')
// .setColor(Colors.Green)
// .setDescription(`${target} has been ${verb} from ${voiceChannel}`);
// }

async function tentBan(
voiceChannel: VoiceBasedChannel,
target: GuildMember,
):Promise<EmbedBuilder> {
let verb = '';

if (voiceChannel.permissionsFor(target).has(PermissionsBitField.Flags.ViewChannel) === true) {
if (!voiceChannel.permissionsFor(target).has(PermissionsBitField.Flags.ViewChannel) === false) {
voiceChannel.permissionOverwrites.edit(target, { ViewChannel: false, Connect: false });
if (target.voice.channel === voiceChannel) {
target.voice.setChannel(null);
}
verb = 'banned and hidden';
verb = 'banned and disconnected';
} else {
voiceChannel.permissionOverwrites.edit(target, { ViewChannel: true, Connect: true });
verb = 'unbanned and unhidden';
voiceChannel.permissionOverwrites.delete(target);;

Check failure on line 122 in src/discord/commands/guild/d.voice.ts

View workflow job for this annotation

GitHub Actions / Lint

Missing whitespace after semicolon

Check failure on line 122 in src/discord/commands/guild/d.voice.ts

View workflow job for this annotation

GitHub Actions / Lint

Unnecessary semicolon
verb = 'unbanned';
}

// log.debug(F, `${target.displayName} is now ${verb}`);
Expand Down Expand Up @@ -166,12 +188,22 @@ export const dVoice: SlashCommand = {
.setName('name')
.setDescription('The new name for your Tent')
.setRequired(true)))
.addSubcommand(subcommand => subcommand
.setName('lock')
.setDescription('Lock/Unlock the Tent'))
.addSubcommand(subcommand => subcommand
.setName('hide')
.setDescription('Hide/Unhide the Tent from the channel list'))
.setDescription('Remove the Tent from the channel list'))
// .addSubcommand(subcommand => subcommand
// .setName('add')
// .setDescription('Allow a user to join your Tent when locked or hidden')
// .addUserOption(option => option
// .setName('target')
// .setDescription('The user to add/unadd')
// .setRequired(true)))
.addSubcommand(subcommand => subcommand
.setName('ban')
.setDescription('Ban/Unban and hide a user from your Tent')
.setDescription('Ban and disconnect a user from your Tent')
.addUserOption(option => option
.setName('target')
.setDescription('The user to ban/unban')
Expand All @@ -185,7 +217,7 @@ export const dVoice: SlashCommand = {
.setRequired(true)))
.addSubcommand(subcommand => subcommand
.setName('cohost')
.setDescription('Make another member a co-host in your Tent')
.setDescription('Make another user able to use /voice commands')
.addUserOption(option => option
.setName('target')
.setDescription('The user to make co-host')
Expand Down Expand Up @@ -260,25 +292,31 @@ export const dVoice: SlashCommand = {
return false;
}

// // Check if the target user is a moderator
// if (target.roles.cache.has(env.ROLE_MODERATOR)) {
// await interaction.editReply({ embeds: [embed.setDescription('You cannot ban a moderator!')] });
// return false;
// }
// Check if the target user is a moderator
if (target){
if (target.roles.cache.has(env.ROLE_MODERATOR)) {
await interaction.editReply({ embeds: [embed.setDescription('You cannot do that to a moderator!')] });
return false;
}
}

// log.debug(F, `Command: ${command}`);
if (command === 'rename') {
embed = await tentRename(voiceChannel, newName);
}

// if (command === 'lock') {
// embed = await tentLock(voiceChannel);
// }
if (command === 'lock') {
embed = await tentLock(voiceChannel);
}

if (command === 'hide') {
embed = await tentHide(voiceChannel);
}

// if (command === 'add') {
// embed = await tentAdd(voiceChannel, target);
// }

if (command === 'ban') {
embed = await tentBan(voiceChannel, target);
}
Expand All @@ -291,14 +329,6 @@ export const dVoice: SlashCommand = {
embed = await tentCohost(voiceChannel, target);
}

if (command === 'radio') {
embed = await tentRadio(voiceChannel, stationid, guild);
}

if (command === 'bitrate') {
embed = await tentBitrate(voiceChannel, bitrate);
}

await interaction.editReply({ embeds: [embed] });
return true;
},
Expand Down
2 changes: 1 addition & 1 deletion src/discord/events/guildMemberUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ async function addedVerified(
await channelLounge.send({
content: stripIndents`**${greeting}**
Be safe, have fun, /report any issues!
Be safe, have fun, and don't forget to visit the <id:guide> for more information!
*${await topic()}*`,
});
Expand Down
1 change: 0 additions & 1 deletion src/discord/utils/tents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export async function pitchTent(
- You can pick up this role in <id:customize>
- **Modify your tent**
- \`/voice radio\` - Borrow a radio bot for your tent
- \`/voice bitrate\` - Change the bitrate of your tent
- \`/voice rename\` - Choose a new name for your tent
Expand Down
8 changes: 4 additions & 4 deletions src/discord/utils/tripsitme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ const mindsetRoles = [
env.ROLE_SOBER,
];

// const otherRoles = [
// env.ROLE_VERIFIED,
// ];
const otherRoles = [
env.ROLE_VERIFIED,
];

const ignoredRoles = `${teamRoles},${colorRoles},${mindsetRoles}`;
const ignoredRoles = `${teamRoles},${colorRoles},${mindsetRoles},${otherRoles}`;

const guildOnly = 'This must be performed in a guild!';
const memberOnly = 'This must be performed by a member of a guild!';
Expand Down

0 comments on commit 279c52a

Please sign in to comment.