Fix a few typos (#471)
This commit is contained in:
parent
9aa921ae32
commit
c5bfac66e5
|
@ -87,7 +87,7 @@ let login_schema = LoginSchema {
|
||||||
password: "Correct-Horse-Battery-Staple".to_string(),
|
password: "Correct-Horse-Battery-Staple".to_string(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
// Each user connects to the Gateway. The Gateway connection lives on a seperate thread. Depending on
|
// Each user connects to the Gateway. The Gateway connection lives on a separate thread. Depending on
|
||||||
// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.
|
// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.
|
||||||
let user = instance
|
let user = instance
|
||||||
.login_account(login_schema)
|
.login_account(login_schema)
|
||||||
|
|
|
@ -13,7 +13,7 @@ async fn main() {
|
||||||
password: "Correct-Horse-Battery-Staple".to_string(),
|
password: "Correct-Horse-Battery-Staple".to_string(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
// Each user connects to the Gateway. The Gateway connection lives on a seperate thread. Depending on
|
// Each user connects to the Gateway. The Gateway connection lives on a separate thread. Depending on
|
||||||
// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.
|
// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.
|
||||||
let user = instance
|
let user = instance
|
||||||
.login_account(login_schema)
|
.login_account(login_schema)
|
||||||
|
|
|
@ -17,7 +17,7 @@ custom_error! {
|
||||||
/// Server did not respond.
|
/// Server did not respond.
|
||||||
NoResponse = "Did not receive a response from the Server.",
|
NoResponse = "Did not receive a response from the Server.",
|
||||||
/// Reqwest returned an Error instead of a Response object.
|
/// Reqwest returned an Error instead of a Response object.
|
||||||
RequestFailed{url:String, error: String} = "An error occured while trying to GET from {url}: {error}",
|
RequestFailed{url:String, error: String} = "An error occurred while trying to GET from {url}: {error}",
|
||||||
/// Response received, however, it was not of the successful responses type. Used when no other, special case applies.
|
/// Response received, however, it was not of the successful responses type. Used when no other, special case applies.
|
||||||
ReceivedErrorCode{error_code: u16, error: String} = "Received the following error code while requesting from the route: {error_code}",
|
ReceivedErrorCode{error_code: u16, error: String} = "Received the following error code while requesting from the route: {error_code}",
|
||||||
/// Used when there is likely something wrong with the instance, the request was directed to.
|
/// Used when there is likely something wrong with the instance, the request was directed to.
|
||||||
|
|
|
@ -169,7 +169,7 @@ impl GatewayHandle {
|
||||||
|
|
||||||
/// Closes the websocket connection and stops all gateway tasks;
|
/// Closes the websocket connection and stops all gateway tasks;
|
||||||
///
|
///
|
||||||
/// Esentially pulls the plug on the gateway, leaving it possible to resume;
|
/// Essentially pulls the plug on the gateway, leaving it possible to resume;
|
||||||
pub async fn close(&self) {
|
pub async fn close(&self) {
|
||||||
self.kill_send.send(()).unwrap();
|
self.kill_send.send(()).unwrap();
|
||||||
self.websocket_send.lock().await.close().await.unwrap();
|
self.websocket_send.lock().await.close().await.unwrap();
|
||||||
|
|
|
@ -128,7 +128,7 @@ impl HeartbeatHandler {
|
||||||
let send_result = websocket_tx.lock().await.send(msg.into()).await;
|
let send_result = websocket_tx.lock().await.send(msg.into()).await;
|
||||||
if send_result.is_err() {
|
if send_result.is_err() {
|
||||||
// We couldn't send, the websocket is broken
|
// We couldn't send, the websocket is broken
|
||||||
warn!("GW: Couldnt send heartbeat, websocket seems broken");
|
warn!("GW: Couldn't send heartbeat, websocket seems broken");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@ use crate::types;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// Represents a messsage received from the gateway. This will be either a [types::GatewayReceivePayload], containing events, or a [GatewayError].
|
/// Represents a message received from the gateway. This will be either a [types::GatewayReceivePayload], containing events, or a [GatewayError].
|
||||||
/// This struct is used internally when handling messages.
|
/// This struct is used internally when handling messages.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct GatewayMessage(pub String);
|
pub struct GatewayMessage(pub String);
|
||||||
|
|
||||||
impl GatewayMessage {
|
impl GatewayMessage {
|
||||||
/// Parses the message as an error;
|
/// Parses the message as an error;
|
||||||
/// Returns the error if succesfully parsed, None if the message isn't an error
|
/// Returns the error if successfully parsed, None if the message isn't an error
|
||||||
pub fn error(&self) -> Option<GatewayError> {
|
pub fn error(&self) -> Option<GatewayError> {
|
||||||
// Some error strings have dots on the end, which we don't care about
|
// Some error strings have dots on the end, which we don't care about
|
||||||
let processed_content = self.0.to_lowercase().replace('.', "");
|
let processed_content = self.0.to_lowercase().replace('.', "");
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl ChorusUser {
|
||||||
/// Creates a new [ChorusUser] from existing data.
|
/// Creates a new [ChorusUser] from existing data.
|
||||||
///
|
///
|
||||||
/// # Notes
|
/// # Notes
|
||||||
/// This isn't the prefered way to create a ChorusUser.
|
/// This isn't the preferred way to create a ChorusUser.
|
||||||
/// See [Instance::login_account] and [Instance::register_account] instead.
|
/// See [Instance::login_account] and [Instance::register_account] instead.
|
||||||
pub fn new(
|
pub fn new(
|
||||||
belongs_to: Shared<Instance>,
|
belongs_to: Shared<Instance>,
|
||||||
|
|
|
@ -44,7 +44,7 @@ let login_schema = LoginSchema {
|
||||||
password: "Correct-Horse-Battery-Staple".to_string(),
|
password: "Correct-Horse-Battery-Staple".to_string(),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
// Each user connects to the Gateway. The Gateway connection lives on a seperate thread. Depending on
|
// Each user connects to the Gateway. The Gateway connection lives on a separate thread. Depending on
|
||||||
// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.
|
// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.
|
||||||
let user = instance
|
let user = instance
|
||||||
.login_account(login_schema)
|
.login_account(login_schema)
|
||||||
|
|
|
@ -11,7 +11,7 @@ use super::WebSocketEvent;
|
||||||
///
|
///
|
||||||
/// Sent to the server to signify lazy loading of a guild;
|
/// Sent to the server to signify lazy loading of a guild;
|
||||||
/// Sent by the official client when switching to a guild or channel;
|
/// Sent by the official client when switching to a guild or channel;
|
||||||
/// After this, you should recieve message updates
|
/// After this, you should receive message updates
|
||||||
///
|
///
|
||||||
/// See <https://luna.gitlab.io/discord-unofficial-docs/lazy_guilds.html#op-14-lazy-request>
|
/// See <https://luna.gitlab.io/discord-unofficial-docs/lazy_guilds.html#op-14-lazy-request>
|
||||||
///
|
///
|
||||||
|
|
|
@ -131,7 +131,7 @@ impl WebSocketEvent for MessageReactionRemoveEmoji {}
|
||||||
/// Not documented anywhere unofficially
|
/// Not documented anywhere unofficially
|
||||||
///
|
///
|
||||||
/// Apparently "Message ACK refers to marking a message as read for Discord's API." (<https://github.com/Rapptz/discord.py/issues/1851>)
|
/// Apparently "Message ACK refers to marking a message as read for Discord's API." (<https://github.com/Rapptz/discord.py/issues/1851>)
|
||||||
/// I suspect this is sent and recieved from the gateway to let clients on other devices know the user has read a message
|
/// I suspect this is sent and received from the gateway to let clients on other devices know the user has read a message
|
||||||
///
|
///
|
||||||
/// {"t":"MESSAGE_ACK","s":3,"op":0,"d":{"version":52,"message_id":"1107236673638633472","last_viewed":null,"flags":null,"channel_id":"967363950217936897"}}
|
/// {"t":"MESSAGE_ACK","s":3,"op":0,"d":{"version":52,"message_id":"1107236673638633472","last_viewed":null,"flags":null,"channel_id":"967363950217936897"}}
|
||||||
pub struct MessageACK {
|
pub struct MessageACK {
|
||||||
|
|
|
@ -52,7 +52,7 @@ impl TestBundle {
|
||||||
// Set up a test by creating an Instance and a User. Reduces Test boilerplate.
|
// Set up a test by creating an Instance and a User. Reduces Test boilerplate.
|
||||||
pub(crate) async fn setup() -> TestBundle {
|
pub(crate) async fn setup() -> TestBundle {
|
||||||
let instance = Instance::new("http://localhost:3001/api").await.unwrap();
|
let instance = Instance::new("http://localhost:3001/api").await.unwrap();
|
||||||
// Requires the existance of the below user.
|
// Requires the existence of the below user.
|
||||||
let reg = RegisterSchema {
|
let reg = RegisterSchema {
|
||||||
username: "integrationtestuser".into(),
|
username: "integrationtestuser".into(),
|
||||||
consent: true,
|
consent: true,
|
||||||
|
|
Loading…
Reference in New Issue