コード例 #1
0
async def webhook(keyword_content, send_type, is_separate):
    if not is_separate:
        temp = bot.log_conf['webhook_url'].split('/')
    else:
        temp = bot.log_conf['webhook_url2'].split('/')
    channel = temp[len(temp) - 2]
    token = temp[len(temp) - 1]
    webhook_class = Webhook(bot)
    request_webhook = webhook_class.request_webhook
    if send_type.startswith('embed'):
        if 'ping' in send_type:
            await request_webhook('/{}/{}'.format(channel, token),
                                  embeds=[keyword_content.to_dict()],
                                  content=bot.user.mention)
        else:
            await request_webhook('/{}/{}'.format(channel, token),
                                  embeds=[keyword_content.to_dict()],
                                  content=None)
    else:
        if 'ping' in send_type:
            await request_webhook('/{}/{}'.format(channel, token),
                                  content=keyword_content + '\n' +
                                  bot.user.mention,
                                  embeds=None)
        else:
            await request_webhook('/{}/{}'.format(channel, token),
                                  content=keyword_content,
                                  embeds=None)
コード例 #2
0
ファイル: todo.py プロジェクト: ThomasBot/Selfbot
 async def webhook(self, entry, send_type):
     temp = self.bot.log_conf['webhook_url'].split('/')
     channel = temp[len(temp) - 2]
     token = temp[len(temp) - 1]
     webhook_class = Webhook(self.bot)
     request_webhook = webhook_class.request_webhook
     em = discord.Embed(title='Timer Alert', color=0x4e42f4, description='Timer for item: **%s** just ran out.' % entry)
     if 'ping' in send_type:
         await request_webhook('/{}/{}'.format(channel, token), embeds=[em.to_dict()], content=self.bot.user.mention)
     else:
         await request_webhook('/{}/{}'.format(channel, token), content=None, embeds=[em.to_dict()])
コード例 #3
0
ファイル: msg.py プロジェクト: ALEHACKsp/Discord-SelfBot-2
 def __init__(self, bot):
     self.bot = bot
     self.webhook_class = Webhook(self.bot)
     self.request_webhook = self.webhook_class.request_webhook