Beispiel #1
0
import requests

from iotbot import IOTBOT
from iotbot import Action
from iotbot import GroupMsg

bot_qq = 123
bot = IOTBOT(bot_qq, use_plugins=True, plugin_dir='plugins')
action = Action(bot)


# 群消息中间件使用示例
def group_ctx_middleware(ctx):
    ctx.master = 333  # 主人qq


bot.register_group_context_middleware(group_ctx_middleware)
####################


@bot.on_group_msg
def on_group_msg(ctx: GroupMsg):
    content = ctx.Content
    # 召唤群友(回执消息)
    if ctx.FromUserId == ctx.master and content == '召唤群友':
        card = """<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID="107" templateID="1" action="viewReceiptMessage" brief="[回执消息]" m_resid="1tko/MQMaPR0jedOx6T8tbleZtAZudGqTFakakLqukDzuTjrZS1/1V1QEUnZ8/2Y" m_fileName="6828184148041033822" sourceMsgId="0" url="" flag="3" adverSign="0" multiMsgFlag="0"><item layout="29" advertiser_id="0" aid="0"><type>1</type></item><source name="" icon="" action="" appid="-1" /></msg>"""
        action.send_group_xml_msg(ctx.FromGroupId, content=card)
        return

    # nmsl
    if content == 'nmsl':
Beispiel #2
0
                    action='store_true',
                    help='Print loglevel=INFO')
parser.add_argument('--plugin-dir', default='plugins', help='Plugin directory')
parser.add_argument('--log-path',
                    default=os.path.sep.join(('logs', 'log.txt')),
                    help='Path to log file')
args = parser.parse_args()

if args.verbose:
    logging.basicConfig(level=logging.INFO)
else:
    logging.basicConfig(level=logging.ERROR)

# bot类
bot = IOTBOT(configuration.qq,
             use_plugins=True,
             plugin_dir=args.plugin_dir,
             log_file_path=args.log_path)
action = Action(bot)

# 插件控制类
plugins = PluginControl()

# admin命令接受

from admin.admin_else import admin_else_group, admin_else_friend

bot.add_group_msg_receiver(admin_else_group)
bot.add_friend_msg_receiver(admin_else_friend)

