diff --git a/chillone/__main__.py b/chillone/__main__.py index aa1812d..b3f56c2 100644 --- a/chillone/__main__.py +++ b/chillone/__main__.py @@ -16,6 +16,7 @@ def embed(*args, fields: Iterable[tuple[str, ...]]=(), inline: bool = False, **k class ChillOneBot(nextcord.Client): """The Chill One source code.""" + suggestion_count = 0 @tasks.loop(hours=24*7) async def chill(self, ) -> None: @@ -26,7 +27,19 @@ async def chill(self, ) -> None: for _ in range(42): await channel.send("".join(Space.generate(1800))) return - + + @nextcord.slash_command() + async def suggest(self, interaction: nextcord.Interaction, suggestion: str) -> None: + self.suggestion_count += 1 + try: + channel = await self.fetch_channel(os.environ["RULES_CHANNEL_ID"]) + message = await channel.send(f"**Suggestion #{self.suggestion_count:.4}** by {interaction.user.mention}\n\n{suggestion}") + # TODO: add a reaction voting sub task. + except KeyError as err: + await interaction.send(f"```\No rules channel set in environment!\n\n{err}\n```") + except nextcord.ChannelNotFound as err: + await interaction.send(f"```Specified rules channel not found!\n\n{err}\n```") + if __name__ == "__main__": bot = ChillOneBot()