示例#1
0
        public virtual bool OnGuildCreate(DiscordPacket Packet)
        {
            Guild Guild = null;

            if (long.TryParse(Packet.d["id"].GetString(), out long Id))
            {
                if (Guilds.TryGet(Id, out Guild))
                {
                    Console.WriteLine($"Found guild obj for {Id}, patching");
                    try
                    {
                        Guild.Patch(Packet.d);
                    }catch (Exception Ex)
                    {
                        Console.WriteLine($"Exception during patch: {Ex.Message}\n{Ex.StackTrace}");
                    }
                }
                else
                {
                    Console.WriteLine($"Creating new guild for {Id}");
                    Guilds.CreateEntry(Packet.d);
                }
            }

            Console.WriteLine(Guild);
            GuildCreate?.Invoke(this, Guild);
            return(true);
        }
        /// <summary>
        /// Invoked when a GUILD_CREATE event is fired from Discord's WebSocket server.
        /// </summary>
        /// <param name="response">JSON response.</param>
        public void GuildCreated(string response)
        {
            GuildCreate guild = serializer.Deserialize <GuildCreate>(response);
            DiscordOnGuildCreateEventArgs args = new DiscordOnGuildCreateEventArgs()
            {
                Guild = guild.EventData
            };

            OnGuildCreateNotify(args);
        }
示例#3
0
        public virtual async void OnGuildCreate(IGatewayClient gatewayClient, Guild guild)
        {
            await Task.Yield();

            Guilds.Caching(ref guild);

            GuildCreate?.Invoke(this, new ClientArgs <Guild>
            {
                GatewayClient = gatewayClient,
                Data          = guild
            });
        }
示例#4
0
    //===================================================================================
    //
    // Method
    //
    //===================================================================================
    public void Init(GuildCreate guildCreate)
    {
        m_GuildCreate = guildCreate;

        CreateEmblemItems();

        // 6266 길드 마크.
        m_GuildEmblemTitleLabel.text = StringTableManager.GetData(6266);
        m_CancleButtonLabel.text     = StringTableManager.GetData(3);   // 3 취소.
        m_ConfrimButtonLabel.text    = StringTableManager.GetData(2);   // 2 확인.

        if (m_EmblemConfrimButton != null)
        {
            UIEventListener.Get(m_EmblemConfrimButton).onClick = OnCinfrimToGuildCreate;
        }
    }
示例#5
0
    //===================================================================================
    //
    // Default Method
    //
    //===================================================================================
    public override void Init()
    {
        if (m_GuildCreate == null)
        {
            m_GuildCreate = UIResourceMgr.CreatePrefab <GuildCreate>(BUNDLELIST.PREFABS_UI_GUILD, transform, "GuildCreate");
            m_GuildCreate.Init();
        }

        if (m_GuildList == null)
        {
            m_GuildList = UIResourceMgr.CreatePrefab <GuildList>(BUNDLELIST.PREFABS_UI_GUILD, transform, "GuildList");
            m_GuildList.Init();
        }

        OnJoinGuild(null);

        m_MainTitleLabel.text = StringTableManager.GetData(3494);

        m_JoinGuildButton.SetLabel(StringTableManager.GetData(6227));
        m_CreateGuildButton.SetLabel(StringTableManager.GetData(6260));
    }
