-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(user profile #64): Added in support for basic user profile
- Loading branch information
1 parent
87e5f17
commit 07688d8
Showing
32 changed files
with
591 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export const infoCardBuilder = ({}) => { | ||
return { | ||
components: [], | ||
embeds: [userProfile], | ||
}; | ||
}; | ||
const userProfile = ({ userName, timestamp= new Date() }) => { | ||
|
||
return { | ||
type: "rich", | ||
title: `Profile - ${userName}`, | ||
description: `Paragon Path - Hunter\nTotal Item Level - 81,404\n☑️ Masterworks\n☑️ Raptors(Power)`, | ||
color: 0xffa200, | ||
timestamp, | ||
thumbnail: { | ||
url: `https://www.dasithsblog.com/images/Ranger-Hunter-Build.png`, | ||
height: 0, | ||
width: 0, | ||
}, | ||
author: { | ||
name: `${userName}`, | ||
}, | ||
fields: [ | ||
|
||
], | ||
footer: { | ||
text: ``, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
APIChatInputApplicationCommandInteractionData, | ||
REST, | ||
Routes, | ||
APIInteractionGuildMember, | ||
APIApplicationCommandInteractionDataSubcommandOption, | ||
} from "discord.js"; | ||
|
||
import { Logger } from "winston"; | ||
import { userProfile } from "../../../modals/profile"; | ||
|
||
interface factoryInitializations { | ||
logger: Logger; | ||
rest: REST; | ||
interactionConfig: { | ||
guild_id: string; | ||
application_id: string; | ||
token: string; | ||
member: APIInteractionGuildMember; | ||
}; | ||
} | ||
|
||
export const profileCommand = async ( | ||
data: APIChatInputApplicationCommandInteractionData, | ||
factoryInits: factoryInitializations | ||
) => { | ||
const { rest, logger, interactionConfig } = factoryInits; | ||
const [{ type: subCommandType, options: subCommandOptions = [] }] = | ||
data.options as APIApplicationCommandInteractionDataSubcommandOption[]; | ||
|
||
return false; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
APIInteractionGuildMember, | ||
ApplicationCommandType, | ||
REST, | ||
APIChatInputApplicationCommandInteractionData, | ||
} from "discord.js"; | ||
import { Logger } from "winston"; | ||
import { removeRaidUserCommand } from "./raidUser"; | ||
import { unrecognizedCommand } from ".."; | ||
interface factoryInitializations { | ||
logger: Logger; | ||
rest: REST; | ||
interactionConfig: { | ||
application_id: string; | ||
token: string; | ||
member: APIInteractionGuildMember; | ||
channel_id: string, | ||
}; | ||
} | ||
|
||
export const commandName_remove = "remove"; | ||
export const availableSubCommands = { | ||
raid_user: removeRaidUserCommand, | ||
}; | ||
export const recognizedSubCommands = Object.keys(availableSubCommands); | ||
export const removeCommand = async ( | ||
data: APIChatInputApplicationCommandInteractionData & { type: number }, | ||
factoryInits: factoryInitializations | ||
) => { | ||
const { logger, rest, interactionConfig } = factoryInits; | ||
logger.log("info", `command - ${commandName_remove}`, { data }); | ||
const { options, type } = data; | ||
const [{ name = "" } = {}] = options || []; | ||
if (type !== ApplicationCommandType.ChatInput) { | ||
return { | ||
body: { | ||
content: "Unsupported input used", | ||
}, | ||
}; | ||
} | ||
const subCommandResult = recognizedSubCommands.includes(name) | ||
? await availableSubCommands[name](data, factoryInits) | ||
: unrecognizedCommand(); | ||
|
||
return subCommandResult; | ||
}; | ||
|
Oops, something went wrong.