lilserf / bot-on-the-clocktower Goto Github PK
View Code? Open in Web Editor NEWBot to assist with playing Blood on the Clocktower via Discord
License: MIT License
Bot to assist with playing Blood on the Clocktower via Discord
License: MIT License
Not that you would have just 1 evil player, but if you try the message says "Your minions are:"
Suggestion:
!setStorytellers Colin Mark
If one of the mover commands is used by someone who is NOT in the current Storyteller list, it should clear the previous Storytellers and set the 1 who used the command.
!endgame
should also clear the STs
As of May 4, 2021, Discord added some first-class support for slash commands, including autocomplete. Bot on the Clocktower should make use of this (perhaps only if it has Slash Command permission for the server?)
New slash commands for bots! Performing actions with bots is easier than ever. Bot developers—when they’re ready, please don’t scare them—can have a list of commands available for their bots accessible by the forwardslash key (/). You won’t have to remember bot commands anymore and get laughed at when you get the command wrong :( !help…..!help….please
Added use Slash Commands permission. If you run a server, make sure to configure this permission for your bot channels. Bots that upgrade to Slash Commands require this permission.
Give the storyteller some additional tools for use on this rowdy bunch, perhaps
Would need to talk to bra1n to see if this is possible.
You can use inverse logic in the code below
if info is not None:
await self.sendEmbed(ctx, info)
else:
await ctx.send("Sorry, I couldn't find a town registered to this channel.")
if info:
await self.sendEmbed(ctx, info)
else:
await ctx.send("Sorry, I couldn't find a town registered to this channel.")
There are many lines of code very you can apply this improvement.
Right now Mark & Jaime (followed by Mel and Richie) are always the last moved out of Town Square
TypeError('sequence item 0: expected str instance, Member found',) (from message !currgame)
I thought this was because nobody was in a voice channel but it happened even when I was in a voice channel
I did 2 "!evil Colin Colin" commands in fairly quick succession when not connected to the Town Square, and the 2nd one did not get deleted. Rate limits?
Lots of ...
s hide text:
Commands:
currgame Set the current users in all standard BotC voice channels as playe...
day Move users from Cottages back to Town Square
evil Send evil info to evil team. Format is `!evil <demon> <minion> <mi...
help Shows this message
lunatic Send fake evil info to the Lunatic. Format is `!lunatic <Lunatic> ...
night Move users to Cottages in the BotC - Nighttime category
vote Move users from other channels back to Town Square
For the last 2 weeks, the automatic cleanup of the game has not worked. I'm guessing it's hitting an exception somewhere and aborting
I used !endgame
with nobody in the Town Square, and nothing happened.
Then I remembered that someone usually has to be connected, and I used it again. Here's what happened:
I then though maybe doing it first when not in Town Square was a problem, so I did !curgame
(typo!) followed by !endgame
. Same visible results after !endgame
, but I was also sent this error:
Traceback (most recent call last):
File "bot.py", line 114, in onEndGame
await prevSt.remove_roles(stRole)
AttributeError: 'NoneType' object has no attribute 'remove_roles'
I then realized the command was actually !currgame
, so I tried again to do !currgame
!endgame
. This time, the Cottages went away, but I still had (ST) on my name, and I got the whisper with the same error above again.
This would talk to a user (via DMs?) and interactively add a town by asking questions
Alternately, this flow could even create the channels for a town with the correct permissions etc (though that would require new permissions on the bot)
Hi!
Intrigued by this bot, but the group I play with doesn't prefer cottages.
Would it be possible to disable !day !night and cottage creation in some way?
I don't know how easy this is, but some bots have a web-based control panel that can be used to poke at a bot, rather than needing to send messages to a channel. This would be a super cool API, and something you could pop out to another window and use buttons to (for example) switch to night and day.
Otherwise if they were playing in the round before they'll have their perms for the Cottage they were in suppressed
We play weekly, and many weeks when the first night starts I notice we have a chat channel full of messages I haven't read from the previous week. This is usually because I storytell the last game, and don't have time for the chat channel anyway.
There should be an option to, probably during periodic cleanup, clear out the chat channel. It's intended to be a temporary thing just for the current game anyway, so I think we would set this option on our Town.
Depends on #5
We're getting to the point where we are almost full up for a single game of BotC, with around 12-13 players. If we eventually hit 16 players, that's sort of 1 too many (although travelers can alleviate that) and there's a LOT of crosstalk. It may very well be better, in such a case, to split up into 2 groups (8 players and 7 players, or more).
In order to facilitate this, the mover bot would need some extra sauce:
Assuming there will be 2 separate #botc_mover channels, and that each of those represents its own game. For each #botc_mover channel:
!set nightcategory <id or string>
)!set strole <id or string>
)!set playerrole <id or string>
)Similar to Storytellers, Spectators could have their names prefixed/suffixed and can be thrown into the same cottage together at night.
Traceback (most recent call last):
File "bot.py", line 155, in onCurrGame
if o != storyteller and stRole in o.roles:
NameError: name 'stRole' is not defined
It could use the DB to pull data on what channels/categories etc to remove instead of assuming they have certain names
It could also be used within the control channel with no parameters if we want
class botcBot -> function getTownInfo. There's no need to else statement there.
Explanation:
If the IF statement returns True it will return TownInfo(ctx.guild, doc) and jumps out of the function else the interpreter will go to the next line and then it will return None and jump out of the function.
If no commands come in to a town after like 6-12 hours, and the bot still thinks a game is in progress for that town, run the !endgame command to clean up roles.
We might not want our local-running bots to touch the "prod" mongo cluster/db
I storytold and got the BotC Current Storyteller role. Then, Tommy was storyteller, and he got the role but I still had it also.
Moved the storyteller to their cottage but then failed to set the permissions on that cottage
File "bot.py", line 941, in onNight
await cottage.set_permissions(user, view_channel=True)
File "/app/.heroku/python/lib/python3.6/site-packages/discord/abc.py", line 658, in set_permissions
await http.edit_channel_permissions(self.id, target.id, allow.value, deny.value, perm_type, reason=reason)
File "/app/.heroku/python/lib/python3.6/site-packages/discord/http.py", line 241, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
If the person whose nickname needs to be changed has a role higher in the role list than the bot - including being the owner of the server - then the error message is messy. We should catch this error message and send an explanation about what can be done to fix it, e.g.:
Attempted to change nickname "Colin" to "(ST) Colin" but was unable. This is likely for one of these reasons:
- Colin has a role that is higher in the role list than the Bot on the Clocktower role
- Colin is the owner of the server
- Bot on the Clocktower needs to be re-invited to the server to grant it nickname-changing permissions
This could be sent to the mover channel rather than being a private message
The users need the "View Channel" permission for that particular channel, not any mucking around with roles.
Presumably people will not always tell our bot when they don't want it anymore (kick from guild) or have removed their day categories, but we'll still have data about them sitting around in the DB.
This task is to have a (weekly?) maintenance task to check on towns and see if we can still access the guild/day category. If we can't, then we might as well eject them from the db.
Storyteller should be able to move members in the cottages (like, to put 2 players into 1 cottage)
Doing:
!createtown TestTown
Followed pretty immediately by:
!destroytown TestTown
Appears to fail to destroy some stuff. Message:
I destroyed what I knew about for Town TestTown2.
I did not destroy some things I was unfamiliar with:
- TestTown2 - Night / Cottage (channel)
- TestTown2 / Graveyard (channel)
You can destroy them and run this command again.
I did not destroy these things yet, just in case you still need them:
- TestTown2 - Night (category)
- TestTown2 / botc_mover (channel)
- TestTown2 (category)
- TestTown2 Villager (role)
- TestTown2 Storyteller (role)
However, as far as I can tell, the Cottage and the Graveyard DID get destroyed. So there appears to be a bug where it thinks it didn't destroy the Graveyard, or something. Might be a lag issue of some kind, may need to tweak how we determine whether a channel was destroyed.
Running it again works fine.
When run from the control channel, it would infer as much as possible via naming/regexes:
So that when rate limits kick in, the user can tell the bot has heard their command and is trying to do something
!legion is like !evil, but:
I think this would be easier to handle as 1 command rather than visiting each person individually. But I dunno what the syntax should be.
"cory" was at the bottom of the list
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.