Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/oldschoolgg/oldschoolbot
Browse files Browse the repository at this point in the history
…into uncharge-glory
  • Loading branch information
TastyPumPum committed Feb 27, 2024
2 parents 4919a6b + ea735c1 commit c2b055b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions prisma/robochimp.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ model User {
store_bitfield Int[]
testing_points Float @default(0)
testing_points_balance Float @default(0)
@@map("user")
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function analyticsTick() {
await Promise.all(
[
'SELECT COUNT(*)::int FROM users WHERE "minion.hasBought" = true;',
'SELECT SUM("sacrificedValue")::int AS count FROM users;',
'SELECT SUM("sacrificedValue") AS count FROM users;',
'SELECT COUNT(*)::int FROM users WHERE "minion.ironman" = true;',
'SELECT SUM("GP") AS count FROM users;'
].map(query => prisma.$queryRawUnsafe(query))
Expand Down
12 changes: 12 additions & 0 deletions src/mahoji/commands/rp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Bank } from 'oldschooljs';
import { Item } from 'oldschooljs/dist/meta/types';

import { ADMIN_IDS, OWNER_IDS, production, SupportServer } from '../../config';
import { analyticsTick } from '../../lib/analytics';
import { BitField, Channel } from '../../lib/constants';
import { GearSetupType } from '../../lib/gear/types';
import { GrandExchange } from '../../lib/grandExchange';
Expand Down Expand Up @@ -78,6 +79,12 @@ export const rpCommand: OSBMahojiCommand = {
name: 'view_all_items',
description: 'View all item IDs present in banks/cls.',
options: []
},
{
type: ApplicationCommandOptionType.Subcommand,
name: 'analytics_tick',
description: 'analyticsTick.',
options: []
}
]
},
Expand Down Expand Up @@ -309,6 +316,7 @@ export const rpCommand: OSBMahojiCommand = {
validate_ge?: {};
patreon_reset?: {};
view_all_items?: {};
analytics_tick?: {};
};
player?: {
viewbank?: { user: MahojiUserOption; json?: boolean };
Expand Down Expand Up @@ -355,6 +363,10 @@ export const rpCommand: OSBMahojiCommand = {
}
return 'Something was invalid. Check logs!';
}
if (options.action?.analytics_tick) {
await analyticsTick();
return 'Finished.';
}

if (options.action?.view_all_items) {
const result = await prisma.$queryRawUnsafe<
Expand Down

0 comments on commit c2b055b

Please sign in to comment.