Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e02bca8ad2 | ||
|
fe13b65016 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
target
|
||||
.direnv
|
||||
*.db
|
||||
deploy/**/config
|
27
deploy/k8s/deployment.yaml
Normal file
27
deploy/k8s/deployment.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hangitbot
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hangitbot
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: hangitbot
|
||||
spec:
|
||||
containers:
|
||||
- name: hangitbot
|
||||
image: <Image>
|
||||
resources:
|
||||
limits:
|
||||
memory: "64Mi"
|
||||
cpu: "100m"
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: hangitbot
|
||||
env:
|
||||
- name: API_URL
|
||||
value: https://tgapi.sense-t.eu.org/
|
||||
|
13
deploy/k8s/kustomization.yaml
Normal file
13
deploy/k8s/kustomization.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json
|
||||
|
||||
resources:
|
||||
- deployment.yaml
|
||||
secretGenerator:
|
||||
- name: hangitbot
|
||||
files:
|
||||
- config/DATABASE_URI
|
||||
- config/TGBOT_TOKEN
|
||||
images:
|
||||
- name: <Image>
|
||||
newName: ghcr.io/senseab/hangitbot
|
||||
newTag: v0.0.1
|
@@ -83,9 +83,12 @@ impl Controller {
|
||||
|
||||
let query = match chat.is_group() || chat.is_supergroup() {
|
||||
true => {
|
||||
Stats::find()
|
||||
Stats::find().select_only()
|
||||
.column(StatsColumn::Name)
|
||||
.column_as(StatsColumn::Counts.sum(), "counts")
|
||||
.filter(StatsColumn::GroupId.eq(chat.id.0))
|
||||
.order_by_desc(StatsColumn::Counts)
|
||||
.group_by(StatsColumn::Name)
|
||||
.order_by_desc(StatsColumn::Counts.sum())
|
||||
.limit(LIMIT).into_model()
|
||||
.all(&transcation)
|
||||
.await
|
||||
|
Reference in New Issue
Block a user