Bots get 403 when creating a DM channel with POST /users/@me/channels

(#15) Bug Fixed api dms

Observed behaviour

fails with a 403 Expected behaviour should return a dm channel

Reproduction steps

func (bot *client) startDM(user string) (*channel, error) {
	if dmChannel, ok := bot.dms.Get(user); ok {
		return dmChannel, nil
	}

	var dmChannel channel

	err := bot.do("POST", "/users/@me/channels", map[string]string{"recipient_id": user}, &dmChannel)
	if err != nil {
		return nil, err
	}

	bot.dms.Set(user, &dmChannel)
	bot.channels.Set(string(dmChannel.ID), &dmChannel)

	return &dmChannel, nil
}

Details

Summary

bots can't make DM channels seemingly

Area

Backend / API

2 comments

Sign in with Fluxer to comment and vote.