diff options
| author | Zeyla Hellyer <[email protected]> | 2017-04-05 08:14:43 -0700 |
|---|---|---|
| committer | Zeyla Hellyer <[email protected]> | 2017-04-05 08:55:01 -0700 |
| commit | d9118c081742d6654dc0a4f60228a7a212ca436e (patch) | |
| tree | 003f49f54769314c1111e942d77f57513406fb5e /examples | |
| parent | Add a sample bot structure example (diff) | |
| download | serenity-d9118c081742d6654dc0a4f60228a7a212ca436e.tar.xz serenity-d9118c081742d6654dc0a4f60228a7a212ca436e.zip | |
Remove selfbot support
While selfbots have always been "roughly tolerated", lately they have
been tolerated to less of a degree.
The simple answer is to no longer support selfbots in any form. This is
done for a few of reasons: 1) in anticipation of selfbots no longer
being tolerated; 2) there are few reasons why one should make a selfbot
in Rust and not a scripting language; 3) there are alternatives
(i.e. discord-rs) that still support userbots. Selfbots are simply not
a goal of the maintainer of serenity.
Upgrade path:
Don't use selfbots with serenity. Use discord-rs instead.
The following has been removed:
Enums:
- `RelationshipType`
Structs:
- `FriendSourceFlags`
- `ReadState`
- `Relationship`
- `SearchResult`
- `SuggestionReason`
- `Tutorial`
- `UserConnection`
- `UserGuildSettings`
- `UserSettings`
Removed the following fields:
- `CurrentUser::mobile`
- Ready::{
analytics_token,
experiments,
friend_suggestion_count,
notes,
read_state,
relationships,
tutorial,
user_guild_settings,
user_settings,
}
Removed the following methods:
- `Client::login_user`
Deprecated `Client::login_bot` in favour of `Client::login`.
Removed `client::LoginType`.
The following no longer take a `login_type` parameter:
- `Context::new`
- `Shard::new`
`Shard::sync_guilds` has been removed.
The `client::Error::{InvalidOperationAsBot, InvalidOperationAsUser}`
variants have been removed.
The following event handlers on `Client` have been removed:
- `on_friend_suggestion_create`
- `on_friend_suggestion_delete`
- `on_relationship_add`
- `on_relationship_remove`
- `on_user_guild_settings_update`
- `on_note_update`
- `on_user_settings_update`
The following `client::rest` functions have been removed:
- `ack_message`
- `edit_note`
- `get_user_connections`
- `search_channel_messages`
- `search_guild_messages`
The following `client::rest::ratelimiting::Route` variants have been
removed:
- `ChannelsIdMessagesSearch`
- `GuildsIdMessagesSearch`
- `UsersMeConnections`
The following fields on `ext::cache::Cache` have been removed:
- `guild_settings`
- `relationships`
- `settings`
while the following methods have also been removed:
- `update_with_relationship_add`
- `update_with_relationship_remove`
- `update_with_user_guild_settings_update`
- `update_with_user_note_update`
- `update_with_user_settings_update`
The following methods have been removed across models:
- `ChannelId::{ack, search}`
- `Channel::{ack, search}`
- `Group::{ack, search}`
- `GuildChannel::{ack, search}`
- `GuildId::{search, search_channels}`
- `Guild::{search, search_channels}`
- `Message::ack`
- `PartialGuild::{search, search_channels}`
- `PrivateChannel::{ack, search}`
- `UserId::{delete_note, edit_note}`
- `User::{delete_note, edit_note}`
The following events in `model::events` have been removed:
- `FriendSuggestionCreateEvent`
- `FriendSuggestionDeleteEvent`
- `MessageAckEvent`
- `RelationshipAddEvent`
- `RelationshipRemoveEvent`
- `UserGuildSettingsUpdateEvent`
- `UserNoteUpdateEvent`
- `UserSettingsUpdateEvent`
Consequently, the following variants on `model::event::Event` have been
removed:
- `FriendSuggestionCreate`
- `FriendSuggestionDelete`
- `MessageAdd`
- `RelationshipAdd`
- `RelationshipRemove`
- `UserGuildSettingUpdate`
- `UserNoteUpdate`
- `UserSettingsUpdate`
The `utils::builder::Search` search builder has been removed.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/01_basic_ping_bot/src/main.rs | 4 | ||||
| -rw-r--r-- | examples/02_transparent_guild_sharding/src/main.rs | 2 | ||||
| -rw-r--r-- | examples/03_struct_utilities/src/main.rs | 2 | ||||
| -rw-r--r-- | examples/04_message_builder/src/main.rs | 2 | ||||
| -rw-r--r-- | examples/05_command_framework/Cargo.toml (renamed from examples/06_command_framework/Cargo.toml) | 2 | ||||
| -rw-r--r-- | examples/05_command_framework/src/main.rs (renamed from examples/06_command_framework/src/main.rs) | 2 | ||||
| -rw-r--r-- | examples/05_user_login/Cargo.toml | 7 | ||||
| -rw-r--r-- | examples/05_user_login/src/main.rs | 27 | ||||
| -rw-r--r-- | examples/06_voice/Cargo.toml (renamed from examples/07_voice/Cargo.toml) | 2 | ||||
| -rw-r--r-- | examples/06_voice/src/main.rs (renamed from examples/07_voice/src/main.rs) | 2 | ||||
| -rw-r--r-- | examples/07_sample_bot_structure/Cargo.toml (renamed from examples/08_sample_bot_structure/Cargo.toml) | 2 | ||||
| -rw-r--r-- | examples/07_sample_bot_structure/src/commands/math.rs (renamed from examples/08_sample_bot_structure/src/commands/math.rs) | 0 | ||||
| -rw-r--r-- | examples/07_sample_bot_structure/src/commands/meta.rs (renamed from examples/08_sample_bot_structure/src/commands/meta.rs) | 0 | ||||
| -rw-r--r-- | examples/07_sample_bot_structure/src/commands/mod.rs (renamed from examples/08_sample_bot_structure/src/commands/mod.rs) | 0 | ||||
| -rw-r--r-- | examples/07_sample_bot_structure/src/main.rs (renamed from examples/08_sample_bot_structure/src/main.rs) | 2 |
15 files changed, 11 insertions, 45 deletions
diff --git a/examples/01_basic_ping_bot/src/main.rs b/examples/01_basic_ping_bot/src/main.rs index b2c739a..477aea1 100644 --- a/examples/01_basic_ping_bot/src/main.rs +++ b/examples/01_basic_ping_bot/src/main.rs @@ -11,7 +11,7 @@ fn main() { // Create a new instance of the Client, logging in as a bot. This will // automatically prepend your bot token with "Bot ", which is a requirement // by Discord for bot users. - let mut client = Client::login_bot(&token); + let mut client = Client::login(&token); // Set a handler for the `on_message` event - so that whenever a new message // is received - the closure (or function) passed will be called. @@ -33,7 +33,7 @@ fn main() { // Set a handler to be called on the `on_ready` event. This is called when a // shard is booted, and a READY payload is sent by Discord. This payload // contains data like the current user's guild Ids, current user data, - // relationships, and more. + // private channels, and more. // // In this case, just print what the current user's username is. client.on_ready(|_ctx, ready| { diff --git a/examples/02_transparent_guild_sharding/src/main.rs b/examples/02_transparent_guild_sharding/src/main.rs index 513a574..b256cfd 100644 --- a/examples/02_transparent_guild_sharding/src/main.rs +++ b/examples/02_transparent_guild_sharding/src/main.rs @@ -25,7 +25,7 @@ fn main() { // Configure the client with your Discord bot token in the environment. let token = env::var("DISCORD_TOKEN") .expect("Expected a token in the environment"); - let mut client = Client::login_bot(&token); + let mut client = Client::login(&token); client.on_message(|ctx, msg| { if msg.content == "!ping" { diff --git a/examples/03_struct_utilities/src/main.rs b/examples/03_struct_utilities/src/main.rs index 76ff75d..455d006 100644 --- a/examples/03_struct_utilities/src/main.rs +++ b/examples/03_struct_utilities/src/main.rs @@ -7,7 +7,7 @@ fn main() { // Configure the client with your Discord bot token in the environment. let token = env::var("DISCORD_TOKEN") .expect("Expected a token in the environment"); - let mut client = Client::login_bot(&token); + let mut client = Client::login(&token); client.on_message(|_ctx, msg| { if msg.content == "!messageme" { diff --git a/examples/04_message_builder/src/main.rs b/examples/04_message_builder/src/main.rs index 55c8592..54f3b79 100644 --- a/examples/04_message_builder/src/main.rs +++ b/examples/04_message_builder/src/main.rs @@ -8,7 +8,7 @@ fn main() { // Configure the client with your Discord bot token in the environment. let token = env::var("DISCORD_TOKEN") .expect("Expected a token in the environment"); - let mut client = Client::login_bot(&token); + let mut client = Client::login(&token); client.on_message(|_ctx, msg| { if msg.content == "!ping" { diff --git a/examples/06_command_framework/Cargo.toml b/examples/05_command_framework/Cargo.toml index bddfc55..3193deb 100644 --- a/examples/06_command_framework/Cargo.toml +++ b/examples/05_command_framework/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "06_command_framework" +name = "05_command_framework" version = "0.1.0" authors = ["my name <[email protected]>"] diff --git a/examples/06_command_framework/src/main.rs b/examples/05_command_framework/src/main.rs index 071ecdc..fbab6ec 100644 --- a/examples/06_command_framework/src/main.rs +++ b/examples/05_command_framework/src/main.rs @@ -32,7 +32,7 @@ fn main() { // Configure the client with your Discord bot token in the environment. let token = env::var("DISCORD_TOKEN") .expect("Expected a token in the environment"); - let mut client = Client::login_bot(&token); + let mut client = Client::login(&token); { let mut data = client.data.lock().unwrap(); diff --git a/examples/05_user_login/Cargo.toml b/examples/05_user_login/Cargo.toml deleted file mode 100644 index 1cdf703..0000000 --- a/examples/05_user_login/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "05_user_login" -version = "0.1.0" -authors = ["my name <[email protected]>"] - -[dependencies] -serenity = { path = "../../" } diff --git a/examples/05_user_login/src/main.rs b/examples/05_user_login/src/main.rs deleted file mode 100644 index 5fdfbf0..0000000 --- a/examples/05_user_login/src/main.rs +++ /dev/null @@ -1,27 +0,0 @@ -extern crate serenity; - -use serenity::Client; -use std::env; - -fn main() { - // Configure the client with your Discord bot token in the environment. - let token = env::var("DISCORD_TOKEN") - .expect("Expected a token in the environment"); - - // Logging in is essentially equivalent to logging in as a user. - // - // The primary difference is that by using `login_user`, the "Bot " string - // is not prefixed to the token. - // - // Additionally, the Client will now know that you are a user, and will - // disallow you from performing bot-only commands. - let mut client = Client::login_user(&token); - - client.on_ready(|_ctx, ready| { - println!("{} is connected!", ready.user.name); - }); - - if let Err(why) = client.start() { - println!("Client error: {:?}", why); - } -} diff --git a/examples/07_voice/Cargo.toml b/examples/06_voice/Cargo.toml index e2e3359..0472203 100644 --- a/examples/07_voice/Cargo.toml +++ b/examples/06_voice/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "07_voice" +name = "06_voice" version = "0.1.0" authors = ["my name <[email protected]>"] diff --git a/examples/07_voice/src/main.rs b/examples/06_voice/src/main.rs index 57293f8..979ea1f 100644 --- a/examples/07_voice/src/main.rs +++ b/examples/06_voice/src/main.rs @@ -20,7 +20,7 @@ fn main() { // Configure the client with your Discord bot token in the environment. let token = env::var("DISCORD_TOKEN") .expect("Expected a token in the environment"); - let mut client = Client::login_bot(&token); + let mut client = Client::login(&token); client.with_framework(|f| f .configure(|c| c diff --git a/examples/08_sample_bot_structure/Cargo.toml b/examples/07_sample_bot_structure/Cargo.toml index f9dacfe..966cd1f 100644 --- a/examples/08_sample_bot_structure/Cargo.toml +++ b/examples/07_sample_bot_structure/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "08_sample_bot_structure" +name = "07_sample_bot_structure" version = "0.1.0" authors = ["my name <[email protected]>"] diff --git a/examples/08_sample_bot_structure/src/commands/math.rs b/examples/07_sample_bot_structure/src/commands/math.rs index 79bfc52..79bfc52 100644 --- a/examples/08_sample_bot_structure/src/commands/math.rs +++ b/examples/07_sample_bot_structure/src/commands/math.rs diff --git a/examples/08_sample_bot_structure/src/commands/meta.rs b/examples/07_sample_bot_structure/src/commands/meta.rs index a4036fc..a4036fc 100644 --- a/examples/08_sample_bot_structure/src/commands/meta.rs +++ b/examples/07_sample_bot_structure/src/commands/meta.rs diff --git a/examples/08_sample_bot_structure/src/commands/mod.rs b/examples/07_sample_bot_structure/src/commands/mod.rs index bf58dba..bf58dba 100644 --- a/examples/08_sample_bot_structure/src/commands/mod.rs +++ b/examples/07_sample_bot_structure/src/commands/mod.rs diff --git a/examples/08_sample_bot_structure/src/main.rs b/examples/07_sample_bot_structure/src/main.rs index 6228782..85600eb 100644 --- a/examples/08_sample_bot_structure/src/main.rs +++ b/examples/07_sample_bot_structure/src/main.rs @@ -18,7 +18,7 @@ use serenity::Client; use std::env; fn main() { - let mut client = Client::login_bot(&env::var("DISCORD_TOKEN").unwrap()); + let mut client = Client::login(&env::var("DISCORD_TOKEN").unwrap()); client.with_framework(|f| f .configure(|c| c.prefix("~")) |