PaimonGanyu is the English name for 「여행 비서 페이몬!」, which is a Kakaotalk chatbot that provides convenience features for Genshin Impact users.
This repository is the java code base for the chatbot's skill-server & back-end serverless workflows.
- JDK 11 or later
- AWS SAM CLI : You require the SAM CLI to run
sam deploy
to construct your own AWS infrastructure from the IaC of PaimonGanyu. See also, AWS SAM specification. - AWS CLI and your AWS account : To deploy the applications, you obviously need your own AWS account and the CLI that is holding the account credentials.
- Serveral security resources in AWS SSM. (See, HoyopassPrivateKey and HoyopassPublicKey parameters)
- Docker CLI for running local system tests only if you want to.
This repository contains two CloudFormation stacks that AWS SAM deploys to your AWS cloud.
The behind AWS workflows that support the chatbot's features, and dependencies.
Application module
:paimonganyu-app:paimonganyu
Dependent modules
:paimonganyu-infra
, :paimonganyu-domain
, :paimonganyu-hoyoapi
, :awsutils
The code of skill server that handles user requests and renders skill responses, and dependencies.
Application module
:paimonganyu-app:paimonganyu-skill
Dependent modules
:paimonganyu-infra
, :paimonganyu-domain
, :paimonganyu-hoyoapi
, :ikakao
There are ways to realize various use cases for Genshin Impact players by leveraging the AWS Serveless Application Model(AWS SAM). Please refer to the issue All workflows to get more information about the back-end workflows that fulfill the use cases below.
Use cases
- Daily Check-In
- New User Event Daily Check-In
- Cron-based Automatic Daily Check-In
- Code Redemption
- New User Event Code Redemption
- New Redeem Code Distribution
- Hoyopass Fanout
- New User Hoyopass SNS(AWS SNS) Publishing
- Hoyopass CRUD Operations to DynamoDB Tables
※ In order to deploy the serverless workflows, you should have your own AWS account.
The chatbot 「여행 비서 페이몬!」(PaimonGanyu) communicates with the Hoyoverse APIs via the skill server, which is a Spring Boot application. This may require you to prepare three properties
before running the application.
paimonganyu-skill will be deployed to your AWS cloud as an application of Amazon Elastic Beanstalk under a CloudFormation stack.
:application> src> main> resources> applications.properties
amazon.ssm.hoyopass.publickeyname = HoyopassRsaPublicKey
amazon.ssm.hoyopass.privatekeyname = HoyopassRsaPrivateKey
listUserDailyCheck.maxCount = 4
-
amazon.ssm.hoyopass.publickeyname
(String)Set your AWS SSM Parameter name that is holding a RSA public key that encrypts user's hoyopass credentials.
-
amazon.ssm.hoyopass.privatekeyname
(String)Set your AWS SSM Parameter name that is holding the RSA private key that can decrypt the encryption done by the previous public key.
-
listUserDailyCheck.maxCount
(Non-negative integer)Configure how many items to be displayed when
DailyCheckController
is requested to show a user history ofUserDailyCheck
.
:application> src> test> resources> amazon.properties
amazon.aws.accesskey=ASDFASDFASDFASDFASDF
amazon.aws.secretkey=asdfasfdfASDFASDFasdfasdfASDFASFd+-*/asdf
amazon.region=ap-northeast-2
amazon.dynamodb.endpoint=https://dynamodb.ap-northeast-2.amazonaws.com
#amazon.dynamodb.endpoint=http://localhost:3306
amazon.ssm.hoyopass.publickeyname = HoyopassRsaPublicKey
amazon.ssm.hoyopass.privatekeyname = HoyopassRsaPrivateKey
These are only required by the local integration tests.
The production environment is AWS, hence IAM roles and IAM policies are responsible to configure security options.
:application> src> test> resources> accounts.properties
Some tests need your real Genshin Impact accounts to validate their functionalities.
If any account authentication is not provided, those tests will fail. That being said I know account preparation of your own is not easy. This properties file is not required. You can give up running test cases.
Before you run makefile shortcuts, note that they may require two AWS credentials profiles:
pgprod
andpgtest
. If needed, please modify the Gradle scripts inpaimonganyu-app
module to set your cli profiles.
def profile() { // change this function
[prod: 'pgprod', test: 'pgtest'].get(project.findProperty('env'))
}
Deploy the serveless workflows
make paimonganyu
make paimonganyu-test
Deploy the skill server
make paimonganyu-skill
make paimonganyu-skill-test
Run a local system test
make localtest
Your gentle contributions are always welcome. Please feel free to ask questions, to open issues, and to commit your works.
GPLv3
MIT