from admin.admin_refresh import admin_refresh_group, admin_refresh_friend
Beispiel #3
0
    :return: {bool} 包含返回True, 不包含返回False
    """
    for ch in check_str:
        if u'\u4e00' <= ch <= u'\u9fff':
            return True
    return False


def to_unicode(check_str):
    ret = ""
    for v in check_str:
        ret = ret + hex(ord(v)).upper().replace("0X", "\\u")
    return ret


bot = IOTBOT(157199224, log=False)
action = Action(bot, queue=False)

bOpenThisBOT = True
dataCiliGroupData = {}

nAAAAAAAA = 91

nReciveTimes = 0

LEFT_PART_VERTICAL_BLANK_MULTIPLY_FONT_HEIGHT = 2
LEFT_PART_HORIZONTAL_BLANK_MULTIPLY_FONT_WIDTH = 1 / 4
RIGHT_PART_VERTICAL_BLANK_MULTIPLY_FONT_HEIGHT = 1
RIGHT_PART_HORIZONTAL_BLANK_MULTIPLY_FONT_WIDTH = 1 / 4
RIGHT_PART_RADII = 10
BG_COLOR = "#000000"
Beispiel #4
0
import os
import random
import re
import threading
import time
from time import sleep
import datetime
import iotbot.decorators as deco
import requests
import schedule
from iotbot import IOTBOT, Action, GroupMsg

from Utils import utils, SQLiteUtils, BaiduApi, setuUtil, ciyunUtil
from chatPlugin import main
day = datetime.date.today().strftime("%Y%m%d")
bot = IOTBOT(1328382485, log_file_path='log/' + day + '.log')
action = Action(bot)


def getGroupList():
    GroupID = []
    groupList = action.get_group_list()
    TroopList = groupList['TroopList']
    for group in TroopList:
        GroupID.append(group['GroupId'])
    return GroupID


def sent_wyy():
    print("网抑云定时任务执行成功")
    file = os.listdir('wyy')[random.randint(0, 9)]
Beispiel #5
0
# -*- coding:utf-8 -*-

from iotbot import IOTBOT, Action, GroupMsg

bot_qq = 12345678

bot = IOTBOT(qq=bot_qq, host='http://127.0.0.1', port=8888, use_plugins=True)
action = Action(bot)


@bot.on_group_msg
def on_group_msg(ctx: GroupMsg):
    # 不处理自身消息
    if ctx.FromUserId == ctx.CurrentQQ:
        return


if __name__ == "__main__":
    bot.run()
Beispiel #6
0
import datetime
import json
import os
import random
import re
import threading
import time
from time import sleep
import datetime
import iotbot.decorators as deco
import requests
import schedule
from iotbot import IOTBOT, Action, GroupMsg, EventMsg
from Utils import utils, SQLiteUtils, BaiduApi, setuUtil, ciyunUtil, weatherUtil

bot = IOTBOT(1689236904, log_file=True)
action = Action(bot)


def getGroupList():
    GroupID = []
    groupList = action.get_group_list()
    TroopList = groupList['TroopList']
    for group in TroopList:
        GroupID.append(group['GroupId'])
    return GroupID


def sent_wyy():
    print("网抑云定时任务执行成功")
    file = os.listdir('wyy')[random.randint(0, 9)]
import datetime
import json
import os
import random
import re
import threading
import time
from time import sleep
import datetime
import iotbot.decorators as deco
import requests
import schedule
from iotbot import IOTBOT, Action, GroupMsg, EventMsg
from Utils import utils, SQLiteUtils, BaiduApi, setuUtil, ciyunUtil, weatherUtil

bot = IOTBOT(1328382485, log_file=True)
action = Action(bot)


def getGroupList():
    GroupID = []
    groupList = action.get_group_list()
    TroopList = groupList['TroopList']
    for group in TroopList:
        GroupID.append(group['GroupId'])
    return GroupID


def sent_wyy():
    print("网抑云定时任务执行成功")
    file = os.listdir('wyy')[random.randint(0, 9)]
Beispiel #8
0
from iotbot import IOTBOT
from iotbot import Action
from iotbot import EventMsg
from iotbot import FriendMsg
from iotbot import GroupMsg

bot_qq = 11
bot = IOTBOT(bot_qq, use_plugins=False)
action = Action(bot)


@bot.on_group_msg
def on_group_msg(ctx: GroupMsg):
    print(ctx.message)
    if ctx.Content == '刷新插件':
        bot.refresh_plugins()
    if ctx.Content == '.test':
        action.send_group_pic_msg(ctx.FromGroupId, 'https://t.cn/A6Am7xYO')


@bot.on_friend_msg
def on_friend_msg(ctx: FriendMsg):
    print(ctx.message)
    if ctx.Content == '.test':
        action.send_friend_pic_msg(ctx.FromUin, picUrl='https://t.cn/A6Am7xYO')


@bot.on_event
def on_event(ctx: EventMsg):
    print(ctx.message)
    print(ctx.EventName)
Beispiel #9
0
# -*- coding:utf-8 -*-

from iotbot import IOTBOT, Action, GroupMsg
import os

bot_qq = 12345678

# 使得并发命令时,插件可以排队处理
os.environ['BOTQQ'] = str(bot_qq)

bot = IOTBOT(
    qq=bot_qq,
    # 若非默认,请在 .iotbot.json 内配置 ↓
    # host = 'http://127.0.0.1',
    # port = 8888,
    use_plugins=True)
action = Action(bot)


@bot.on_group_msg
def on_group_msg(ctx: GroupMsg):
    # 不处理自身消息
    if ctx.FromUserId == ctx.CurrentQQ:
        return


if __name__ == "__main__":
    bot.run()