Преглед изворни кода

chanelsettings database mod

root пре 3 година
родитељ
комит
3e164c8885
2 измењених фајлова са 8 додато и 3 уклоњено
  1. 6 2
      bot/commands/general.py
  2. 2 1
      bot/query/initialise_database.py

+ 6 - 2
bot/commands/general.py

@@ -2,6 +2,7 @@ from discord.ext import commands
 import discord
 import time
 from typing import Optional
+from query.channel import get_interact
 
 def setup(bot: commands.Bot):
 	bot.add_cog(General(bot))
@@ -51,8 +52,11 @@ class General(commands.Cog):
 			else:
 				await ctx.send("What would you like me to say?")
 		elif channel:
-			
-			await channel.send(message)
+			print(channel.id)
+			if await get_interact(self.bot.pg, channel.id): # or await ctx.author.get_guild_permissions(channel.guild):
+				await channel.send(message)
+			else:
+				await ctx.send(f"Interactive mode for {channel} is deactivated.")
 		elif user:
 			await user.send(message)
 		else:

+ 2 - 1
bot/query/initialise_database.py

@@ -11,7 +11,8 @@ async def init_db(pg):
                 id SERIAL PRIMARY KEY, \
                 channel_id BIGINT UNIQUE NOT NULL, \
                 guild BIGINT REFERENCES guild (guild_id), \
-                interact BOOL DEFAULT FALSE\
+                interact BOOL DEFAULT FALSE, \
+                games BOOL 
             )\
         ",
         "CREATE TABLE IF NOT EXISTS \