-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Embed functionality #1
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
976abd4
Added Embed functionality
8964774
Removed link
xiluisx 704ff6d
Update GHooks/settings.json
xiluisx c30c4d9
Update GHooks/settings.json
xiluisx 9ad9521
Update src/Webhooks/Events/OnGlobalChatMessage.cs
xiluisx d969f98
Update src/Webhooks/Events/OnLogin.cs
xiluisx 34e6aca
Update src/Webhooks/Properties/AssemblyInfo.cs
xiluisx 118a98d
Update Core.cs
xiluisx 44383f0
Update src/Webhooks/Events/OnLeave.cs
xiluisx 4d427db
Made requested changes
37ec94a
Mkae class static
ggggg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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
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,68 @@ | ||
using BrokeProtocol.Entities; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Webhooks | ||
{ | ||
public static class EmbedCrafter | ||
{ | ||
public static List<Embed> CreateAllEmbeds(List<Embed> embeds, ShPlayer player) | ||
{ | ||
var allEmbeds = new List<Embed>(); | ||
foreach (var embed in embeds) | ||
{ | ||
allEmbeds.Add(new Embed | ||
{ | ||
Title = string.Format(embed.Title, player.username), | ||
Description = string.Format(embed.Description, player.username), | ||
Color = embed.Color, | ||
Footer = new EmbedFooter() { Text = string.Format(embed.Footer.Text, player.username), IconUrl = embed.Footer.IconUrl, ProxyIconUrl = embed.Footer.ProxyIconUrl }, | ||
Author = new EmbedAuthor() { Name = string.Format(embed.Author.Name, player.username), IconUrl = embed.Author.IconUrl, ProxyIconUrl = embed.Author.ProxyIconUrl, Url = embed.Author.Url }, | ||
Fields = new List<EmbedField>(embed.Fields.Select(c => | ||
{ | ||
c.Name = string.Format(c.Name, player.username); | ||
c.Value = string.Format(c.Value, player.username); | ||
return c; | ||
}).ToList()), | ||
Image = embed.Image, | ||
Provider = embed.Provider, | ||
Url = embed.Url, | ||
Thumbnail = embed.Thumbnail, | ||
TimeStamp = embed.TimeStamp, | ||
Type = embed.Type, | ||
Video = embed.Video | ||
}); | ||
} | ||
return allEmbeds; | ||
} | ||
public static List<Embed> CreateAllEmbeds(List<Embed> embeds, ShPlayer player,string message) | ||
{ | ||
var allEmbeds = new List<Embed>(); | ||
foreach (var embed in embeds) | ||
{ | ||
allEmbeds.Add(new Embed | ||
{ | ||
Title = string.Format(embed.Title,message,player.username), | ||
Description = string.Format(embed.Description, message, player.username), | ||
Color = embed.Color, | ||
Footer = new EmbedFooter() { Text = string.Format(embed.Footer.Text, message, player.username), IconUrl = embed.Footer.IconUrl, ProxyIconUrl = embed.Footer.ProxyIconUrl }, | ||
Author = new EmbedAuthor() { Name = string.Format(embed.Author.Name, message, player.username), IconUrl = embed.Author.IconUrl, ProxyIconUrl = embed.Author.ProxyIconUrl, Url = embed.Author.Url }, | ||
Fields = new List<EmbedField>(embed.Fields.Select(c => | ||
{ | ||
c.Name = string.Format(c.Name, message, player.username); | ||
c.Value = string.Format(c.Value, message, player.username); | ||
return c; | ||
}).ToList()), | ||
Image = embed.Image, | ||
Provider = embed.Provider, | ||
Url = embed.Url, | ||
Thumbnail = embed.Thumbnail, | ||
TimeStamp = embed.TimeStamp, | ||
Type = embed.Type, | ||
Video = embed.Video | ||
}); | ||
} | ||
return allEmbeds; | ||
} | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might wanna add embeds to that soon... not urgent though.