api

package module
v0.0.0-...-d6f12f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: GPL-3.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Copyright (C) 2022-2023  ikafly144

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2022-2023  ikafly144

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2022-2023  ikafly144

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Copyright (C) 2022-2023  ikafly144

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerGuildFeatureDelete

func HandlerGuildFeatureDelete(w http.ResponseWriter, r *http.Request)

func HandlerGuildFeatureGet

func HandlerGuildFeatureGet(w http.ResponseWriter, r *http.Request)

func HandlerGuildFeaturePost

func HandlerGuildFeaturePost(w http.ResponseWriter, r *http.Request)

func Run

func Run()

Types

type Event

type Event struct {
	Operation int             `json:"op"`
	Sequence  int64           `json:"s"`
	Type      string          `json:"t"`
	RawData   json.RawMessage `json:"d"`
	// Structはこのファイルのその他の型の一つを含む
	// TODO:よくわからん
	Struct any `json:"-"`
}

イベントを格納する構造体

type GuildFeature

type GuildFeature struct {
	gorm.Model
	GuildID   string `gorm:"index"`
	TargetID  string
	FeatureID string
}

type MessageLog

type MessageLog struct {
	Model
	GuildID   string
	ChannelID string
	UserID    string `gorm:"index"`
	Content   string
	Bot       bool
}

type Model

type Model struct {
	ID        string `gorm:"primarykey"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type WebsocketHandler

type WebsocketHandler struct {
	WSMutex sync.Mutex
	Conn    map[*websocket.Conn]bool
	Seq     int64
}

ウェブソケットをハンドルする

func NewWebSocketHandler

func NewWebSocketHandler() *WebsocketHandler

新たなウェブソケットハンダラを生成する

func (*WebsocketHandler) Broadcast

func (h *WebsocketHandler) Broadcast(f func(*websocket.Conn))

渡された関数をゴルーチンですべてのウェブソケット接続で実行する

TODO: もっといい方法があるはず

func (*WebsocketHandler) Handle

func (h *WebsocketHandler) Handle(w http.ResponseWriter, r *http.Request)

ウェブソケット接続をハンドルする

func (*WebsocketHandler) HandlerGuildCreate

func (h *WebsocketHandler) HandlerGuildCreate(w http.ResponseWriter, r *http.Request)

ギルド作成イベントを処理する 受け取ったギルドをキャッシュに登録しクライアントにステータス更新イベントを送る

func (*WebsocketHandler) HandlerGuildDelete

func (h *WebsocketHandler) HandlerGuildDelete(w http.ResponseWriter, r *http.Request)

ギルド削除イベントを受け取る 受け取ったギルドをキャッシュから削除しクライアントにステータス更新イベントを送る

func (*WebsocketHandler) HandlerMessageCreate

func (h *WebsocketHandler) HandlerMessageCreate(w http.ResponseWriter, r *http.Request)

func (*WebsocketHandler) HandlerStaticsUserMessage

func (h *WebsocketHandler) HandlerStaticsUserMessage(w http.ResponseWriter, r *http.Request)

func (*WebsocketHandler) Listen

func (h *WebsocketHandler) Listen(c *websocket.Conn)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL