Skip to content

Commit

Permalink
Merge pull request #29 from DSC-best/bot-vote-logs
Browse files Browse the repository at this point in the history
Bot vote logs & Styling updates
  • Loading branch information
mikaib authored Dec 5, 2023
2 parents 17317ca + 7478ba6 commit 5a56688
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/lib/components/cards/botCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
}
.card-footer {
border: 1px solid rgba(255, 255, 255, 0.1);
padding: 0px 6px;
border-radius: 5px;
background-color: var(--mdc-theme-background);
/* border-top: 1px solid rgba(255, 255, 255, 0.1); */
/* padding: 0px 6px;
border-radius: 5px; */
/* background-color: var(--mdc-theme-background); */
}
.top-data {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/colors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export enum InternalColors {
Green = '#0B8B7C',
Green = '#1abc9c',
Purple = '#9B59B6',
Red = '#E74C3C',
Blurple = '#454FBF',
Expand Down
16 changes: 16 additions & 0 deletions src/routes/api/v1/bots/[bot_id]/vote/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import { json } from '@sveltejs/kit';
import { _voteTimeout } from '../../../../../bots/[bot_id]/vote/+page.server';
import { BotApprovalStatus } from '@prisma/client';
import snowflake from '$lib/server/snowflake';
import ChannelLog from '$lib/server/discord/channelLog';
import { APP_URL } from '$env/static/private';
import SafeBot from '$lib/structures/bot';
import { InternalColors } from '$lib/server/colors';

const channelLog = new ChannelLog();

export async function POST({ locals, params }) {
const bot = await prisma.bot.findUnique({
Expand Down Expand Up @@ -56,5 +62,15 @@ export async function POST({ locals, params }) {
}
});

const safeBot = SafeBot(bot);

await channelLog.sendLog(
`Bot voted for`,
`Bot [${safeBot?.username}](${APP_URL}/bots/${bot?.id}) was voted for by <@!${locals?.actor
?.id}>, now at ${bot?.vote_count + 1} votes`,
null,
InternalColors.Green
);

return json({ message: 'OK' });
}
2 changes: 1 addition & 1 deletion src/routes/bots/[bot_id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@
</Fab>
<Fab
on:click={() => {
goto(`/bots/${data?.bot?.id}/vote`);
window.open(`/bots/${data?.bot?.id}/vote`, '_blank');
}}
color="primary"
extended
Expand Down

0 comments on commit 5a56688

Please sign in to comment.