Skip to content

Commit

Permalink
Merge pull request #18 from Kirollos/develop
Browse files Browse the repository at this point in the history
Merge Develop -> Master
  • Loading branch information
dassjosh authored Aug 19, 2021
2 parents f86e8c6 + aa3fa1b commit d0b1251
Show file tree
Hide file tree
Showing 48 changed files with 737 additions and 553 deletions.
2 changes: 1 addition & 1 deletion Oxide.Ext.Discord/BotClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void RemoveClient(DiscordClient client)
private void UpdateLogLevel(LogLevel level)
{
Logger.UpdateLogLevel(level);
Logger.Debug($"{nameof(BotClient)}.{nameof(UpdateLogLevel)} Updating log level from:{Settings.LogLevel.ToString()} to: {level.ToString()}");
Logger.Debug($"{nameof(BotClient)}.{nameof(UpdateLogLevel)} Updating log level from: {Settings.LogLevel.ToString()} to: {level.ToString()}");
Settings.LogLevel = level;
}

Expand Down
4 changes: 3 additions & 1 deletion Oxide.Ext.Discord/DiscordClient.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Newtonsoft.Json;
using Oxide.Core;
using Oxide.Core.Plugins;
using Oxide.Ext.Discord.Attributes;
using Oxide.Ext.Discord.Constants;
using Oxide.Ext.Discord.Entities.Gatway;
using Oxide.Ext.Discord.Entities.Guilds;
using Oxide.Ext.Discord.Logging;
using Oxide.Plugins;

Expand Down Expand Up @@ -95,7 +97,7 @@ public void Connect(DiscordSettings settings)
RegisterPluginForHooks(Owner);
Interface.Call(DiscordHooks.OnDiscordClientConnected, Owner, this);
}

/// <summary>
/// Disconnects this client from discord
/// </summary>
Expand Down
14 changes: 7 additions & 7 deletions Oxide.Ext.Discord/Entities/Activities/ActivityFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,43 @@ public enum ActivityFlags
/// <summary>
/// No Actions can be done to this activity
/// </summary>
[EnumMember(Value = "NONE")]
[Description("NONE")]
None = 0,

/// <summary>
/// No Actions can be done to this activity
/// </summary>
[EnumMember(Value = "INSTANCE")]
[Description("INSTANCE")]
Instance = 1 << 0,

/// <summary>
/// Activity can be joined
/// </summary>
[EnumMember(Value = "JOIN")]
[Description("JOIN")]
Join = 1 << 1,

/// <summary>
/// Activity can be spectated
/// </summary>
[EnumMember(Value = "SPECTATE")]
[Description("SPECTATE")]
Spectate = 1 << 2,

/// <summary>
/// User may request to join activity
/// </summary>
[EnumMember(Value = "JOIN_REQUEST")]
[Description("JOIN_REQUEST")]
JoinRequest = 1 << 3,

/// <summary>
/// User can listen along in spotify
/// </summary>
[EnumMember(Value = "SYNC")]
[Description("SYNC")]
Sync = 1 << 4,

/// <summary>
/// User can play this song
/// </summary>
[EnumMember(Value = "PLAY")]
[Description("PLAY")]
Play = 1 << 5
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Ext.Discord.Entities.Roles;
using Oxide.Ext.Discord.Entities.Permissions;

namespace Oxide.Ext.Discord.Entities.AuditLogs.Change
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Newtonsoft.Json;
using Oxide.Ext.Discord.Entities.Roles;
using Oxide.Ext.Discord.Entities.Permissions;

namespace Oxide.Ext.Discord.Entities.AuditLogs.Change
{
Expand Down
1 change: 1 addition & 0 deletions Oxide.Ext.Discord/Entities/Channels/DiscordChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Oxide.Ext.Discord.Entities.Invites;
using Oxide.Ext.Discord.Entities.Messages;
using Oxide.Ext.Discord.Entities.Messages.Embeds;
using Oxide.Ext.Discord.Entities.Permissions;
using Oxide.Ext.Discord.Entities.Users;
using Oxide.Ext.Discord.Helpers;
using Oxide.Ext.Discord.Helpers.Cdn;
Expand Down
1 change: 1 addition & 0 deletions Oxide.Ext.Discord/Entities/Channels/Overwrite.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using Oxide.Ext.Discord.Entities.Permissions;
using Oxide.Ext.Discord.Interfaces;

namespace Oxide.Ext.Discord.Entities.Channels
Expand Down
6 changes: 3 additions & 3 deletions Oxide.Ext.Discord/Entities/Channels/Stages/PrivacyLevel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.ComponentModel;

namespace Oxide.Ext.Discord.Entities.Channels.Stages
{
Expand All @@ -10,13 +10,13 @@ public enum PrivacyLevel
/// <summary>
/// The Stage instance is visible publicly, such as on Stage discovery.
/// </summary>
[EnumMember(Value = "PUBLIC")]
[Description("PUBLIC")]
Public = 1,

/// <summary>
/// The Stage instance is visible to only guild members.
/// </summary>
[EnumMember(Value = "GUILD_ONLY")]
[Description("GUILD_ONLY")]
GuildOnly = 2
}
}
8 changes: 7 additions & 1 deletion Oxide.Ext.Discord/Entities/Gatway/EventPayload.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Oxide.Ext.Discord.Entities.Gatway.Events;
using Oxide.Ext.Discord.Helpers.Converters;
using Oxide.Ext.Discord.WebSockets;

