Compare commits

...

17 Commits

Author SHA1 Message Date
Ean Milligan 617918d32d v2.0.1 minor update to fix deno.json 2025-07-24 03:22:09 -04:00
Ean Milligan ebe707ae26 !!BREAKING CHANGE!! This commit updates the Log4Deno dependency to support Deno 2.X, which means Deno 1.X is no longer supported. 2024-12-24 01:34:12 -05:00
Ean Milligan 6dab4b64b0 Add additional note to config.example.ts for discord IDs being bigints. 2024-12-24 01:13:45 -05:00
David Lau c7d12c25f4
Sanitize usernames for display (#4)
* 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>
2024-07-10 00:54:12 -04:00
Ean Milligan b2c821991d V1.1.5
update member lists to prevent usernames with underscores from creating italics
2024-06-28 21:26:30 -04:00
Ean Milligan 841382df3d V1.1.4 - add activity 2024-06-18 23:47:49 -04:00
David Lau 51db47c828
Add Salvation's Edge (#3)
* Update README.md

* Update config.example.ts

* Update activities.ts
2024-06-09 23:24:04 -04:00
Ean Milligan 1a29eb7f33
Create CONTRIBUTING.md 2024-05-21 17:52:22 -04:00
Ean Milligan 0b8ae5c4e7
Update CODEOWNERS 2024-05-21 17:40:50 -04:00
Ean Milligan 073f8339ee
Update CODEOWNERS 2024-05-21 17:39:15 -04:00
David Lau f0a3e7d0da
Add Presage (#2)
This change adds Presage
2024-05-21 17:34:34 -04:00
Ean Milligan 3d72e4b586 update deno.yml, remove test step for now 2024-05-21 17:30:58 -04:00
Ean Milligan ec6781afc9 Merge branch 'master' of https://github.com/Burn-E99/GroupUp 2024-05-21 17:29:43 -04:00
Ean Milligan ebcc7d4a31 deno fmt and lint fixes 2024-05-21 17:29:00 -04:00
Ean Milligan 434599e411
Create deno.yml
add deno checks
2024-05-21 17:21:02 -04:00
Ean Milligan ef70de972a update codeowners 2024-05-21 17:10:21 -04:00
Ean Milligan 0a2a1259be add codeowners 2024-05-21 16:53:00 -04:00
10 changed files with 134 additions and 73 deletions

5
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,5 @@
* @burn-e99
config.example.ts @davidopluslau
README.md @davidopluslau
src/buttons/event-creation/activities.ts @davidopluslau

42
.github/workflows/deno.yml vendored Normal file
View File

@ -0,0 +1,42 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will install Deno then run `deno lint` and `deno test`.
# For more information see: https://github.com/denoland/setup-deno
name: Deno
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v4
- name: Setup Deno
# uses: denoland/setup-deno@v1
uses: denoland/setup-deno@61fe2df320078202e33d7d5ad347e7dcfa0e8f31 # v1.1.2
with:
deno-version: v1.x
- name: Verify formatting
run: deno fmt --check
- name: Run linter
run: deno lint
# Add this back in when tests are added
# - name: Run tests
# run: deno test -A

10
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,10 @@
# CONTRIBUTING TO GROUP UP
## Things to check before committing a change
- Formatting and linting
- Run `deno fmt` to set all formatting correct
- Run `deno lint` to check for any issues that need fixed
- Are you making a change that will be updating the version number?
- Update the version number in `README.md` and `config.example.ts`, and update the date in `README.md`
- Create a tag on your commit marking this version (name it Vx.x.x)
## Things to check after committing a change
- Check in on Sonar to see if your commit caused new issues to appear. If it did, please fix them

View File

@ -1,4 +1,4 @@
# Group Up - An Event Scheduling Discord Bot | V1.1.1 - 2024/05/21
# Group Up - An Event Scheduling Discord Bot | V2.0.1 - 2024/12/24
[![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)
@ -43,7 +43,12 @@ If you run into any errors or problems with the bot, or think you have a good id
---
## Self Hosting Group Up
Group Up is built on [Deno](https://deno.land/) `v1.33.1` using [Discordeno](https://discordeno.mod.land/) `v17.0.1`. If you choose to run this yourself, you will need to rename `config.example.ts` to `config.ts` and edit some values. You will need to create a new [Discord Application](https://discord.com/developers/applications) and copy the newly generated token into the `"token"` field. If you want to utilize some of the bots dev features, you will need to fill in the keys `"logChannel"` and `"reportChannel"` with text channel IDs and `"devServer"` with a guild ID.
Group Up is built on [Deno](https://deno.land/) using [Discordeno](https://discordeno.mod.land/) `v17.0.1`.
Group Up `V1.1.6` and lower requires Deno `V.33.1`.
Group Up `V2.0.0` and up requires Deno `V2.0.0`.
If you choose to run this yourself, you will need to rename `config.example.ts` to `config.ts` and edit some values. You will need to create a new [Discord Application](https://discord.com/developers/applications) and copy the newly generated token into the `"token"` field. If you want to utilize some of the bots dev features, you will need to fill in the keys `"logChannel"` and `"reportChannel"` with text channel IDs and `"devServer"` with a guild ID.
You will also need to install and setup a MySQL database with a user for the bot to use to add/modify the database. This user must have the `"DB Manager"` admin rights and `"REFERENCES"` Global Privileges. Once the DB is installed and a user is setup, run the provided `db\initialize.ts` to create the schema and tables. After this, run `db\populateDefaults.ts` to insert some needed values into the tables.

View File

@ -1,41 +1,49 @@
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.1', // 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 '/'
'db': { // Settings for the MySQL database, this is required to keep track of the currently active events.
'host': '', // IP address for the db, usually localhost
'localhost': '', // IP address for a secondary OPTIONAL local testing DB, usually also is localhost, but depends on your dev environment
'port': 3306, // Port for the db
'username': '', // Username for the account that will access your DB, this account will need "DB Manager" admin rights and "REFERENCES" Global Privileges
'password': '', // Password for the account, user account may need to be authenticated with the "Standard" Authentication Type if this does not work out of the box
'name': '', // Name of the database Schema to use for the bot
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: '2.0.1', // 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 '/'
db: {
// Settings for the MySQL database, this is required to keep track of the currently active events.
host: '', // IP address for the db, usually localhost
localhost: '', // IP address for a secondary OPTIONAL local testing DB, usually also is localhost, but depends on your dev environment
port: 3306, // Port for the db
username: '', // Username for the account that will access your DB, this account will need "DB Manager" admin rights and "REFERENCES" Global Privileges
password: '', // Password for the account, user account may need to be authenticated with the "Standard" Authentication Type if this does not work out of the box
name: '', // Name of the database Schema to use for the bot
},
'links': { // Links to various sites
'sourceCode': 'https://github.com/Burn-E99/GroupUp', // Link to the repository, OPTIONAL
'supportServer': '', // Invite link to the Discord support server, OPTIONAL
'addToCalendar': '', // Link to where the icsGenerator is hosted, OPTIONAL
'creatorIcon': '', // Link to where the GroupUpSinglePerson.png (or similar image) is hosted
links: {
// Links to various sites
sourceCode: 'https://github.com/Burn-E99/GroupUp', // Link to the repository, OPTIONAL
supportServer: '', // Invite link to the Discord support server, OPTIONAL
addToCalendar: '', // Link to where the icsGenerator is hosted, OPTIONAL
creatorIcon: '', // Link to where the GroupUpSinglePerson.png (or similar image) is hosted
},
'defaultDateFormat': 'MONTH/DAY/YEAR', // Default format that Group Up will suggest to the user. Must match one of the options in the 'DateTimeFormats' enum inside 'src/buttons/event-creation/dateTimeUtils.ts'
'logChannel': 0n, // Discord channel ID where the bot should put startup messages and other error messages needed, OPTIONAL
'reportChannel': 0n, // Discord channel ID where reports will be sent when using the built-in report command, OPTIONAL
'devServer': 0n, // Discord guild ID where testing of indev features/commands will be handled, used in conjunction with the DEVMODE bool in mod.ts, OPTIONAL
'owner': 0n, // Discord user ID of the bot admin
'botLists': [ // Array of objects containing all bot lists that stats should be posted to, OPTIONAL
{ // Bot List object, duplicate for each bot list
'name': 'Bot List Name', // Name of bot list, not used
'enabled': false, // Should statistics be posted to this list?
'apiUrl': 'https://example.com/api/bots/?{bot_id}/stats', // API URL, use ?{bot_id} in place of the bot id so that it can be dynamically replaced
'headers': [ // Array of headers that need to be added to the request
{ // Header Object, duplicate for every header needed
'header': 'header_name', // Name of header needed, usually Authorization is needed
'value': 'header_value', // Value for the header
defaultDateFormat: 'MONTH/DAY/YEAR', // Default format that Group Up will suggest to the user. Must match one of the options in the 'DateTimeFormats' enum inside 'src/buttons/event-creation/dateTimeUtils.ts'
logChannel: 0n, // Discord channel ID where the bot should put startup messages and other error messages needed. This value is a bigint, so please ensure you have a `n` after the ID you get from Discord. OPTIONAL
reportChannel: 0n, // Discord channel ID where reports will be sent when using the built-in report command. This value is a bigint, so please ensure you have a `n` after the ID you get from Discord. OPTIONAL
devServer: 0n, // Discord guild ID where testing of indev features/commands will be handled, used in conjunction with the DEVMODE bool in mod.ts. This value is a bigint, so please ensure you have a `n` after the ID you get from Discord. OPTIONAL
owner: 0n, // Discord user ID of the bot admin. This value is a bigint, so please ensure you have a `n` after the ID you get from Discord.
botLists: [
// Array of objects containing all bot lists that stats should be posted to, OPTIONAL
{
// Bot List object, duplicate for each bot list
name: 'Bot List Name', // Name of bot list, not used
enabled: false, // Should statistics be posted to this list?
apiUrl: 'https://example.com/api/bots/?{bot_id}/stats', // API URL, use ?{bot_id} in place of the bot id so that it can be dynamically replaced
headers: [
// Array of headers that need to be added to the request
{
// Header Object, duplicate for every header needed
header: 'header_name', // Name of header needed, usually Authorization is needed
value: 'header_value', // Value for the header
},
],
'body': { // Data payload to send to the bot list, will be turned into a string and any ?{} will be replaced with the required value, currently only has ?{server_count}
'param_name': '?{param_value}', // Add more params as needed
body: {
// Data payload to send to the bot list, will be turned into a string and any ?{} will be replaced with the required value, currently only has ?{server_count}
param_name: '?{param_value}', // Add more params as needed
},
},
],

View File

@ -1,42 +1,19 @@
{
"compilerOptions": {
"allowJs": true,
"lib": [
"deno.window"
],
"lib": ["deno.window"],
"strict": true
},
"lint": {
"files": {
"include": [
"src/",
"db/",
"mod.ts",
"deps.ts",
"config.ts",
"config.example.ts"
],
"exclude": []
},
"include": ["src/", "db/", "mod.ts", "deps.ts", "config.ts", "config.example.ts"],
"exclude": [],
"rules": {
"tags": [
"recommended"
],
"include": [
"ban-untagged-todo"
],
"tags": ["recommended"],
"include": ["ban-untagged-todo"],
"exclude": []
}
},
"fmt": {
"include": [
"src/",
"db/",
"mod.ts",
"deps.ts",
"config.ts",
"config.example.ts"
],
"include": ["src/", "db/", "mod.ts", "deps.ts", "config.ts", "config.example.ts"],
"exclude": [],
"useTabs": true,
"lineWidth": 200,
@ -44,4 +21,4 @@
"singleQuote": true,
"proseWrap": "preserve"
}
}
}

View File

@ -47,4 +47,4 @@ export type {
export { Client } from 'https://deno.land/x/mysql@v2.11.0/mod.ts';
export { initLog, log, LogTypes as LT } from 'https://raw.githubusercontent.com/Burn-E99/Log4Deno/V1.1.0/mod.ts';
export { initLog, log, LogTypes as LT } from 'https://raw.githubusercontent.com/Burn-E99/Log4Deno/V2.0.0/mod.ts';

View File

@ -15,6 +15,10 @@ export const Activities: Array<Activity> = [
{
name: 'Raids',
options: [
{
name: "Salvation's Edge",
maxMembers: 6,
},
{
name: "Crota's End",
maxMembers: 6,
@ -164,11 +168,19 @@ export const Activities: Array<Activity> = [
name: 'The Whisper',
maxMembers: 3,
},
{
name: 'Presage',
maxMembers: 3,
},
],
},
{
name: 'Miscellaneous/Seasonal',
options: [
{
name: 'Excision',
maxMembers: 12,
},
{
name: 'Pantheon',
options: [
@ -188,7 +200,7 @@ export const Activities: Array<Activity> = [
name: 'Nezarec Sublime (Week 4)',
maxMembers: 6,
},
]
],
},
{
name: 'Onslaught',

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { ApplicationCommandOption, ApplicationCommandTypes, PermissionStrings } from '../../deps.ts';
import { ApplicationCommandOption, ApplicationCommandTypes, Bot, BotWithCache, Interaction, PermissionStrings } from '../../deps.ts';
export type CommandDetails = {
name: string;
@ -11,12 +11,12 @@ export type CommandDetails = {
export type Command = {
details: CommandDetails;
execute: Function;
execute: ((bot: Bot, interaction: Interaction) => void) | ((bot: BotWithCache, interaction: Interaction) => void);
};
export type Button = {
customId: string;
execute: Function;
execute: ((bot: Bot, interaction: Interaction) => void) | ((bot: BotWithCache, interaction: Interaction) => void);
};
export type LfgChannelSetting = {