示例#6
0
        private void HandleDispatchEvent(GatewayPayload evnt, TaskCompletionSource <bool> readySignal)
        {
            switch (evnt.DispatchType)
            {
            case GatewayDispatchType.Ready:
                var readyEvent = evnt.Data as ReadyEvent;
                SetSession(readyEvent.SessionId);
                readySignal.TrySetResult(true);
                Ready?.Invoke(readyEvent);
                break;

            case GatewayDispatchType.Resumed:
                readySignal.TrySetResult(true);
                Resumed?.Invoke();
                break;

            case GatewayDispatchType.GuildCreate: GuildCreate?.Invoke(evnt.Data as GatewayGuild); break;

            case GatewayDispatchType.GuildUpdate: GuildUpdate?.Invoke(evnt.Data as Guild); break;

            case GatewayDispatchType.GuildDelete: GuildDelete?.Invoke(evnt.Data as UnavailableGuild); break;

            case GatewayDispatchType.ChannelCreate: ChannelCreate?.Invoke(evnt.Data as Channel); break;

            case GatewayDispatchType.ChannelUpdate: ChannelUpdate?.Invoke(evnt.Data as Channel); break;

            case GatewayDispatchType.ChannelDelete: ChannelDelete?.Invoke(evnt.Data as Channel); break;

            case GatewayDispatchType.ChannelPinsUpdate: ChannelPinsUpdate?.Invoke(evnt.Data as ChannelPinsUpdateEvent); break;

            case GatewayDispatchType.GuildMemberAdd: GuildMemberAdd?.Invoke(evnt.Data as GuildMemberAddEvent); break;

            case GatewayDispatchType.GuildMemberUpdate: GuildMemberUpdate?.Invoke(evnt.Data as GuildMemberUpdateEvent); break;

            case GatewayDispatchType.GuildMemberRemove: GuildMemberRemove?.Invoke(evnt.Data as GuildMemberRemoveEvent); break;

            case GatewayDispatchType.GuildMembersChunk: GuildMembersChunk?.Invoke(evnt.Data as GuildMembersChunkEvent); break;

            case GatewayDispatchType.GuildRoleCreate: GuildRoleCreate?.Invoke(evnt.Data as GuildRoleCreateEvent); break;

            case GatewayDispatchType.GuildRoleUpdate: GuildRoleUpdate?.Invoke(evnt.Data as GuildRoleUpdateEvent); break;

            case GatewayDispatchType.GuildRoleDelete: GuildRoleDelete?.Invoke(evnt.Data as GuildRoleDeleteEvent); break;

            case GatewayDispatchType.GuildBanAdd: GuildBanAdd?.Invoke(evnt.Data as GuildBanAddEvent); break;

            case GatewayDispatchType.GuildBanRemove: GuildBanRemove?.Invoke(evnt.Data as GuildBanRemoveEvent); break;

            case GatewayDispatchType.GuildEmojisUpdate: GuildEmojisUpdate?.Invoke(evnt.Data as GuildEmojiUpdateEvent); break;

            case GatewayDispatchType.GuildIntegrationsUpdate: GuildIntegrationsUpdate?.Invoke(evnt.Data as GuildIntegrationsUpdateEvent); break;

            case GatewayDispatchType.MessageCreate: MessageCreate?.Invoke(evnt.Data as Message); break;

            case GatewayDispatchType.MessageUpdate: MessageUpdate?.Invoke(evnt.Data as Message); break;

            case GatewayDispatchType.MessageDelete: MessageDelete?.Invoke(evnt.Data as MessageDeleteEvent); break;

            case GatewayDispatchType.MessageDeleteBulk: MessageDeleteBulk?.Invoke(evnt.Data as MessageDeleteBulkEvent); break;

            case GatewayDispatchType.MessageReactionAdd: MessageReactionAdd?.Invoke(evnt.Data as MessageReactionAddEvent); break;

            case GatewayDispatchType.MessageReactionRemove: MessageReactionRemove?.Invoke(evnt.Data as MessageReactionRemoveEvent); break;

            case GatewayDispatchType.MessageReactionRemoveAll: MessageReactionRemoveAll?.Invoke(evnt.Data as MessageReactionRemoveAllEvent); break;

            case GatewayDispatchType.PresenceUpdate: PresenceUpdate?.Invoke(evnt.Data as Presence); break;

            case GatewayDispatchType.UserUpdate: UserUpdate?.Invoke(evnt.Data as User); break;

            case GatewayDispatchType.TypingStart: TypingStart?.Invoke(evnt.Data as TypingStartEvent); break;

            case GatewayDispatchType.VoiceStateUpdate: VoiceStateUpdate?.Invoke(evnt.Data as VoiceState); break;

            case GatewayDispatchType.VoiceServerUpdate: VoiceServerUpdate?.Invoke(evnt.Data as VoiceServerUpdateEvent); break;

            case GatewayDispatchType.WebhooksUpdate: WebhooksUpdate?.Invoke(evnt.Data as WebhooksUpdateEvent); break;
            }
        }