namespace Oxide.Ext.Discord.Entities.Gatway
Expand All @@ -11,6 +12,11 @@ namespace Oxide.Ext.Discord.Entities.Gatway
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public class EventPayload
{
private static readonly JsonSerializer Serializer = new JsonSerializer
{
Converters = { new DiscordEnumConverter() }
};

/// <summary>
/// Op Code for the payload
/// </summary>
Expand Down Expand Up @@ -38,7 +44,7 @@ public class EventPayload
/// <summary>
/// Returns a DispatchCode enum value for the EventName if the extension supports it; Else the code will be Unknown
/// </summary>
public DispatchCode EventCode => EventName?.ToObject<DispatchCode>() ?? DispatchCode.Unknown;
public DispatchCode EventCode => EventName?.ToObject<DispatchCode>(Serializer) ?? DispatchCode.Unknown;

/// <summary>
/// Data as JObject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Newtonsoft.Json;
using Oxide.Ext.Discord.Entities.Roles;
using Oxide.Ext.Discord.Entities.Permissions;

namespace Oxide.Ext.Discord.Entities.Gatway.Events
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Newtonsoft.Json;
using Oxide.Ext.Discord.Entities.Roles;
using Oxide.Ext.Discord.Entities.Permissions;

namespace Oxide.Ext.Discord.Entities.Gatway.Events
{
Expand Down
6 changes: 3 additions & 3 deletions Oxide.Ext.Discord/Entities/Guilds/DefaultNotificationLevel.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.ComponentModel;

namespace Oxide.Ext.Discord.Entities.Guilds
{
Expand All @@ -10,13 +10,13 @@ public enum DefaultNotificationLevel
/// <summary>
/// Notify for all guild messages
/// </summary>
[EnumMember(Value = "ALL_MESSAGES")]
[Description("ALL_MESSAGES")]
AllMessages = 0,

/// <summary>
/// Notify for only mentions
/// </summary>
[EnumMember(Value = "ONLY_MENTIONS")]
[Description("ONLY_MENTIONS")]
OnlyMentions = 1
}
}
2 changes: 1 addition & 1 deletion Oxide.Ext.Discord/Entities/Guilds/DiscordGuild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Oxide.Ext.Discord.Entities.Gatway.Events;
using Oxide.Ext.Discord.Entities.Integrations;
using Oxide.Ext.Discord.Entities.Invites;
using Oxide.Ext.Discord.Entities.Roles;
using Oxide.Ext.Discord.Entities.Permissions;
using Oxide.Ext.Discord.Entities.Stickers;
using Oxide.Ext.Discord.Entities.Users;
using Oxide.Ext.Discord.Entities.Voice;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.ComponentModel;

namespace Oxide.Ext.Discord.Entities.Guilds
{
Expand All @@ -10,19 +10,19 @@ public enum ExplicitContentFilterLevel
/// <summary>
/// Disable explicit content filter
/// </summary>
[EnumMember(Value = "DISABLED")]
[Description("DISABLED")]
Disabled = 0,

/// <summary>
/// Filter for only members without roles
/// </summary>
[EnumMember(Value = "MEMBERS_WITHOUT_ROLES")]
[Description("MEMBERS_WITHOUT_ROLES")]
MembersWithoutRoles = 1,

/// <summary>
/// Filter for all members
/// </summary>
[EnumMember(Value = "ALL_MEMBERS")]
[Description("ALL_MEMBERS")]
AllMembers = 2
}
}
2 changes: 1 addition & 1 deletion Oxide.Ext.Discord/Entities/Guilds/GuildCreate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Oxide.Ext.Discord.Entities.Channels;
using Oxide.Ext.Discord.Entities.Roles;
using Oxide.Ext.Discord.Entities.Permissions;

namespace Oxide.Ext.Discord.Entities.Guilds
{
Expand Down
Loading

0 comments on commit d0b1251

Please sign in to comment.