poshbotio / PoshBot

Powershell-based bot framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Solved - Kinda] Channel Rules not yet working on Discord

Kickbut101 opened this issue · comments

commented

It seems that no matter how I enter in the names of the channels my bot has access to the channel rules don't seem to be respected or work how I enter them.

Expected Behavior

Ability to filter which channels can use which plugins and commands in discord

Current Behavior

Unless the channel = '*' the channel I enter doesn't seem to be respected or adhered to at all in regards to the included and excluded commands. I don't think the backend correctly identifies the channels (or channel ids) right now to use the "channel rules"

Possible Solution

Have backend translate the user input channel name to the proper name/format/channelID

Steps to Reproduce (for bugs)

1.Change the default config from a channel = '*' to some other channel
2. Commands essentially stop working, if you decided to put something in the inclusion other than *

Your Environment

  • Module version used: 0.12
  • Operating System and PowerShell version: Win10 Powershell 5.1 I believe.

EDIT EDIT EDIT!! 12-13-19

What I was trying;

  ChannelRules = @(
  	@{
	Channel = '*'
	IncludeCommands = @('*')
    ExcludeCommands = @('MineCraft-Discord-Bot-Module:*')
	}
  ) 

AND

  ChannelRules = @(
  	@{
	Channel = '*general*'
	IncludeCommands = @('*')
    ExcludeCommands = @('MineCraft-Discord-Bot-Module:*')
	}
  )

AND
Many variations including the actual channel ID with \ or * or ! in front of it and behind it in all sorts of combinations.

What finally started working

  ChannelRules = @(
  	@{
	Channel = '*mcraft*'
	IncludeCommands = @(
	'MineCraft-Discord-Bot-Module:*'
	'*'
	)
    ExcludeCommands = @()
	}
	@{
	Channel = '*'
	IncludeCommands = @('*')
    ExcludeCommands = @('MineCraft-Discord-Bot-Module:*')
	}
  )

I believe the breakthrough here was that for some reason the asterisk wasn't actually wildcarding all of my commands as I had hoped, and beyond that I had to set the "inclusion" rule before the "exclusion" rule. (See the order that I listed the channel rules in "What finally started working" the channel where I wanted the specific module to work has to be listed before the catch-all exclusion of it.

Ugh. Definitely stupidity and misunderstanding on my part. I do wish however there was a more verbose logging in the logging that pertained to the channel rules matching. (Yes I had debug on).

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.