cqcode

package
v1.0.0-rc4 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cqcode provides CQCode util functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EscapeText

func EscapeText(s string) string

EscapeText 将字符串raw中部分字符转义

  • & -> &
  • [ -> [
  • ] -> ]

func EscapeValue

func EscapeValue(value string) string

EscapeValue 将字符串value中部分字符转义

  • , -> ,
  • & -> &
  • [ -> [
  • ] -> ]

func UnescapeText

func UnescapeText(content string) string

UnescapeText 将字符串content中部分字符反转义

  • & -> &
  • [ -> [
  • ] -> ]

func UnescapeValue

func UnescapeValue(content string) string

UnescapeValue 将字符串content中部分字符反转义

  • , -> ,
  • & -> &
  • [ -> [
  • ] -> ]

Types

type Element

type Element struct {
	Type string
	Data []Pair
}

Element single message

func (*Element) CQCode

func (e *Element) CQCode() string

CQCode convert element to cqcode

func (*Element) MarshalJSON

func (e *Element) MarshalJSON() ([]byte, error)

MarshalJSON see encoding/json.Marshaler

func (*Element) WriteCQCodeTo

func (e *Element) WriteCQCodeTo(sb *strings.Builder)

WriteCQCodeTo write element's cqcode into sb

type Pair

type Pair struct {
	K string
	V string
}

Pair key value pair

Jump to

Keyboard shortcuts

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