@@ -30,8 +30,6 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Discord.Net.Modules", "src\ | |||||
EndProject | EndProject | ||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Modules", "src\Discord.Net.Modules.Net45\Discord.Net.Modules.csproj", "{3091164F-66AE-4543-A63D-167C1116241D}" | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Discord.Net.Modules", "src\Discord.Net.Modules.Net45\Discord.Net.Modules.csproj", "{3091164F-66AE-4543-A63D-167C1116241D}" | ||||
EndProject | EndProject | ||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestingProject", "TestingProject\TestingProject.csproj", "{6CD8116D-6749-4174-81EB-C4EB4B1F185B}" | |||||
EndProject | |||||
Global | Global | ||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||
Debug|Any CPU = Debug|Any CPU | Debug|Any CPU = Debug|Any CPU | ||||
@@ -81,12 +79,6 @@ Global | |||||
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = Debug|Any CPU | {3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = Debug|Any CPU | ||||
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.ActiveCfg = Release|Any CPU | {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = Release|Any CPU | {3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = Release|Any CPU | ||||
{6CD8116D-6749-4174-81EB-C4EB4B1F185B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{6CD8116D-6749-4174-81EB-C4EB4B1F185B}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||||
{6CD8116D-6749-4174-81EB-C4EB4B1F185B}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU | |||||
{6CD8116D-6749-4174-81EB-C4EB4B1F185B}.FullDebug|Any CPU.Build.0 = Debug|Any CPU | |||||
{6CD8116D-6749-4174-81EB-C4EB4B1F185B}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||||
{6CD8116D-6749-4174-81EB-C4EB4B1F185B}.Release|Any CPU.Build.0 = Release|Any CPU | |||||
EndGlobalSection | EndGlobalSection | ||||
GlobalSection(SolutionProperties) = preSolution | GlobalSection(SolutionProperties) = preSolution | ||||
HideSolutionNode = FALSE | HideSolutionNode = FALSE | ||||
@@ -101,6 +93,5 @@ Global | |||||
{1B5603B4-6F8F-4289-B945-7BAAE523D740} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | {1B5603B4-6F8F-4289-B945-7BAAE523D740} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | ||||
{01584E8A-78DA-486F-9EF9-A894E435841B} = {EA68EBE2-51C8-4440-9EF7-D633C90A5D35} | {01584E8A-78DA-486F-9EF9-A894E435841B} = {EA68EBE2-51C8-4440-9EF7-D633C90A5D35} | ||||
{3091164F-66AE-4543-A63D-167C1116241D} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | {3091164F-66AE-4543-A63D-167C1116241D} = {DF03D4E8-38F6-4FE1-BC52-E38124BE8AFD} | ||||
{6CD8116D-6749-4174-81EB-C4EB4B1F185B} = {6317A2E6-8E36-4C3E-949B-3F10EC888AB9} | |||||
EndGlobalSection | EndGlobalSection | ||||
EndGlobal | EndGlobal |
@@ -1,4 +1,4 @@ | |||||
# Discord.Net v0.8.0-beta1 | |||||
# Discord.Net v0.8.1-Beta | |||||
An unofficial .Net API Wrapper for the Discord client (http://discordapp.com). | An unofficial .Net API Wrapper for the Discord client (http://discordapp.com). | ||||
Check out the [documentation](https://discordnet.readthedocs.org/en/latest/) or join the [Discord API Chat](https://discord.gg/0SBTUU1wZTVjAMPx). | Check out the [documentation](https://discordnet.readthedocs.org/en/latest/) or join the [Discord API Chat](https://discord.gg/0SBTUU1wZTVjAMPx). | ||||
@@ -88,8 +88,8 @@ | |||||
<Compile Include="..\Discord.Net\API\Enums\PermissionTarget.cs"> | <Compile Include="..\Discord.Net\API\Enums\PermissionTarget.cs"> | ||||
<Link>API\Enums\PermissionTarget.cs</Link> | <Link>API\Enums\PermissionTarget.cs</Link> | ||||
</Compile> | </Compile> | ||||
<Compile Include="..\Discord.Net\API\Enums\Regions.cs"> | |||||
<Link>API\Enums\Regions.cs</Link> | |||||
<Compile Include="..\Discord.Net\API\Enums\Region.cs"> | |||||
<Link>API\Enums\Region.cs</Link> | |||||
</Compile> | </Compile> | ||||
<Compile Include="..\Discord.Net\API\Enums\StringEnum.cs"> | <Compile Include="..\Discord.Net\API\Enums\StringEnum.cs"> | ||||
<Link>API\Enums\StringEnum.cs</Link> | <Link>API\Enums\StringEnum.cs</Link> | ||||
@@ -24,5 +24,11 @@ | |||||
return new ChannelType(value); | return new ChannelType(value); | ||||
} | } | ||||
} | } | ||||
public static implicit operator ChannelType(string value) => FromString(value); | |||||
public static bool operator ==(ChannelType a, ChannelType b) => a?._value == b?._value; | |||||
public static bool operator !=(ChannelType a, ChannelType b) => a?._value != b?._value; | |||||
public override bool Equals(object obj) => (obj as ChannelType)?._value == _value; | |||||
public override int GetHashCode() => _value.GetHashCode(); | |||||
} | } | ||||
} | } |
@@ -24,5 +24,11 @@ | |||||
return new PermissionTarget(value); | return new PermissionTarget(value); | ||||
} | } | ||||
} | } | ||||
public static implicit operator PermissionTarget(string value) => FromString(value); | |||||
public static bool operator ==(PermissionTarget a, PermissionTarget b) => a?._value == b?._value; | |||||
public static bool operator !=(PermissionTarget a, PermissionTarget b) => a?._value != b?._value; | |||||
public override bool Equals(object obj) => (obj as PermissionTarget)?._value == _value; | |||||
public override int GetHashCode() => _value.GetHashCode(); | |||||
} | } | ||||
} | } |
@@ -34,5 +34,11 @@ | |||||
return new Region(value); | return new Region(value); | ||||
} | } | ||||
} | } | ||||
public static implicit operator Region(string value) => FromString(value); | |||||
public static bool operator ==(Region a, Region b) => a?._value == b?._value; | |||||
public static bool operator !=(Region a, Region b) => a?._value != b?._value; | |||||
public override bool Equals(object obj) => (obj as Region)?._value == _value; | |||||
public override int GetHashCode() => _value.GetHashCode(); | |||||
} | } | ||||
} | } |
@@ -2,7 +2,7 @@ | |||||
{ | { | ||||
public abstract class StringEnum | public abstract class StringEnum | ||||
{ | { | ||||
private string _value; | |||||
protected string _value; | |||||
protected StringEnum(string value) | protected StringEnum(string value) | ||||
{ | { | ||||
_value = value; | _value = value; | ||||
@@ -10,43 +10,5 @@ | |||||
public string Value => _value; | public string Value => _value; | ||||
public override string ToString() => _value; | public override string ToString() => _value; | ||||
public override bool Equals(object obj) | |||||
{ | |||||
var enum2 = obj as StringEnum; | |||||
if (enum2 == (StringEnum)null) | |||||
return false; | |||||
else | |||||
return _value == enum2._value; | |||||
} | |||||
public override int GetHashCode() | |||||
{ | |||||
return _value.GetHashCode(); | |||||
} | |||||
public static bool operator ==(StringEnum a, StringEnum b) | |||||
{ | |||||
return a?._value == b?._value; | |||||
} | |||||
public static bool operator !=(StringEnum a, StringEnum b) | |||||
{ | |||||
return a?._value != b?._value; | |||||
} | |||||
public static bool operator ==(StringEnum a, string b) | |||||
{ | |||||
return a?._value == b; | |||||
} | |||||
public static bool operator !=(StringEnum a, string b) | |||||
{ | |||||
return a?._value != b; | |||||
} | |||||
public static bool operator ==(string a, StringEnum b) | |||||
{ | |||||
return a == b?._value; | |||||
} | |||||
public static bool operator !=(string a, StringEnum b) | |||||
{ | |||||
return a != b?._value; | |||||
} | |||||
} | } | ||||
} | } |
@@ -28,5 +28,11 @@ | |||||
return new UserStatus(value); | return new UserStatus(value); | ||||
} | } | ||||
} | } | ||||
public static implicit operator UserStatus(string value) => FromString(value); | |||||
public static bool operator ==(UserStatus a, UserStatus b) => a?._value == b?._value; | |||||
public static bool operator !=(UserStatus a, UserStatus b) => a?._value != b?._value; | |||||
public override bool Equals(object obj) => (obj as UserStatus)?._value == _value; | |||||
public override int GetHashCode() => _value.GetHashCode(); | |||||
} | } | ||||
} | } |
@@ -98,14 +98,14 @@ namespace Discord | |||||
if (channel != null) | if (channel != null) | ||||
query = query.Concat(new Channel[] { channel }); | query = query.Concat(new Channel[] { channel }); | ||||
} | } | ||||
else if (name[0] == '#') //If we somehow get text starting with # but isn't a mention | |||||
else if (name[0] == '#' && (type == null || type == ChannelType.Text)) //If we somehow get text starting with # but isn't a mention | |||||
{ | { | ||||
string name2 = name.Substring(1); | string name2 = name.Substring(1); | ||||
query = query.Concat(server.Channels.Where(x => string.Equals(x.Name, name2, StringComparison.OrdinalIgnoreCase))); | |||||
query = query.Concat(server.TextChannels.Where(x => string.Equals(x.Name, name2, StringComparison.OrdinalIgnoreCase))); | |||||
} | } | ||||
} | } | ||||
if (type != (string)null) | |||||
if (type != null) | |||||
query = query.Where(x => x.Type == type); | query = query.Where(x => x.Type == type); | ||||
return query; | return query; | ||||
} | } | ||||
@@ -115,7 +115,7 @@ namespace Discord | |||||
{ | { | ||||
if (server == null) throw new ArgumentNullException(nameof(server)); | if (server == null) throw new ArgumentNullException(nameof(server)); | ||||
if (name == null) throw new ArgumentNullException(nameof(name)); | if (name == null) throw new ArgumentNullException(nameof(name)); | ||||
if (type == (string)null) throw new ArgumentNullException(nameof(type)); | |||||
if (type == null) throw new ArgumentNullException(nameof(type)); | |||||
CheckReady(); | CheckReady(); | ||||
var response = await _api.CreateChannel(server.Id, name, type.Value).ConfigureAwait(false); | var response = await _api.CreateChannel(server.Id, name, type.Value).ConfigureAwait(false); | ||||
@@ -84,7 +84,7 @@ namespace Discord | |||||
public async Task<Server> CreateServer(string name, Region region) | public async Task<Server> CreateServer(string name, Region region) | ||||
{ | { | ||||
if (name == null) throw new ArgumentNullException(nameof(name)); | if (name == null) throw new ArgumentNullException(nameof(name)); | ||||
if (region == (string)null) throw new ArgumentNullException(nameof(region)); | |||||
if (region == null) throw new ArgumentNullException(nameof(region)); | |||||
CheckReady(); | CheckReady(); | ||||
var response = await _api.CreateServer(name, region.Value).ConfigureAwait(false); | var response = await _api.CreateServer(name, region.Value).ConfigureAwait(false); | ||||
@@ -250,7 +250,7 @@ namespace Discord | |||||
public Task SetStatus(UserStatus status) | public Task SetStatus(UserStatus status) | ||||
{ | { | ||||
if (status == (string)null) throw new ArgumentNullException(nameof(status)); | |||||
if (status == null) throw new ArgumentNullException(nameof(status)); | |||||
if (status != UserStatus.Online && status != UserStatus.Idle) | if (status != UserStatus.Online && status != UserStatus.Idle) | ||||
throw new ArgumentException($"Invalid status, must be {UserStatus.Online} or {UserStatus.Idle}", nameof(status)); | throw new ArgumentException($"Invalid status, must be {UserStatus.Online} or {UserStatus.Idle}", nameof(status)); | ||||
CheckReady(); | CheckReady(); | ||||
@@ -16,7 +16,7 @@ namespace Discord | |||||
/// <summary> Returns the string used to create a channel mention. </summary> | /// <summary> Returns the string used to create a channel mention. </summary> | ||||
public static string Channel(Channel channel) | public static string Channel(Channel channel) | ||||
=> $"<#{channel.Id}>"; | => $"<#{channel.Id}>"; | ||||
/// <summary> Returns the string used to create a channel mention. </summary> | |||||
/// <summary> Returns the string used to create a mention to everyone in a channel. </summary> | |||||
public static string Everyone() | public static string Everyone() | ||||
=> $"@everyone"; | => $"@everyone"; | ||||