Untitled

 avatar
unknown
python
4 years ago
1.6 kB
8
Indexable
    @commands.command()
    @commands.cooldown(1, 60, commands.BucketType.guild)
    async def setup(self, ctx):
        await ctx.message.channel.send("Ping the names (ex. '#general, #announcements, #partners' or, if you want only one channel, ping just that channel, such as: '#giveaways') of the channels that you want the main message ad to run in. Seperate each channel with a comma.")
        def check(m):
            return m.channel_mentions and m.channel.id == ctx.message.channel.id
        dict = {
            "main_ad_channels" : {

            }
        }
        response_1 = await self.bot.wait_for('message', timeout = 30, check = check)
        for x in response_1.channel_mentions:
            dict["main_ad_channels"]["channel_" + x.name] = x.id
        insert_update = self.bot.db.Guilds.update_one({"guild_id": ctx.guild.id}, { "$set": dict})

        await ctx.message.channel.send("Channels have been set!")

        print("done 1")

        await ctx.message.channel.send("Set the duration you want each message ad to be sent in minutes. Minimum is 5 minutes, and maximum is 1440 minutes.(ex. '5', or '60', or '1440')")

        def check(m_2):
            return m_2.channel_mentions and m_2.channel.id == ctx.message.channel.id
        print("in 1")
        dict_2 = {
            "main_ad_loop_duration_time" : {

            }
        }

        response_2 = await self.bot.wait_for('message', check = check)
        insert_update_2 = self.bot.db.Guilds.update_one({"guild_id": ctx.guild.id}, { "$set": dict_2})
        print(response_2)
        print('done 2')
Editor is loading...