<commit_before>package bot

import (
	"fmt"
	"github.com/bwmarrin/discordgo"
	"go.uber.org/zap"
	"strings"
	"time"
)

const channelCommand = "!channel"
const inviteCommand = "!invite"
const leaveCommand = "!leave"

const memberCategoryID = "440865911910563861" //TODO config?
const memberChannelRoleFmt = "mc_%s"
const channelAssignName = "channel-assign"
const joinMemberChannelEmoji = "✅"
const leaveMemberChannelEmoji = "🛑"

// !channel channel_name
func (d *DiscordAPI) tempChannelCommandHandler(s *discordgo.Session, event *discordgo.MessageCreate) {

	if event.GuildID != d.Config.GuildId {
		return
	}

	fields := strings.Fields(event.Content)
	if len(fields) <= 2 && fields[0] != channelCommand {
		return
	}

	newChannelName := fields[1]

	//check if channel exists
	if ok, chID := d.checkTextChannelPresenceByName(memberCategoryID, newChannelName); ok {
		if _, err := d.discord.ChannelMessageSend(event.ChannelID, fmt.Sprintf("The channel <#%s> already exists. Check <#%s> for the list of channels.", chID, d.memberChannelAssignID)); err != nil {
			Logger.Error("unable to send intro message", zap.String("channel", event.ChannelID), zap.Error(err))
		}
		return
	}

	// create channel
	ch, err := d.newMemberChannel(newChannelName)
	if err != nil {
		Logger.Error("unable to create member channel", zap.String("channel_name", newChannelName), zap.Error(err))
		return
	}

	//create role
	mcRole, err := d.newMemberChannelRole(newChannelName, ch.ID)
	if err != nil {
		Logger.Error("unable to create role for channel", zap.String("channel", newChannelName), zap.String("id", ch.ID), zap.Error(err))<commit_msg>Making sure roles and channels are lowercase<commit_after>package bot

import (
	"fmt"
	"github.com/bwmarrin/discordgo"
	"go.uber.org/zap"
	"strings"
	"time"
)

const channelCommand = "!channel"
const inviteCommand = "!invite"
const leaveCommand = "!leave"

const memberCategoryID = "440865911910563861" //TODO config?
const memberChannelRoleFmt = "mc_%s"
const channelAssignName = "channel-assign"
const joinMemberChannelEmoji = "✅"
const leaveMemberChannelEmoji = "🛑"

// !channel channel_name
func (d *DiscordAPI) tempChannelCommandHandler(s *discordgo.Session, event *discordgo.MessageCreate) {

	if event.GuildID != d.Config.GuildId {
		return
	}

	fields := strings.Fields(event.Content)
	if len(fields) <= 2 && fields[0] != channelCommand {
		return
	}

	newChannelName := strings.ToLower(fields[1])

	//check if channel exists
	if ok, chID := d.checkTextChannelPresenceByName(memberCategoryID, newChannelName); ok {
		if _, err := d.discord.ChannelMessageSend(event.ChannelID, fmt.Sprintf("The channel <#%s> already exists. Check <#%s> for the list of channels.", chID, d.memberChannelAssignID)); err != nil {
			Logger.Error("unable to send intro message", zap.String("channel", event.ChannelID), zap.Error(err))
		}
		return
	}

	// create channel
	ch, err := d.newMemberChannel(newChannelName)
	if err != nil {
		Logger.Error("unable to create member channel", zap.String("channel_name", newChannelName), zap.Error(err))
		return
	}

	//create role
	mcRole, err := d.newMemberChannelRole(newChannelName, ch.ID)
	if err != nil {
		Logger.Error("unable to create role for channel", zap.String("channel", newChannelName), zap.String("id", ch.ID), zap.Error(err))
{'fraction_non_alphanumeric': 0.13699878493317133, 'fraction_numerical': 0.01275820170109356, 'mean_word_length': 5.098148148148148, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3581003', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1118, 'n_words': 269}