Skip to content

Commit

Permalink
1.0.6 minor update
Browse files Browse the repository at this point in the history
+ Added hooks INVITE_CREATE and INVITE_DELETE:
    - hook Discord_InviteCreated(InviteCreated obj)
    - hook Discord_InviteDeleted(InviteDeleted obj)
+ Added new params to Guild object
+ Fixed emoji parsing error on load.
  • Loading branch information
Kirollos committed Mar 22, 2020
1 parent 5a243b2 commit 8c11690
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Oxide.Ext.Discord/DiscordExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public DiscordExtension(ExtensionManager manager) : base(manager)

public override string Author => "PsychoTea & DylanSMR & Tricky";

public override VersionNumber Version => new VersionNumber(1, 0, 5);
public override VersionNumber Version => new VersionNumber(1, 0, 6);

public override void OnModLoad()
{
Expand Down
4 changes: 2 additions & 2 deletions Oxide.Ext.Discord/DiscordObjects/Emoji.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public class Emoji
public string id { get; set; }

public string name { get; set; }

public List<Role> roles { get; set; }
public List<string> roles { get; set; }

public User user { get; set; }

Expand Down
12 changes: 12 additions & 0 deletions Oxide.Ext.Discord/DiscordObjects/Guild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,14 @@ public class Guild

public string splash { get; set; }

public string discovery_splash { get; set; }

public bool owner { get; set; }

public string owner_id { get; set; }

public int? permissions { get; set; }

public string region { get; set; }

public string afk_channel_id { get; set; }
Expand Down Expand Up @@ -49,6 +55,8 @@ public class Guild

public string system_channel_id { get; set; }

public string rules_channel_id { get; set; }

public string joined_at { get; set; }

public bool? large { get; set; }
Expand Down Expand Up @@ -79,6 +87,10 @@ public class Guild

public int? premium_subscription_count { get; set; }

public string preferred_locale { get; set; }

public string public_updates_channel_id { get; set; }

public static void CreateGuild(DiscordClient client, string name, string region, string icon, GuildVerificationLevel? verificationLevel, int? defaultMessageNotifications, List<Role> roles, List<Channel> channels, Action<Guild> callback = null)
{
var jsonObj = new Dictionary<string, object>()
Expand Down
26 changes: 26 additions & 0 deletions Oxide.Ext.Discord/DiscordObjects/InviteCreated.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
namespace Oxide.Ext.Discord.DiscordObjects
{
using System;
using Oxide.Ext.Discord.REST;

public class InviteCreated
{
public string channel_id { get; set; }

public string code { get; set; }

public string created_at { get; set; }

public string guild_id { get; set; }

public User inviter { get; set; }

public int? max_age { get; set; }

public int? max_uses { get; set; }

public bool? temporary { get; set; }

public int? uses { get; set; }
}
}
14 changes: 14 additions & 0 deletions Oxide.Ext.Discord/DiscordObjects/InviteDeleted.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Oxide.Ext.Discord.DiscordObjects
{
using System;
using Oxide.Ext.Discord.REST;

public class InviteDeleted
{
public string channel_id { get; set; }

public string guild_id { get; set; }

public string code { get; set; }
}
}
2 changes: 1 addition & 1 deletion Oxide.Ext.Discord/Oxide.Ext.Discord.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<Version>1.0.5.0</Version>
<Version>1.0.6.0</Version>
<AssemblyName>Oxide.Ext.Discord</AssemblyName>
<Authors>PsychoTea</Authors>
<Description>An Oxide extension for Discord.</Description>
Expand Down
14 changes: 14 additions & 0 deletions Oxide.Ext.Discord/WebSockets/SocketListner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,20 @@ Moved to DiscordClient.Initialized -> Not at all cases will READY be called.
break;
}

case "INVITE_CREATE":
{
InviteCreated invitecreatedUpdate = payload.EventData.ToObject<InviteCreated>();
client.CallHook("Discord_InviteCreated", null, invitecreatedUpdate);
break;
}

case "INVITE_DELETE":
{
InviteDeleted invitedeletedUpdate = payload.EventData.ToObject<InviteDeleted>();
client.CallHook("Discord_InviteDeleted", null, invitedeletedUpdate);
break;
}

default:
{
client.CallHook("Discord_UnhandledEvent", null, payload);
Expand Down

0 comments on commit 8c11690

Please sign in to comment.