// MessageFormat returns a correctly formatted Emoji for use in Message content and embeds
774329
func (e *Emoji) MessageFormat() string {
	if e.ID != "" && e.Name != "" {
		if e.Animated {
			return "<a:" + e.APIName() + ">"
		}

		return "<:" + e.APIName() + ">"
	}

	return e.APIName()
}
869365
func (o *GreeterAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
	o.formats.Add(name, format, validator)
}
860864
func (format *Timestamp) ApplyFormatter(msg *core.Message) error {
	timestampStr := msg.GetCreationTime().Format(format.timestampFormat)
	content := format.GetAppliedContent(msg)

	dataSize := len(timestampStr) + len(content)
	payload := make([]byte, dataSize)

	offset := copy(payload, []byte(timestampStr))
	copy(payload[offset:], content)

	format.SetAppliedContent(msg, payload)
	return nil
}
1311313
func OutputFormat(s string) string {
	var buf bytes.Buffer
	for _, old := range s {
		if newVal, ok := replace[old]; ok {
			buf.WriteString(newVal)
			continue
		}
		buf.WriteRune(old)
	}

	return buf.String()
}
1245688
func (s *GetIPSetOutput) SetFormat(v string) *GetIPSetOutput {
	s.Format = &v
	return s
}
1332750
func (formatterModulator *FormatterModulator) ApplyFormatter(msg *Message) error {
	if formatterModulator.CanBeApplied(msg) {
		return formatterModulator.Formatter.ApplyFormatter(msg)
	}
	return nil
}
1154124
func (e Error) Format(a ...interface{}) Error {
	e.Message = fmt.Sprintf(e.Message, a...)
	return e
}
340219
func (c *Comment) APIFormat() *api.Comment {
	return &api.Comment{
		ID:      c.ID,
		HTMLURL: c.HTMLURL(),
		Poster:  c.Poster.APIFormat(),
		Body:    c.Content,
		Created: c.Created,
		Updated: c.Updated,
	}
}
1289361
func (s *TerminologyData) SetFormat(v string) *TerminologyData {
	s.Format = &v
	return s
}
666448
func (s *ImportJobRequest) SetFormat(v string) *ImportJobRequest {
	s.Format = &v
	return s
}
1237787
func (s *Playlist) SetFormat(v string) *Playlist {
	s.Format = &v
	return s
}
323053
func (m *EventManager) formatMessage(event types.BaseEvent) {
	id := reflect.ValueOf(event).Elem().Type().Name()
	e := event.GetEvent()

	t, ok := m.templates[id]
	if !ok {
		for _, info := range m.Description.EventInfo {
			if info.Key == id {
				t = template.Must(template.New(id).Parse(info.FullFormat))
				m.templates[id] = t
				break
			}
		}
	}

	if t != nil {
		var buf bytes.Buffer
		if err := t.Execute(&buf, event); err != nil {
			log.Print(err)
		}
		e.FullFormattedMessage = buf.String()
	}

	if logEvents {
		log.Printf("[%s] %s", id, e.FullFormattedMessage)
	}
}
484808
func (c *FormatCheckerChain) IsFormat(name string, input interface{}) bool {
	lock.Lock()
	f, ok := c.formatters[name]
	lock.Unlock()

	if !ok {
		return false
	}

	return f.IsFormat(input)
}
152737
func (format *Identifier) ApplyFormatter(msg *core.Message) error {
	format.SetAppliedContent(msg, format.hash(msg))
	return nil
}
286556
func (l *Log) FormatMessage() string {
	if len(l.msg) == 0 {
		return ""
	}
	if l.msg[len(l.msg)-1] != '\n' {
		l.msg += "\n"
	}
	return l.msg
}
1144452
func (format *TextToJSON) ApplyFormatter(msg *core.Message) error {
	// The internal state is not threadsafe so we need to lock here
	format.parseLock.Lock()
	defer format.parseLock.Unlock()

	format.message = bytes.NewBuffer(nil)
	format.state = jsonReadObject

	format.message.WriteString("{")
	remains, state := format.parser.Parse(format.GetAppliedContent(msg), format.initState)

	// Write remains as string value
	if remains != nil {
		format.readEscaped(remains, state)
	}

	// Close any open tags
	if format.message.Len() > 1 {
		for format.state == jsonReadArray || format.state == jsonReadArrayAppend || format.state == jsonReadObject {
			format.readEnd(nil, 0)
		}
	}

	format.message.WriteString("}\n")
	format.SetAppliedContent(msg, bytes.TrimSpace(format.message.Bytes()))

	return nil
}
1109893
func (s *AccessLogSettings) SetFormat(v string) *AccessLogSettings {
	s.Format = &v
	return s
}