コード例 #1
0
 async def hello(self, ctx):
     try:
         await ctx.send(
             content=f'Hello young {ctx.author.top_role}, how are you today?'
         )
     except Exception as error:
         send_log(str(error), log_location)
コード例 #2
0
 async def potato(self, ctx):
     try:
         await ctx.send(
             content=f"Even the Omni-King messes up!"
             f" Currently the audience potato count is {helpers.counters.get_potato_count()}"
         )
     except Exception as error:
         send_log(str(error), log_location)
コード例 #3
0
 async def ping(self, ctx):
     try:
         await ctx.send(
             content=
             ":ping_pong: Ooo, I believe they call this game table tennis, I would love to play"
         )
         log_message = f"{ctx.message.author} used ping command on {datetime.datetime.now()}"
         send_log(log_message, log_location)
     except Exception as error:
         send_log(str(error), log_location)
コード例 #4
0
 async def on_message(self, message):
     try:
         announcement_channel = self.bot.get_channel(
             id=int(config['channel_text']['announcement_channel_text']))
         channel = message.channel
         if channel.id is not announcement_channel.id and '@everyone' in message.content:
             await message.delete()
             await channel.send(
                 "You can't use @ everyone in this battleground, it is annoying!"
                 " Use @ here if you really need a call to arms.")
             log_msg = f"{message.author} tried using @everyone in {channel} on {datetime.datetime.now}"
             send_log(log_msg, log_location)
     except Exception as error:
         send_log(str(error), log_location)
コード例 #5
0
 async def info(self, ctx):
     try:
         user = ctx.author
         role = user.top_role
         if role is "@everyone":
             role = "@ everyone"
         msg = f"Oh Ho, Ho, I know a lot about you, young {role}\n " \
               f"Your name is {user.name}\n " \
               f"Your ID is {user.id}\n " \
               f"Your status is {user.status}\n " \
               f"Your best role is {role}\n " \
               f"And you joined this server on {user.joined_at}\n"
         await ctx.send(content=msg)
         log_message = f"The user {user.name}, has requested the following " \
                       f"Name:{user.name}, ID:{user.id}, Status:{user.status}," \
                       f" Role:{role}, and Join Date/Time:{user.joined_at}, on {datetime.datetime.now()}"
         send_log(log_message, log_location)
     except Exception as error:
         send_log(str(error), log_location)
コード例 #6
0
 async def timeout(self, ctx, *args):
     victim = ctx.message.mentions
     if len(victim) > 1:
         raise commands.TooManyArguments(
             "Limit use to one person at a time.")
     victim = victim[0]
     command_list = command_parse(args)
     timeout_role = discord.utils.get(
         ctx.message.server.roles, name=config['role_name']['timeout_role'])
     timeout_date = datetime.datetime.now()
     reason = f"You have been deemed an annoyance, but only a minor one, and are being put in stasis. " \
              f"This was on order of {ctx.message.author}"
     end_reason = f"You are no longer in my stasis field(timeout), try be better this time. " \
                  f"Remember this was on order of {ctx.message.author}"
     msg = possible(ctx, ctx.message.author, victim)
     if msg is not '':
         await self.bot.send_message(ctx.message.channel, msg)
         log_msg = f"{ctx.message.author} tried to use timeout on {victim.name} on {datetime.datetime.now()}"
         print(log_msg)
         send_log(log_msg, log_location)
         return
     timeout_until = time_parse(command_list)
     await self.bot.add_roles(victim, timeout_role)
     if victim.voice_channel is not None:
         channel = discord.utils.get(
             ctx.message.server.channels,
             name=config['channel_voice']['afk_channel'])
         await self.bot.move_member(victim, channel)
     await self.bot.send_message(victim, reason)
     log_msg = f"{victim.mention} was timed out until {timeout_date+timedelta(seconds=timeout_until)}, by {ctx.message.author},  on {datetime.datetime.now()}"
     await self.bot.send_message(ctx.message.channel, log_msg)
     print(log_msg)
     send_log(log_msg, log_location)
     await asyncio.sleep(timeout_until)
     await self.bot.remove_roles(victim, timeout_role)
     await self.bot.send_message(victim, end_reason)
     log_msg = f"{victim.mention} has finished their time out, which happened on {timeout_date}, by {ctx.message.author}"
     send_log(log_msg, log_location)
     await self.bot.send_message(ctx.message.channel, log_msg)
     print(
         f"{victim.name} finished their timeout from {ctx.message.author}")