mirror of
https://github.com/cassoule/flopobot_v2.git
synced 2026-01-18 16:37:40 +01:00
tests
This commit is contained in:
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="EditorConfigDeprecatedDescriptor" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
20
game.js
20
game.js
@@ -1,4 +1,6 @@
|
||||
import { capitalize } from './utils.js';
|
||||
import pkg from 'pokersolver';
|
||||
const { Hand } = pkg;
|
||||
|
||||
import {updateUserCoins, getUser, insertLog, insertGame, getUserElo, insertElos, updateElo} from './init_database.js'
|
||||
|
||||
@@ -217,4 +219,22 @@ export async function eloHandler(p1, p2, p1score, p2score, type) {
|
||||
type: type,
|
||||
timestamp: Date.now(),
|
||||
})
|
||||
}
|
||||
|
||||
export function pokerTest() {
|
||||
console.log('pokerTest')
|
||||
let hand1 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', '3c', 'Kd'], 'standard', false);
|
||||
//let hand2 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', '3c', 'Kd'], 'standard', false);
|
||||
let hand2 = Hand.solve(['Ad', 'As', 'Jc', 'Th', '2d', 'Qs', 'Qd'], 'standard', false);
|
||||
/*console.log(hand1.name)
|
||||
console.log(hand2.name)
|
||||
console.log(hand1.descr)
|
||||
console.log(hand2.descr)*/
|
||||
console.log(hand1.toString())
|
||||
console.log(hand2.toString())
|
||||
|
||||
let winner = Hand.winners([hand1, hand2]); // hand2
|
||||
console.log(winner)
|
||||
console.log(winner.includes(hand1));
|
||||
console.log(winner.includes(hand2));
|
||||
}
|
||||
6
index.js
6
index.js
@@ -18,7 +18,7 @@ import {
|
||||
getAPOUsers,
|
||||
postAPOBuy
|
||||
} from './utils.js';
|
||||
import {channelPointsHandler, eloHandler, slowmodesHandler} from './game.js';
|
||||
import {channelPointsHandler, eloHandler, pokerTest, slowmodesHandler} from './game.js';
|
||||
import { Client, GatewayIntentBits, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
|
||||
import cron from 'node-cron';
|
||||
import Database from "better-sqlite3";
|
||||
@@ -575,6 +575,7 @@ client.on('messageCreate', async (message) => {
|
||||
}
|
||||
else if (message.content.startsWith('flopo:sql')) {
|
||||
let sqlCommand = message.content.replace('flopo:sql ', '')
|
||||
console.log(sqlCommand)
|
||||
try {
|
||||
if (sqlCommand.startsWith('SELECT')) {
|
||||
const stmt = flopoDB.prepare(`${sqlCommand}`).all();
|
||||
@@ -587,6 +588,9 @@ client.on('messageCreate', async (message) => {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
else if (message.content.startsWith('flopo:poker')) {
|
||||
pokerTest()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
10
package-lock.json
generated
10
package-lock.json
generated
@@ -18,6 +18,7 @@
|
||||
"express": "^4.18.2",
|
||||
"node-cron": "^3.0.3",
|
||||
"openai": "^4.94.0",
|
||||
"pokersolver": "^2.1.4",
|
||||
"socket.io": "^4.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -1945,6 +1946,15 @@
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/pokersolver": {
|
||||
"version": "2.1.4",
|
||||
"resolved": "https://registry.npmjs.org/pokersolver/-/pokersolver-2.1.4.tgz",
|
||||
"integrity": "sha512-vmgZS+K8H8r1RePQykFM5YyvlKo1v3xVec8FMBjg9N6mR2Tj/n/X415w+lG67FWbrk71D/CADmKFinDgaQlAsw==",
|
||||
"engines": [
|
||||
"node >= 4.0.0"
|
||||
],
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/prebuild-install": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"express": "^4.18.2",
|
||||
"node-cron": "^3.0.3",
|
||||
"openai": "^4.94.0",
|
||||
"pokersolver": "^2.1.4",
|
||||
"socket.io": "^4.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
Reference in New Issue
Block a user