-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
format and trying to add wallet to root header
- Loading branch information
Showing
103 changed files
with
2,495 additions
and
1,977 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"singleQuote": true, | ||
"semi": false | ||
"singleQuote": false, | ||
"semi": true | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import * as markAnswer from './mark-answer.js' | ||
import * as markAnswer from "./mark-answer.js"; | ||
|
||
export const contextMenuCommands = [markAnswer.command] | ||
export const contextMenuCommands = [markAnswer.command]; |
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import * as refreshAnswerCount from './refresh-answer-count.js' | ||
import * as refreshLastActive from './refresh-last-active.js' | ||
import * as lockLowEffortPost from './lock-low-effort-post.js' | ||
import * as removePostAnswer from './remove-post-answer.js' | ||
import * as refreshAnswerCount from "./refresh-answer-count.js"; | ||
import * as refreshLastActive from "./refresh-last-active.js"; | ||
import * as lockLowEffortPost from "./lock-low-effort-post.js"; | ||
import * as removePostAnswer from "./remove-post-answer.js"; | ||
|
||
export const slashCommands = [ | ||
refreshAnswerCount.command, | ||
refreshLastActive.command, | ||
lockLowEffortPost.command, | ||
removePostAnswer.command, | ||
] | ||
]; |
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 |
---|---|---|
@@ -1,60 +1,60 @@ | ||
import { Colors, PermissionFlagsBits, SlashCommandBuilder } from 'discord.js' | ||
import { SlashCommand } from '../types.js' | ||
import { replyWithEmbed } from '../../utils.js' | ||
import { db } from '@member-protocol/db/node' | ||
import { Colors, PermissionFlagsBits, SlashCommandBuilder } from "discord.js"; | ||
import { SlashCommand } from "../types.js"; | ||
import { replyWithEmbed } from "../../utils.js"; | ||
import { db } from "@member-protocol/db/node"; | ||
|
||
export const command: SlashCommand = { | ||
data: new SlashCommandBuilder() | ||
.setName('refresh-answer-count') | ||
.setName("refresh-answer-count") | ||
.setDescription( | ||
'Refreshes the count of answers for every user (expensive call so only use it if really necessary)' | ||
"Refreshes the count of answers for every user (expensive call so only use it if really necessary)", | ||
) | ||
.setDMPermission(false) | ||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator), | ||
|
||
async execute(interaction) { | ||
await replyWithEmbed(interaction, { | ||
title: '⌛ Processing...', | ||
title: "⌛ Processing...", | ||
description: | ||
'Your request has been queued. This might take a while to complete...', | ||
}) | ||
"Your request has been queued. This might take a while to complete...", | ||
}); | ||
|
||
try { | ||
await db | ||
.updateTable('users') | ||
.updateTable("users") | ||
.set({ | ||
answersCount: (eb) => | ||
eb | ||
.selectFrom('posts') | ||
.select(eb.fn.countAll<number>().as('count')) | ||
.innerJoin('messages', (join) => | ||
.selectFrom("posts") | ||
.select(eb.fn.countAll<number>().as("count")) | ||
.innerJoin("messages", (join) => | ||
join | ||
.onRef('messages.snowflakeId', '=', 'posts.answerId') | ||
.onRef('messages.userId', '=', 'users.snowflakeId') | ||
.onRef("messages.snowflakeId", "=", "posts.answerId") | ||
.onRef("messages.userId", "=", "users.snowflakeId"), | ||
), | ||
}) | ||
.execute() | ||
.execute(); | ||
|
||
await interaction.editReply({ | ||
embeds: [ | ||
{ | ||
title: '✅ Success!', | ||
description: 'The answer count of the users has been updated', | ||
title: "✅ Success!", | ||
description: "The answer count of the users has been updated", | ||
color: Colors.Green, | ||
}, | ||
], | ||
}) | ||
}); | ||
} catch (err) { | ||
const description = err instanceof Error ? err.message : 'Unknown reason' | ||
const description = err instanceof Error ? err.message : "Unknown reason"; | ||
|
||
await interaction.editReply({ | ||
embeds: [ | ||
{ | ||
title: 'Error', | ||
title: "Error", | ||
description, | ||
}, | ||
], | ||
}) | ||
}); | ||
} | ||
}, | ||
} | ||
}; |
Oops, something went wrong.