-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
134 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import 'package:discord_dart/discord.dart' as discord; | ||
import 'package:discord_dart/command.dart' as command; | ||
|
||
main() { | ||
var bot = new discord.Client("your token"); | ||
var commands = new command.Client(bot, "!"); | ||
|
||
bot.on('ready', (e) { | ||
print("Ready!"); | ||
}); | ||
|
||
commands.on('ping', (e) { | ||
var m = e.message; | ||
m.channel.sendMessage("Pong!"); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'src/command.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,40 @@ | ||
export 'src/client.dart'; | ||
|
||
export 'src/events/ChannelCreateEvent.dart'; | ||
export 'src/events/ChannelDeleteEvent.dart'; | ||
export 'src/events/ChannelUpdateEvent.dart'; | ||
export 'src/events/GuildBanAddEvent.dart'; | ||
export 'src/events/GuildBanRemoveEvent.dart'; | ||
export 'src/events/GuildCreateEvent.dart'; | ||
export 'src/events/GuildDeleteEvent.dart'; | ||
export 'src/events/GuildMemberAddEvent.dart'; | ||
export 'src/events/GuildMemberRemoveEvent.dart'; | ||
export 'src/events/GuildMemberUpdateEvent.dart'; | ||
export 'src/events/GuildUpdateEvent.dart'; | ||
export 'src/events/MessageDeleteEvent.dart'; | ||
export 'src/events/MessageEvent.dart'; | ||
export 'src/events/MessageUpdateEvent.dart'; | ||
export 'src/events/ReadyEvent.dart'; | ||
export 'src/events/TypingEvent.dart'; | ||
export 'src/events/WebSocketErrorEvent.dart'; | ||
|
||
export 'src/objects/Attachment.dart'; | ||
export 'src/objects/ClientOAuth2Application.dart'; | ||
export 'src/objects/ClientOptions.dart'; | ||
export 'src/objects/ClientUser.dart'; | ||
export 'src/objects/Embed.dart'; | ||
export 'src/objects/EmbedProvider.dart'; | ||
export 'src/objects/EmbedThumbnail.dart'; | ||
export 'src/objects/Guild.dart'; | ||
export 'src/objects/GuildChannel.dart'; | ||
export 'src/objects/Invite.dart'; | ||
export 'src/objects/InviteChannel.dart'; | ||
export 'src/objects/InviteGuild.dart'; | ||
export 'src/objects/Member.dart'; | ||
export 'src/objects/MessageOptions.dart'; | ||
export 'src/objects/Message.dart'; | ||
export 'src/objects/OAuth2Application.dart'; | ||
export 'src/objects/OAuth2Guild.dart'; | ||
export 'src/objects/OAuth2Info.dart'; | ||
export 'src/objects/PrivateChannel.dart'; | ||
export 'src/objects/User.dart'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import '../discord.dart' as discord; | ||
import 'package:events/events.dart' as events; | ||
|
||
/// Send when a new command is received. | ||
class CommandEvent { | ||
/// A list of arguments provided. | ||
List<String> args; | ||
|
||
/// The message; | ||
discord.Message message; | ||
|
||
/// Constructs a `CommandEvent`. | ||
CommandEvent(Client client, String command, this.args, this.message) { | ||
client.emit(command, this); | ||
} | ||
} | ||
|
||
/// The base class for the command client. | ||
class Client extends events.Events { | ||
/// The main discord client. | ||
discord.Client client; | ||
|
||
/// The client's prefix. | ||
String prefix; | ||
|
||
/// Makes a new command client. | ||
Client(this.client, this.prefix) { | ||
this.client.on('message', (discord.MessageEvent e) { | ||
if (e.message.content.startsWith(this.prefix)) { | ||
final String command = e.message.content.split(" ")[0].replaceFirst(this.prefix, ""); | ||
final List<String> args = e.message.content.split(" "); | ||
args.remove(this.prefix + command); | ||
new CommandEvent(this, command, args, e.message); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// A message attachment. | ||
class Attachment { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// The options for `Client`. | ||
class ClientOptions { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// The client user. | ||
class ClientUser { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// A message embed. | ||
class Embed { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// A message embed provider. | ||
class EmbedProvider { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// A message embed thumbnail. | ||
class EmbedThumbnail { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// An invite. | ||
class Invite { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// A guild member. | ||
class Member { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// An OAuth2 application. | ||
class OAuth2Application { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import '../../objects.dart'; | ||
import '../../discord.dart'; | ||
|
||
/// A user. | ||
class User { | ||
|
Oops, something went wrong.