(ctx: Context)
| 118 | } |
| 119 | |
| 120 | async fn check_login(ctx: Context) -> anyhow::Result<()> { |
| 121 | if ctx.config.api_token.is_empty() { |
| 122 | println!("You're not logged in"); |
| 123 | return Ok(()); |
| 124 | } |
| 125 | |
| 126 | let client = ctx.config.api_client(); |
| 127 | let self_user = client.get_self_user().await?; |
| 128 | |
| 129 | println!( |
| 130 | "Logged in as {}#{}!", |
| 131 | self_user.name, |
| 132 | self_user.discriminator() |
| 133 | ); |
| 134 | |
| 135 | Ok(()) |
| 136 | } |
| 137 | |
| 138 | async fn logout(ctx: Context) -> anyhow::Result<()> { |
| 139 | if ctx.config.api_token.is_empty() { |
no test coverage detected