Skip to content

Commit

Permalink
Sanitize usernames for display (#4)
Browse files Browse the repository at this point in the history
* Sanitize away underscores and asterisks for display names

* Bump version

* Bump version and date

* Formatting and rename param

* Un-raw dogged formatting

* lmao I don't know TS

* V1.1.6 - properly fix the formatting issue

---------

Co-authored-by: Ean Milligan <ean.milligan@gmail.com>
  • Loading branch information
davidopluslau and Burn-E99 authored Jul 10, 2024
1 parent b2c8219 commit c7d12c2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Group Up - An Event Scheduling Discord Bot | V1.1.5 - 2024/06/28
# Group Up - An Event Scheduling Discord Bot | V1.1.6 - 2024/07/06
[![SonarCloud](https://sonarcloud.io/images/project_badges/sonarcloud-orange.svg)](https://sonarcloud.io/summary/new_code?id=GroupUp)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GroupUp&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=GroupUp) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=GroupUp&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=GroupUp) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GroupUp&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=GroupUp) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=GroupUp&metric=bugs)](https://sonarcloud.io/summary/new_code?id=GroupUp) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=GroupUp&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=GroupUp) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=GroupUp&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=GroupUp)

Expand Down
2 changes: 1 addition & 1 deletion config.example.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const config = { // !! NOTICE !! All fields below are required unless they are explicitly noted as OPTIONAL. If a field is OPTIONAL, do not remove it from this file, just leave it at the default value
'name': 'Group Up', // Name of the bot
'version': '1.1.5', // Version of the bot
'version': '1.1.6', // Version of the bot
'token': 'the_bot_token', // Discord API Token for this bot
'localToken': 'local_testing_token', // Discord API Token for a secondary OPTIONAL testing bot, THIS SHOULD BE DIFFERENT FROM "token"
'prefix': '/', // Prefix for all commands, as this bot uses slash commands, this needs to be '/'
Expand Down
6 changes: 4 additions & 2 deletions src/buttons/eventUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ export const alternateEventBtnStr = 'Join as Alternate';
export const noDescProvided = 'No description provided.';

// Member List generators
const escapeMemberNameForDisplay = (memberName: string): string => memberName.replaceAll('\\', '').replaceAll('_', '\\_');
export const generateMemberTitle = (memberList: Array<LFGMember>, maxMembers: number): string => `Members Joined: ${memberList.length}/${maxMembers}`;
export const generateMemberList = (memberList: Array<LFGMember>): string => memberList.length ? memberList.map((member) => `\`${member.name}\` - <@${member.id}>`).join('\n') : noMembersStr;
export const generateMemberList = (memberList: Array<LFGMember>): string =>
memberList.length ? memberList.map((member) => `${escapeMemberNameForDisplay(member.name)} - <@${member.id}>`).join('\n') : noMembersStr;
export const generateAlternateList = (alternateList: Array<LFGMember>): string =>
alternateList.length ? alternateList.map((member) => `\`${member.name}\` - <@${member.id}>${member.joined ? ' *' : ''}`).join('\n') : noMembersStr;
alternateList.length ? alternateList.map((member) => `${escapeMemberNameForDisplay(member.name)} - <@${member.id}>${member.joined ? ' *' : ''}`).join('\n') : noMembersStr;

// Fields for event creation and editing modals
export const eventTimeId = 'eventTime';
Expand Down

0 comments on commit c7d12c2

Please sign in to comment.