Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bb06d2678c | ||
|
f5a83a0c90 | ||
|
064565ff00 | ||
|
90fdef4363 |
@ -4,7 +4,7 @@ ENV RUSTFLAGS="-C target-feature=-crt-static"
|
|||||||
WORKDIR /usr/src/saysthbot
|
WORKDIR /usr/src/saysthbot
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN apk add --no-cache rustup openssl-dev build-base && \
|
RUN apk add --no-cache rustup openssl-dev build-base && \
|
||||||
rustup-init -y --default-toolchain nightly && \
|
rustup-init -y --default-toolchain nightly-2024-02-04 && \
|
||||||
source ${HOME}/.cargo/env && cargo build --release
|
source ${HOME}/.cargo/env && cargo build --release
|
||||||
|
|
||||||
FROM alpine
|
FROM alpine
|
||||||
|
@ -11,4 +11,4 @@ secretGenerator:
|
|||||||
images:
|
images:
|
||||||
- name: <Image>
|
- name: <Image>
|
||||||
newName: ghcr.io/senseab/hangitbot
|
newName: ghcr.io/senseab/hangitbot
|
||||||
newTag: v0.0.3
|
newTag: v0.1.2
|
||||||
|
24
flake.lock
generated
24
flake.lock
generated
@ -5,11 +5,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1698420672,
|
"lastModified": 1721727458,
|
||||||
"narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
|
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "naersk",
|
"repo": "naersk",
|
||||||
"rev": "aeb58d5e8faead8980a807c840232697982d47b9",
|
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -21,11 +21,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1699186365,
|
"lastModified": 1728538411,
|
||||||
"narHash": "sha256-Pxrw5U8mBsL3NlrJ6q1KK1crzvSUcdfwb9083sKDrcU=",
|
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a0b3b06b7a82c965ae0bb1d59f6e386fe755001d",
|
"rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -35,11 +35,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1699186365,
|
"lastModified": 1728538411,
|
||||||
"narHash": "sha256-Pxrw5U8mBsL3NlrJ6q1KK1crzvSUcdfwb9083sKDrcU=",
|
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a0b3b06b7a82c965ae0bb1d59f6e386fe755001d",
|
"rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -76,11 +76,11 @@
|
|||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1694529238,
|
"lastModified": 1726560853,
|
||||||
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
|
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
|
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -7,7 +7,7 @@ use teloxide::{
|
|||||||
},
|
},
|
||||||
RequestError,
|
RequestError,
|
||||||
};
|
};
|
||||||
use wd_log::{log_error_ln, log_debug_ln};
|
use wd_log::{log_debug_ln, log_error_ln};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
db_controller::Controller,
|
db_controller::Controller,
|
||||||
@ -23,7 +23,7 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|n| {
|
.map(|n| {
|
||||||
InlineQueryResult::Article(InlineQueryResultArticle::new(
|
InlineQueryResult::Article(InlineQueryResultArticle::new(
|
||||||
n.name.clone(),
|
format!("{},{}", n.id, n.name),
|
||||||
format!("{} {}", BOT_TEXT_INLINE_HANG, n.name),
|
format!("{} {}", BOT_TEXT_INLINE_HANG, n.name),
|
||||||
InputMessageContent::Text(InputMessageContentText::new(hangit_text(
|
InputMessageContent::Text(InputMessageContentText::new(hangit_text(
|
||||||
n.name.clone(),
|
n.name.clone(),
|
||||||
@ -37,8 +37,11 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
|
|||||||
None => vec![],
|
None => vec![],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
log_debug_ln!("{:?}", results);
|
||||||
|
|
||||||
|
if results.is_empty() {
|
||||||
results.push(InlineQueryResult::Article(InlineQueryResultArticle::new(
|
results.push(InlineQueryResult::Article(InlineQueryResultArticle::new(
|
||||||
name.clone(),
|
format!("{},{}", 0, name),
|
||||||
format!("{} {}", BOT_TEXT_INLINE_HANG, name.clone()),
|
format!("{} {}", BOT_TEXT_INLINE_HANG, name.clone()),
|
||||||
InputMessageContent::Text(InputMessageContentText::new(hangit_text(
|
InputMessageContent::Text(InputMessageContentText::new(hangit_text(
|
||||||
name.clone(),
|
name.clone(),
|
||||||
@ -46,6 +49,7 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
|
|||||||
!NEED_ESCAPE,
|
!NEED_ESCAPE,
|
||||||
))),
|
))),
|
||||||
)));
|
)));
|
||||||
|
}
|
||||||
|
|
||||||
if name.starts_with("@") {
|
if name.starts_with("@") {
|
||||||
results = vec![]
|
results = vec![]
|
||||||
@ -58,11 +62,15 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
|
|||||||
pub async fn inline_anwser(db: &Controller, a: ChosenInlineResult) -> Result<(), RequestError> {
|
pub async fn inline_anwser(db: &Controller, a: ChosenInlineResult) -> Result<(), RequestError> {
|
||||||
log_debug_ln!("{:#?}", a);
|
log_debug_ln!("{:#?}", a);
|
||||||
|
|
||||||
if a.result_id == "@" {
|
let mut c: Vec<&str> = a.result_id.split(",").collect();
|
||||||
|
c.remove(0);
|
||||||
|
let result_id = c.concat();
|
||||||
|
|
||||||
|
if result_id == "@" {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Err(err) = db.hangit(&a.result_id, ChatId(0)).await {
|
if let Err(err) = db.hangit(&result_id, ChatId(0)).await {
|
||||||
log_error_ln!("{:?}", err);
|
log_error_ln!("{:?}", err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user