Just for class and fun. Maybe you can make some issues or PR, that can make this better. I didn't send a request regarding copyright. If there are any issues, please feel free to raise an issue or DM me.
https://github.com/SchaleDB/SchaleDB
https://github.com/torikushiii/BlueArchiveAPI/
This project run in NET9.0. INSTALLATION And the database using MySql or MariaDB INSTALLATION
If all done, let's start build this repo.
git clone https://github.com/sukanemoero/dcbot.git LotteryDiscordBot
cd LotteryDiscordBot
rm -rf .git .gitignore
mkdir -p config
echo "{\"host\": \"\", \"user\": \"\", \"password\": \"\", \"database\": \"\"}" > ./config/database_config.json
echo "{\"token\":\"\" }" > ./config/bot_config.json
dotnet build
Before launch bot, edit files in ./config/
./config/database_config.json
:
{
host: <host>,
user: <user>,
password: <password>,
database: <target database name>
}
./config/bot_config.json
:
{
token: <BOT token>
}
About database setup:
CREATE DATABASE `DiscordBot`
About characters data
CREATE TABLE `characters`
(
`id` int(11) NOT NULL,
`baseStar` int(11) NOT NULL,
`position` enum ('Middle','Back','Front') NOT NULL,
`role` enum ('Attacker','Support','Healer','T.S.') NOT NULL,
`armorType` enum ('Light','Heavy','Special','Elastic') NOT NULL,
`attackType` enum ('Explosive','Penetration','Mystic','Sonic') NOT NULL,
`weaponType` enum ('AR','FT','GL','HG','MG','MT','RG','RL','SG','SMG','SR') NOT NULL,
`squadType` enum ('Striker','Special') NOT NULL,
`school` enum ('Abydos','Arius','ETC','Gehenna','Hyakkiyako','Millennium','RedWinter','Shanhaijing','SRT','Sakugawa','Trinity','Valkyrie') NOT NULL,
PRIMARY KEY (`id`)
);
Character Names
CREATE TABLE `character_names`
(
`id` int(11) NOT NULL,
`name` tinytext NOT NULL,
`englishName` varchar(32) DEFAULT '',
UNIQUE KEY `id` (`id`),
CONSTRAINT `FK_name` FOREIGN KEY (`id`) REFERENCES `characters` (`id`)
);
Character Details
CREATE TABLE `character_profiles`
(
`id` int(11) NOT NULL,
`profile` longtext NOT NULL,
`englishProfile` longtext DEFAULT '',
UNIQUE KEY `id` (`id`),
KEY `FK_profile` (`id`),
CONSTRAINT `FK_profile` FOREIGN KEY (`id`) REFERENCES `characters` (`id`)
);
Character terrain data
CREATE TABLE `character_terrain_damage_dealt`
(
`id` int(11) NOT NULL,
`city` int(11) DEFAULT 100,
`desert` int(11) DEFAULT 100,
`indoor` int(11) DEFAULT 100,
UNIQUE KEY `id` (`id`),
CONSTRAINT `FK_terrain_damage_dealt` FOREIGN KEY (`id`) REFERENCES `characters` (`id`)
);
CREATE TABLE `character_terrain_shield_block_rate`
(
`id` int(11) NOT NULL,
`city` int(11) DEFAULT 100,
`desert` int(11) DEFAULT 100,
`indoor` int(11) DEFAULT 100,
UNIQUE KEY `id` (`id`),
CONSTRAINT `FK_terrain_shield_block_rate` FOREIGN KEY (`id`) REFERENCES `characters` (`id`)
);
About user data
CREATE TABLE `users`
(
`id` bigint NOT NULL,
`pyroxene` int(11) DEFAULT 0,
`language` enum ('jp','en') DEFAULT 'jp',
PRIMARY KEY (`id`)
);
User lottery data
CREATE TABLE `user_lottery`
(
`id` bigint NOT NULL,
`lotteryID` int(11) NOT NULL,
`quantity` int(11) DEFAULT 0,
UNIQUE KEY `id` (`id`, `lotteryID`),
KEY `FK_lottery_id` (`lotteryID`),
CONSTRAINT `FK_lottery_id` FOREIGN KEY (`lotteryID`) REFERENCES `characters` (`id`),
CONSTRAINT `FK_lottery_user` FOREIGN KEY (`id`) REFERENCES `users` (`id`)
);
User bonus data
CREATE TABLE `user_bonuses`
(
`id` bigint NOT NULL,
`hundred` int(11) DEFAULT 0,
`threeHundred` int(11) DEFAULT 0,
`thousand` int(11) DEFAULT 0,
UNIQUE KEY `id` (`id`),
CONSTRAINT `FK_bonus_user` FOREIGN KEY (`id`) REFERENCES `users` (`id`)
);
User gacha point data
CREATE TABLE `user_gacha`
(
`id` bigint NOT NULL,
`point` int(11) DEFAULT 0,
UNIQUE KEY `id` (`id`),
CONSTRAINT `FK_gacha_user` FOREIGN KEY (`id`) REFERENCES `users` (`id`)
);
Log user updates when data is modified.
CREATE TABLE `log_user_value_changes`
(
`id` int(11) NOT NULL AUTO_INCREMENT,
`userID` bigint(20) NOT NULL,
`pyroxene` int(11) DEFAULT 0,
`lotteryAmount` int(11) DEFAULT 0,
`gacha` int(11) DEFAULT 0,
`bonusHundred` int(11) DEFAULT 0,
`bonusThreeHundred` int(11) DEFAULT 0,
`bonusThousand` int(11) DEFAULT 0,
`time` timestamp NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `FK_log_user_value_change` (`userID`),
CONSTRAINT `FK_log_user_value_change` FOREIGN KEY (`userID`) REFERENCES `users` (`id`)
);
dotnet run