Compare commits

..

No commits in common. "master" and "v0.1.2" have entirely different histories.

4 changed files with 28 additions and 36 deletions

View File

@ -4,7 +4,7 @@ ENV RUSTFLAGS="-C target-feature=-crt-static"
WORKDIR /usr/src/saysthbot
COPY . .
RUN apk add --no-cache rustup openssl-dev build-base && \
rustup-init -y --default-toolchain nightly-2024-02-04 && \
rustup-init -y --default-toolchain nightly && \
source ${HOME}/.cargo/env && cargo build --release
FROM alpine

View File

@ -11,4 +11,4 @@ secretGenerator:
images:
- name: <Image>
newName: ghcr.io/senseab/hangitbot
newTag: v0.1.2
newTag: v0.0.3

24
flake.lock generated
View File

@ -5,11 +5,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1721727458,
"narHash": "sha256-r/xppY958gmZ4oTfLiHN0ZGuQ+RSTijDblVgVLFi1mw=",
"lastModified": 1698420672,
"narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
"owner": "nix-community",
"repo": "naersk",
"rev": "3fb418eaf352498f6b6c30592e3beb63df42ef11",
"rev": "aeb58d5e8faead8980a807c840232697982d47b9",
"type": "github"
},
"original": {
@ -21,11 +21,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1728538411,
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
"lastModified": 1699186365,
"narHash": "sha256-Pxrw5U8mBsL3NlrJ6q1KK1crzvSUcdfwb9083sKDrcU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
"rev": "a0b3b06b7a82c965ae0bb1d59f6e386fe755001d",
"type": "github"
},
"original": {
@ -35,11 +35,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1728538411,
"narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
"lastModified": 1699186365,
"narHash": "sha256-Pxrw5U8mBsL3NlrJ6q1KK1crzvSUcdfwb9083sKDrcU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
"rev": "a0b3b06b7a82c965ae0bb1d59f6e386fe755001d",
"type": "github"
},
"original": {
@ -76,11 +76,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {

View File

@ -7,7 +7,7 @@ use teloxide::{
},
RequestError,
};
use wd_log::{log_debug_ln, log_error_ln};
use wd_log::{log_error_ln, log_debug_ln};
use crate::{
db_controller::Controller,
@ -23,7 +23,7 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
.iter()
.map(|n| {
InlineQueryResult::Article(InlineQueryResultArticle::new(
format!("{},{}", n.id, n.name),
n.name.clone(),
format!("{} {}", BOT_TEXT_INLINE_HANG, n.name),
InputMessageContent::Text(InputMessageContentText::new(hangit_text(
n.name.clone(),
@ -37,11 +37,8 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
None => vec![],
};
log_debug_ln!("{:?}", results);
if results.is_empty() {
results.push(InlineQueryResult::Article(InlineQueryResultArticle::new(
format!("{},{}", 0, name),
name.clone(),
format!("{} {}", BOT_TEXT_INLINE_HANG, name.clone()),
InputMessageContent::Text(InputMessageContentText::new(hangit_text(
name.clone(),
@ -49,7 +46,6 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
!NEED_ESCAPE,
))),
)));
}
if name.starts_with("@") {
results = vec![]
@ -62,15 +58,11 @@ pub async fn inline_menu(db: &Controller, bot: &Bot, q: InlineQuery) -> Result<(
pub async fn inline_anwser(db: &Controller, a: ChosenInlineResult) -> Result<(), RequestError> {
log_debug_ln!("{:#?}", a);
let mut c: Vec<&str> = a.result_id.split(",").collect();
c.remove(0);
let result_id = c.concat();
if result_id == "@" {
if a.result_id == "@" {
return Ok(());
}
if let Err(err) = db.hangit(&result_id, ChatId(0)).await {
if let Err(err) = db.hangit(&a.result_id, ChatId(0)).await {
log_error_ln!("{:?}", err);
}