Skip to content

Commit

Permalink
ops: small slash commands improvements (#29)
Browse files Browse the repository at this point in the history
uses addChannelOption & addUserOption instead of string options.
  • Loading branch information
en3sis authored Sep 12, 2022
1 parent 7ea5780 commit 302108a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint": "eslint . --fix",
"format": "npx prettier --write '**/*.ts'",
"prepare": "npx husky install",
"slash": "export ISDEV=false && npm run build && node build/utils/deploy-commands.js",
"slash": "npm run build && node build/utils/deploy-commands.js",
"slashDev": "export ISDEV=true && npm run build && node build/utils/deploy-commands.js",
"test": "ts-mocha -p ./tsconfig.json ./tests/**/*.spec.ts"
},
Expand Down
7 changes: 2 additions & 5 deletions src/commands/reddit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ module.exports = {
.addStringOption((string) =>
string.setName('subreddit').setDescription('The name of the Subreddit').setRequired(true),
)
.addStringOption((string) =>
string
.setName('channel')
.setDescription('Channel ID for the notifications')
.setRequired(true),
.addChannelOption((string) =>
string.setName('channel').setDescription('Channel for Hans to post.').setRequired(true),
),
)
.addSubcommand((subcommand) =>
Expand Down
6 changes: 3 additions & 3 deletions src/commands/threads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
subcommand
.setName('add')
.setDescription('Add a new thread channel')
.addStringOption((string) =>
.addChannelOption((string) =>
string.setName('channel').setDescription('channel').setRequired(true),
)
.addStringOption((string) => string.setName('title').setDescription('Thread cutom title'))
Expand All @@ -27,10 +27,10 @@ module.exports = {
subcommand
.setName('remove')
.setDescription('Removes configuration for a thread channel')
.addStringOption((string) =>
.addChannelOption((string) =>
string
.setName('channel')
.setDescription('Channel ID, to disable thread functionality')
.setDescription('Channel to disable thread functionality')
.setRequired(true),
),
),
Expand Down
1 change: 0 additions & 1 deletion src/lib/sentiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import sentiment from 'sentiment'
const SENTIMENT = new sentiment()

export const sentimentAnalysis = async (text: string) => {
console.log('🚀 ~ file: sentiment.ts ~ line 6 ~ sentimentAnalysis ~ text', text)
const result = SENTIMENT.analyze(text)
if (process.env.ISDEV) {
console.dir(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/deploy-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const fetchCommands = async ({
const config = await getBotConfiguration()
if (!config) return console.log('MongoDB document with the configuration for Hans not found')

if (process.env.ISDEV) {
if (process.env.ISDEV === 'true') {
// Deploys to your development guild, those commands will be deployed instantly
await registryCommands({
folderName: config.commandsDevGuild.folderName,
Expand Down

0 comments on commit 302108a

Please sign in to comment.