Skip to content

Instantly share code, notes, and snippets.

@Altreus
Created July 10, 2019 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Altreus/0bb08d6045aefe5836a6bdad6d5ef61a to your computer and use it in GitHub Desktop.
Save Altreus/0bb08d6045aefe5836a6bdad6d5ef61a to your computer and use it in GitHub Desktop.
method from-json (%json) {
my %constructor = %json<id name icon splash>:kv;
%constructor<is-owner> = %json<owner>;
%constructor<roles> = %(
%json<roles><>.map: { $_<id> => Role.from-json($_) }
);
dd %constructor;
%constructor<api> = %json<_api>;
return self.new(|%constructor.Map);
}
method get-role($id) { dd %.roles; %.roles{$id} }
Hash %constructor = {
:icon("300388b1cea6d3db2554c5e97d54d9d9"),
:id("502109774901542924"),
:is-owner(Any),
:name("Shuppet Laboratories"),
:roles(${
"502109774901542924" => API::Discord::Guild::Role.new(id => "502109774901542924", name => "\@everyone", color => 0, is-pinned => Bool::False, position => 0, permissions => 104140352, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"506956809471262731" => API::Discord::Guild::Role.new(id => "506956809471262731", name => "Developer ♢", color => 12543991, is-pinned => Bool::True, position => 9, permissions => 104140352, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"506956997543985222" => API::Discord::Guild::Role.new(id => "506956997543985222", name => "Administrator ♤", color => 0, is-pinned => Bool::False, position => 11, permissions => 104140360, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"506957056478281739" => API::Discord::Guild::Role.new(id => "506957056478281739", name => "Moderator ♧", color => 0, is-pinned => Bool::False, position => 10, permissions => 267775686, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"506958764071583757" => API::Discord::Guild::Role.new(id => "506958764071583757", name => "Princess ♡", color => 655360, is-pinned => Bool::True, position => 12, permissions => 104140352, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"507157047645569064" => API::Discord::Guild::Role.new(id => "507157047645569064", name => "Sentient AI ♢", color => 3447003, is-pinned => Bool::True, position => 8, permissions => 536211270, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"560941583252455444" => API::Discord::Guild::Role.new(id => "560941583252455444", name => "Level 5", color => 0, is-pinned => Bool::False, position => 3, permissions => 104140352, is-managed => Bool::False, is-mentionable => Bool::True, api => Any),
"560941637732139008" => API::Discord::Guild::Role.new(id => "560941637732139008", name => "Level 10", color => 0, is-pinned => Bool::False, position => 4, permissions => 104140352, is-managed => Bool::False, is-mentionable => Bool::True, api => Any),
"560941672880537600" => API::Discord::Guild::Role.new(id => "560941672880537600", name => "Level 15", color => 0, is-pinned => Bool::False, position => 5, permissions => 104140352, is-managed => Bool::False, is-mentionable => Bool::True, api => Any),
"565287723229904896" => API::Discord::Guild::Role.new(id => "565287723229904896", name => "Patreon", color => 0, is-pinned => Bool::False, position => 2, permissions => 268435969, is-managed => Bool::True, is-mentionable => Bool::False, api => Any),
"565287886291861519" => API::Discord::Guild::Role.new(id => "565287886291861519", name => "Contributor ☆", color => 3066993, is-pinned => Bool::True, position => 6, permissions => 104189504, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"565291335653785603" => API::Discord::Guild::Role.new(id => "565291335653785603", name => "Sponsor ☆", color => 15844367, is-pinned => Bool::True, position => 7, permissions => 104140352, is-managed => Bool::False, is-mentionable => Bool::False, api => Any),
"595267555795664896" => API::Discord::Guild::Role.new(id => "595267555795664896", name => "Rosie", color => 0, is-pinned => Bool::False, position => 1, permissions => 134605894, is-managed => Bool::True, is-mentionable => Bool::False, api => Any)
}),
:splash(Any)
}
Hash %!roles = {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment