Video Demo: https://youtu.be/Mq5y7zLnBQI
Here are the four important part:
- SetUp
- Basic
- Service
- Service register system
It is in src/main/java/ckcsc/asadfgglie/setup/SetUp.java
.
It is the enterpoint.
Use --configpath <path>
to set config-folder
path.
If you don't set config-folder
, it will be set to the SetUp.java
's current directory by default.
If you have packed all the code into an jar file by /gradlew packageApp
, it will be set to the JAR file's current directory by default.
In config-folder
, it must exist BotConfig.json
.
BotConfig.json
example:{ "TOKEN": "Your Bot Token" }
In config-folder
, it need the file called RegisterConfig.json
.
It is the more information that you can go to Part Service register system
.
Some command of this bot need the admin permission, you can write a file called AdminConfig.json
.
AdminConfig.json
example:{ "YOUR_COUNT_NAME#YOUR_TAG": YOUR_COUNT_ID }
It is in src/main/java/ckcsc/asadfgglie/main/Basic.java
.
The bot's basic framework.
Mainly be used to receive Discord events and make registered services work.
-
Basic Commands Available
-
!info list
: Query currently registered services.!info <Service Class> <Service name>
: Query information about the corresponding serviceService Class
:Service class name
inRegisterEnvironment.json
Service name
:Service name
inRegisterEnvironment.json
-
!stopBot @bot
: Shutdown the bot. Commander must be an admin.@bot
: You must use the tag method to fill in the name of the bot.
-
!op @USER
: Add an new admin intoAdminConfig.json
.@USER
: You must use the tag method to fill in the name of the user.
-
It is in src/main/java/ckcsc/asadfgglie/main/services/Register/Services.java
.
It is parent class for all services.
There records all of the available services in SERVICES_LIST
.
All services must be registered in init()
using loginService()
.
At the same time, all services also need to override copy()
for subsequent service registration.
copy()
must return its own copy object instance.
This service is to check whether the channel is speaking in accordance with the rules of GFloor.
The rules of GFloor:
- All text messages must start with the
g<number>
- In
g<number>
, the<number>
represents this floor. - Floors must be constructed from floor
1
and the next speaker must build a floor after. - The same message cannot newline to build an new floor continuously, and the same person cannot build an new floor continuously.
- It is not allowed to take back the message, taking back the message is regarded as demolishing GFloor.
- You can edit the message, but the message must comply with the regulations of GFloor after editing, otherwise it will be regarded as demolishing GFloor.
Example:
User1:
g1 haha
g2 666
g3 777
(Only treated as g1 floor)
User2:
g1 haha
User2:
g2 666
X
User1:
g1 haha
User2:
g1 haha
User1:
g3 666
User2
g3
X
Due to early API limitations, Bot cannot check whether the GFloor built before startup satisfies Rule 5 and Rule 6.
It will be fixed at future.
Available commands:
-
!play <url> <volume>
: play musicsplay
can be replaced by the abbreviationspl
orp
.url
: Music linkvolume
: Volume setting,the default is 25.
-
!pause
: Pause/resume currently play musicpause
can be replaced by the abbreviationpa
.
-
!skip
: skip current musicskip
can be replaced by the abbreviationsk
.
-
!stop
: stop playing musicstop
can be replaced by the abbreviationst
.
-
!volume <volume>
: adjust volumevolume
can be replaced by the abbreviationv
.volume
: volume
-
!volume
: Display the current volume levelvolume
can be replaced by the abbreviationv
.
-
!loop
: Turn loop playback on/offloop
can be replaced by the abbreviationlp
.
-
!list
: Display the current playlistlist
can be replaced by the abbreviationls
.
-
!shuffle
: Scramble the to-be-played listshuffle
can be replaced by the abbreviationsh
.
It can recognize single number in the picture.
Only can use keras model.
Use saved_model_cli
to get register-value outputName
, inputName
information.
Model input format: (batch, width, height)
You can get some examples model in my other project: https://github.com/asadfgglie/MINST-app
It can use dialog-model to generate conversation.
Use socket.io to call flask backend to generate.
Only can use transformers
model.
Register-value remote
can use to connect to what has already opened flask backend.
Its flask backend can share by HumanFeedback
service.
You can get some examples model in my other project: https://github.com/asadfgglie/ChatBot
It can use dialog-model to generate conversation, and then make people chose best reply or teach model how to say.
After talking, it can save dialog-history as training data.
This service is extends by AutoReply
service, so it has same register-values like AutoReply
, and DO NOT FORGET make service channel have Category.
-
First, in
Service.init()
, useService.loginService()
to register and make the serviceextends
theService
class. -
Next, override the
registerByEnvironment()
,copy()
methods in the service:copy()
public abstract Service copy();
Please return a copy reference of the service object instance.
registerByEnvironment()
public abstract void registerByEnvironment(JSONObject values);
Among them,
values
is ajson
object, which directly stores the initialization setting value of the object.Please initialize the service according to the incoming
json
object.name
is the name of the service, it can be set to the value ofserviceName
if desired -
Next, please write
RegisterEnvironment.json
for your service:RegisterEnvironment.json
records thejson
object passed in byregisterByEnvironment(JSONObject values, String name)
when each service is initialized.Each
Service name
corresponds to an object instance, which is also thejson
object passed intoregisterByEnvironment(JSONObject values, String name)
Please save it in the folder set by the command line parameter
--configpath <path>
during execution, and please write in the following format:-
RegisterEnvironment.json
example:{ "GFloor": { // `Service class` name "GFLoor_bot1": {// `Service name`, NO SAPCES! "CHANNEL_ID": 666, // Service value, more information can get in the defualt `RegisterEnvironment.json` "nowFloor": 0, "maxFloor": 0 }, "GFloor_bot2": {// `Service name`, NO SAPCES! "CHANNEL_ID": 777, // Service value "nowFloor": 0, "maxFloor": 0 } }, "MusicPlayer":{ // `Service class` name "DJ":{// `Service name`, NO SAPCES! "isInfoVisible":true } } }
-
Service class name
please be sure to fill in the service object class name registered inService.init()
. -
In the same
Service class
for multiple services,Service name
must be a unique name and NO SPACES! -
all the
Service value
will become ajson
object instance and passed toregisterByEnvironment()
along with theService name
.
-