mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 16:28:55 +00:00
Merge branch 'ci' of natsukagami/youmubot into master
This commit is contained in:
commit
4f08eb0caf
3 changed files with 58 additions and 6 deletions
51
.drone.yml
Normal file
51
.drone.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: format_check
|
||||||
|
image: rust:1.41
|
||||||
|
commands:
|
||||||
|
- rustup component add rustfmt
|
||||||
|
- cargo fmt -- --check
|
||||||
|
- name: cargo_check
|
||||||
|
image: rust:1.41
|
||||||
|
commands:
|
||||||
|
- cargo check
|
||||||
|
|
||||||
|
---
|
||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: deploy
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: build_release
|
||||||
|
image: rust:1.41
|
||||||
|
commands:
|
||||||
|
- cargo build --release
|
||||||
|
- name: deploy
|
||||||
|
image: drillster/drone-rsync
|
||||||
|
environment:
|
||||||
|
RSYNC_KEY:
|
||||||
|
from_secret: rsync_key
|
||||||
|
settings:
|
||||||
|
user: natsukagami
|
||||||
|
args: -zz
|
||||||
|
hosts:
|
||||||
|
- "104.248.149.133" # Youmubot
|
||||||
|
source:
|
||||||
|
- ./target/release/youmubot
|
||||||
|
target:
|
||||||
|
- ~/youmubot/youmubot
|
||||||
|
script:
|
||||||
|
- systemctl --user restart youmubot
|
|
@ -60,9 +60,12 @@ fn update_user(
|
||||||
let mut send_message = |rc: RatingChange| -> CommandResult {
|
let mut send_message = |rc: RatingChange| -> CommandResult {
|
||||||
let channels =
|
let channels =
|
||||||
channels_list.get_or_insert_with(|| channels.channels_of(http.clone(), user_id));
|
channels_list.get_or_insert_with(|| channels.channels_of(http.clone(), user_id));
|
||||||
if channels.is_empty() { return Ok(()); }
|
if channels.is_empty() {
|
||||||
let (contest, _, _) =
|
return Ok(());
|
||||||
codeforces::Contest::standings(reqwest, rc.contest_id, |f| f.limit(1, 1))?; for channel in channels {
|
}
|
||||||
|
let (contest, _, _) =
|
||||||
|
codeforces::Contest::standings(reqwest, rc.contest_id, |f| f.limit(1, 1))?;
|
||||||
|
for channel in channels {
|
||||||
if let Err(e) = channel.send_message(http.http(), |e| {
|
if let Err(e) = channel.send_message(http.http(), |e| {
|
||||||
e.content(format!("Rating change for {}!", user_id.mention()))
|
e.content(format!("Rating change for {}!", user_id.mention()))
|
||||||
.embed(|c| {
|
.embed(|c| {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serenity::{
|
use serenity::model::id::{RoleId, UserId};
|
||||||
model::id::{RoleId, UserId},
|
|
||||||
};
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use youmubot_db::{GuildMap, DB};
|
use youmubot_db::{GuildMap, DB};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue