Ejemplo n.º 1
0
async def joined(member, clt):
    global client
    client = clt

    if not member.bot:
        return

    botlist = get_botlist(member.server)

    if cmd_invite.last_invite is None:
        await client.send_message(discord.utils.get(member.server.channels, name="general"), embed=discord.Embed(color=discord.Color.red(), description="The currently joined bot %s can not be assinged a owner!" % member.mention))

    owner = cmd_invite.last_invite[member.id]

    if owner is not None:
        g = gspread_api.Settings("dd_saves", 3)
        botlist[member] = owner
        g.set_dict(
            dict([(k.id, v.id) for k, v in botlist.items()])
        )

    await client.add_roles(member, discord.utils.get(member.server.roles, name="User Bots"))
    await client.change_nickname(member, "🤖 %s (%s)" % (member.name, owner.nick if owner.nick is not None else owner.name))
    invite_receivers = [discord.utils.get(member.server.members, id=uid) for uid in functions.get_settings()["roles"]["invite-receivers"]]
    for u in invite_receivers:
        await client.send_message(u, embed=discord.Embed(color=discord.Color.green(), description="Bot %s got accepted on the server." % member.mention))
    if owner is not None:
        await client.add_roles(owner, [r for r in member.server.roles if r.name == "Bot Owner"][0])
        await client.send_message(owner, embed=discord.Embed(color=discord.Color.orange(), description="**Your bot was successfully added on the server!**\n\nPlease use the command `!prefix` to set the bots prefix.\nPlease check before if your prefix is free with `!prefix list` and then assing to your bot a free prefix."))
Ejemplo n.º 2
0
def get_saves():
    g = gspread_api.Settings("dd_saves", 2)
    temp = g.get_dict()
    out = {}
    for k, v in temp.items():
        bot = get_bot(k)
        if bot is not None:
            out[bot] = v
    return out
Ejemplo n.º 3
0
def get_list():

    g = gspread_api.Settings("dd_saves", 1)
    temp = g.get_dict()
    out = {}
    for k, v in temp.items():
        memb = get_member(k)
        if memb is not None:
            out[memb] = v
    return out
Ejemplo n.º 4
0
def get_botlist(server):
    g = gspread_api.Settings("dd_saves", 3)
    temp = g.get_dict()
    out = {}

    for k, v in temp.items():
        bot = _get_member(k, server)
        user = _get_member(v, server)
        if bot is not None and user is not None:
            out[bot] = user
    return out
Ejemplo n.º 5
0
async def ex(message, client):

    server = message.server

    sendmsg = await client.send_message(message.channel, "Collecting data...\n\nYou could take a small coffe that while ;) :coffee:")

    bots = userbots.get_botlist(server)
    pres = gspread_api.Settings("dd_saves", 2).get_dict()

    msg = ""
    print(pres)
    for b, o in bots.items():
        prefix = pres[b.id] if b.id in pres.keys() else "[NOT REGISTERED!]"
        msg += "%s\nby %s\n```Prefix:  %s```\n\n" % (b.mention, o.mention, prefix)

    print(len(msg))
    await client.delete_message(sendmsg)
    await client.send_message(message.channel, "*On mobile devices, this view will be really bugy. Please use a desktop device for this command!*\n\n" + msg)
Ejemplo n.º 6
0
def get_table():
    g = gspread_api.Settings("dd_saves", 0)
    temp = g.get_dict()
    return dict([(k, int(v)) for k, v in temp.items()])
Ejemplo n.º 7
0
def save(table):

    g = gspread_api.Settings("dd_saves", 0)
    g.set_dict(table)
Ejemplo n.º 8
0
def save_list(indict):
    g = gspread_api.Settings("dd_saves", 1)
    g.set_dict(
        dict([(k.id, v) for k, v in indict.items()])
    )