Exemple #1
0
 async def on_member_join(self, m):
     self.bot.cursor.execute("select * from gban_dates where id=?",
                             (m.id, ))
     gbaninfo = self.bot.cursor.fetchone()
     if gbaninfo:
         u = await self.bot.fetch_user(gbaninfo["id"])
         by = await self.bot.fetch_user(gbaninfo["gban_by"])
         self.bot.cursor.execute("select * from gban_settings where id=?",
                                 (m.guild.id, ))
         gs = self.bot.cursor.fetchone()
         g = m.guild
         ch = g.get_channel(gs["chid"])
         if g:
             try:
                 await g.ban(
                     u,
                     reason=
                     f"思惟奈ちゃんグローバルBAN:{gbaninfo['reason']}(実行者:{by}({by.id}))"
                 )
             except:
                 await ch.send(embed=ut.getEmbed(
                     "グローバルBANに基づく、BANの試行",
                     f"{u}({u.id})は、`{gbaninfo['reason']}`として思惟奈ちゃんのグローバルBANを受けています。\nBANしようとしましたが、権限不足等の理由でBANできませんでした。\nグローバルBAN実行者:{by}({by.id})"
                 ))
             finally:
                 await ch.send(embed=ut.getEmbed(
                     "グローバルBANに基づく、BANの実行",
                     f"{u}({u.id})は、`{gbaninfo['reason']}`として思惟奈ちゃんのグローバルBANを受けています。\nよって、このサーバーからBANを行いました。\nグローバルBAN実行者:{by}({by.id})"
                 ))
Exemple #2
0
 async def guserft(self,ctx,*,nandt):
     lt=[f"{str(m)}({m.id})" for m in self.bot.users if nandt in str(m)]
     if lt:
         t="\n".join(lt)
         await ctx.send(embed=ut.getEmbed(f"{str(nandt)}に一致するユーザー",f"```{t}```"))
     else:
         await ctx.send(embed=ut.getEmbed("","一致ユーザーなし"))
Exemple #3
0
 async def guildprefix(self, ctx, mode="view", ipf=""):
     if ipf == "@everyone" or ipf == "@here":
         await ctx.send("その文字列はprefixとして使えません。")
         return
     self.bot.cursor.execute("select * from guilds where id=?",
                             (ctx.guild.id, ))
     gs = self.bot.cursor.fetchone()
     if mode == "view":
         await ctx.send(embed=ut.getEmbed(
             "ユーザーのprefix", f'```{",".join(gs["prefix"])}```'))
     elif mode == "set":
         spf = gs["prefix"] + [ipf]
         self.bot.cursor.execute(
             "UPDATE guilds SET prefix = ? WHERE id = ?",
             (spf, ctx.guild.id))
         await ctx.send(ctx._("upf-add", ipf))
     elif mode == "del":
         spf = gs["prefix"]
         spf.remove(ipf)
         self.bot.cursor.execute(
             "UPDATE guilds SET prefix = ? WHERE id = ?",
             (spf, ctx.guild.id))
         await ctx.send(f"{ipf}を削除しました。")
     else:
         await ctx.send(embed=ut.getEmbed(
             "不適切なモード選択", "`view`または`set`または`del`を指定してください。"))
Exemple #4
0
 async def b_mail(self, ctx):
     dch = await ut.opendm(ctx.author)
     schs = [
         i for i in self.bot.get_all_channels() if i.name.startswith("sbm-")
     ]
     bmaillog = self.bot.get_channel(701747896621596693)
     try:
         msg = await ut.wait_message_return(ctx, "あなたの思いをここにのせて…", dch, 30)
         sch = random.choice(schs)
         #try:
         smg = await sch.send(embed=ut.getEmbed(
             "誰かの手紙が流れ着いた…", msg.clean_content, self.bot.ec,
             "もし迷惑ユーザーを見かけたら", "メッセージIDを添えて`s-report`コマンドでお知らせください。"))
         e = ut.getEmbed(
             "ボトルメールログ", msg.clean_content, self.bot.ec, "送信先サーバー:チャンネル",
             f"{smg.guild.name}({smg.guild.id}):{smg.channel.name}({smg.channel.id})",
             "メッセージID", str(smg.id))
         e.set_author(
             name=f"{msg.author}({msg.author.id})",
             icon_url=msg.author.avatar_url_as(static_format="png"))
         await bmaillog.send(embed=e)
         #except:
         #pass
     except asyncio.TimeoutError:
         await dch.send("手紙とボトルはどこかへ消えてしまった…")
Exemple #5
0
 async def globalpost(self, ctx, gmid: int):
     post = None
     self.bot.cursor.execute("select * from globaldates")
     dats = self.bot.cursor.fetchall()
     for i in dats:
         if gmid in i["allid"]:
             post = i
     self.bot.cursor.execute("select * from users where id=?",
                             (ctx.author.id, ))
     upf = self.bot.cursor.fetchone()
     if upf["gmod"]:
         self.bot.cursor.execute("select * from users where id=?",
                                 (i["aid"], ))
         u = self.bot.cursor.fetchone()
         g = self.bot.get_guild(post["gid"])
         await ctx.send(embed=ut.getEmbed(
             "メッセージ内容", post['content'], self.bot.ec, "送信者id:", post['aid'],
             "送信先", post["allid"], "送信者のプロファイルニックネーム", upf['gnick'],
             "サーバーid", g.id, "サーバーネーム", g.name))
     else:
         self.bot.cursor.execute("select * from users where id=?",
                                 (i["aid"], ))
         u = self.bot.cursor.fetchone()
         g = self.bot.get_guild(post["gid"])
         await ctx.send(embed=ut.getEmbed(
             "メッセージ内容", post['content'], self.bot.ec, "送信者id:", post['aid'],
             "送信者のプロファイルニックネーム", upf['gnick']))
Exemple #6
0
 async def globalpost(self, ctx, gmid: int):
     post = None
     self.bot.cursor.execute("select * from gchat_pinfo")
     dats = self.bot.cursor.fetchall()
     for i in dats:
         if gmid in ([j[1] for j in i["allids"]] + [i["id"]]):
             post = i
             break
     if post is None:
         await ctx.say("globalpost-notfound")
         return
     self.bot.cursor.execute("select * from users where id=?",
                             (ctx.author.id, ))
     upf = self.bot.cursor.fetchone()
     if upf["gmod"]:
         self.bot.cursor.execute("select * from users where id=?",
                                 (post["author_id"], ))
         apf = self.bot.cursor.fetchone()
         g = self.bot.get_guild(post["guild_id"])
         await ctx.send(embed=ut.getEmbed(
             f"オリジナルID:'{post['id']}'のメッセージ内容(配列[オリジナル(,編集後,…,最新のメッセージ)])",
             str(post['content']), self.bot.ec, "送信者id:",
             str(post['author_id']), "送信先",
             str([i[1] for i in post["allids"]]), "送信者のプロファイルニックネーム",
             apf['gnick'], "サーバーid", g.id, "サーバーネーム", g.name))
     else:
         self.bot.cursor.execute("select * from users where id=?",
                                 (post["author_id"], ))
         apf = self.bot.cursor.fetchone()
         g = self.bot.get_guild(post["guild_id"])
         await ctx.send(embed=ut.getEmbed(
             "メッセージ内容", post['content'][-1], self.bot.ec, "送信者id:",
             str(post['author_id']), "送信者のプロファイルニックネーム", apf['gnick']))
Exemple #7
0
 async def gban(self, ctx, uid: int, tof: bool, *, reason: str=None):
     self.bot.cursor.execute(
         "select * from users where id=?", (ctx.author.id,))
     upf = self.bot.cursor.fetchone()
     if "global_ban" in self.bot.features.get(ctx.author.id, []):
         try:
             u = await self.bot.fetch_user(uid)
         except discord.NotFound:
             await ctx.send("存在しないユーザーではないでしょうか?IDを見直してみてください。")
         if tof:
             self.bot.cursor.execute(
                 "select * from gban_dates where id=?", (uid,))
             gbaninfo = self.bot.cursor.fetchone()
             if not gbaninfo:
                 self.bot.cursor.execute(
                     "INSERT INTO gban_dates(id,reason,gban_by) VALUES(?,?,?)", (uid, reason or "なし", ctx.author.id))
                 await ctx.send(f"{u.name}のグローバルBANを設定しました。\n登録済みのサーバーでグローバルBANを開始します。")
                 self.bot.cursor.execute("select * from gban_settings")
                 gs = self.bot.cursor.fetchall()
                 for gstg in gs:
                     g = self.bot.get_guild(gstg["id"])
                     ch = g.get_channel(gstg["chid"])
                     by = ctx.author
                     if g:
                         try:
                             await g.ban(u, reason=f"思惟奈ちゃんグローバルBAN:{reason}(実行者:{by}({by.id}))")
                         except:
                             if ch:
                                 await ch.send(embed=ut.getEmbed("グローバルBANに基づく、BANの試行", f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nBANしようとしましたが、権限不足等の理由でBANできませんでした。\nグローバルBAN実行者:{by}({by.id})"))
                             else:
                                 await g.owner.send(embed=ut.getEmbed("グローバルBANに基づく、BANの試行", f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nBANしようとしましたが、権限不足等の理由でBANできませんでした。\nグローバルBAN実行者:{by}({by.id})"))
                         finally:
                             if ch:
                                 await ch.send(embed=ut.getEmbed("グローバルBANに基づく、BANの実行", f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nよって、このサーバーからBANを行いました。\nグローバルBAN実行者:{by}({by.id})"))
                             else:
                                 await g.owner.send(embed=ut.getEmbed("グローバルBANに基づく、BANの実行", f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nよって、このサーバーからBANを行いました。\nグローバルBAN実行者:{by}({by.id})"))
             else:
                 await ctx.send(f"{u.name}はすでに思惟奈ちゃんのグローバルbanされています。")
         else:
             self.bot.cursor.execute(
                 "select * from gban_dates where id=?", (uid,))
             gbaninfo = self.bot.cursor.fetchone()
             if gbaninfo:
                 self.bot.cursor.execute(
                     f"delete from gban_dates where id = ?", (uid,))
                 await ctx.send(f"{u.name}のグローバルBANを解除しました。")
             else:
                 await ctx.send(f"{u.name}は思惟奈ちゃんのグローバルbanされていません")
     else:
         await ctx.send("グローバルBANの実行には、グローバルBANが使用できる認証を受けたアカウントである必要があります。\n思惟奈ちゃん運営に報告する際は、`s-report [タイトル] [説明]`を使用してください。正確性などを確認し、認められた場合はグローバルBANが行われます。")
Exemple #8
0
 async def lrewardupd(self, ctx):
     async with ctx.channel.typing():
         self.bot.cursor.execute("select * from guilds where id=?",
                                 (ctx.guild.id, ))
         gs = self.bot.cursor.fetchone()
         rslt = {}
         for uk, uv in gs["levels"].items():
             u = ctx.guild.get_member(int(uk))
             for k, v in gs["reward"].items():
                 if int(k) <= uv["level"]:
                     try:
                         rl = ctx.message.guild.get_role(v)
                         await u.add_roles(rl)
                         if rslt[k]:
                             rslt[k].append(u.display_name)
                         else:
                             rslt[k] = [u.display_name]
                         await asyncio.sleep(0.2)
                     except:
                         pass
     await ctx.send(
         "完了しました。",
         embed=ut.getEmbed(
             "追加者一覧",
             f"```{','.join([f'レベル{k}:{v}'] for k,v in rslt.items())}```"))
Exemple #9
0
 async def get_ch_id(self, ctx, cnm: str):
     await ctx.send(embed=ut.getEmbed(
         "一致チャンネル",
         str([
             f"{i.name}({i.id})" for i in ctx.guild.channels
             if i.name == cnm
         ])))
 async def p_create(self, ctx):
     m = await ctx.send("> パネル発行の確認\nこのチャンネルにパネルを発行してもよろしいですか?")
     await m.add_reaction(self.e_check)
     try:
         r, u = await self.bot.wait_for("reaction_add",
                                        check=lambda r, u: r.message.id == m
                                        .id and u.id == ctx.author.id)
     except asyncio.TimeoutError:
         await m.edit(
             content="> パネルは発行されていません!\n時間内に応答がなかったため、作成はキャンセルされました。")
     else:
         if r.emoji == self.e_check:
             pd = {}
             pm = await ctx.send(embed=discord.Embed())
             await pm.edit(embed=ut.getEmbed(
                 "思惟奈ちゃん役職パネル", f"このパネルは{ctx.author.mention}によって作成されました。",
                 self.bot.ec,
                 f"内容の変更は`s-paneledit {pm.id} (絵文字と役職idをスペース区切りで繰り返す)`"))
             self.bot.cursor.execute(
                 "INSERT INTO role_panels(id,roles) VALUES(?,?)",
                 (pm.id, pd))
             await m.edit(
                 content=
                 f"> パネルを発行しました!\n パネルのIDは`{pm.id}`です。編集や削除時に使用します。(紛失時はパネルのメッセージIDを取り出してください。)"
             )
         else:
             await m.edit(content="> パネルは発行されていません!\n作成はキャンセルされました。")
Exemple #11
0
 async def get_ch_id(self, ctx, cnm: str):
     text = [
         f"{str(ch)} ({ch.id})" for ch in ctx.guild.channels
         if cnm in str(ch)
     ]
     t = "\n".join(text)
     await ctx.send(embed=ut.getEmbed("一致チャンネル", f"```{t}```"))
Exemple #12
0
 async def check_gban(self, ctx, uid: int):
     self.bot.cursor.execute("select * from gban_dates where id=?", (uid,))
     gbaninfo = self.bot.cursor.fetchone()
     if gbaninfo:
         u = await self.bot.fetch_user(uid)
         by = await self.bot.fetch_user(gbaninfo["gban_by"])
         await ctx.send(embed=ut.getEmbed(f"{u.name}のグローバルBANについて", "", self.bot.ec, "理由", gbaninfo["reason"], "実行者", f"{by}({by.id})"))
     else:
         await ctx.send("そのユーザーは思惟奈ちゃんのグローバルbanされていません")
Exemple #13
0
 async def userprefix(self,ctx,mode="view",ipf=""):
     if ipf=="@everyone" or ipf=="@here":
         await ctx.send("その文字列はprefixとして使えません。")
         return
     self.bot.cursor.execute("select * from users where id=?",(ctx.author.id,))
     upf = self.bot.cursor.fetchone()
     if mode=="view":
         await ctx.send(embed=ut.getEmbed("ユーザーのprefix",f'```{",".join(upf["prefix"])}```'))
     elif mode=="set":
         spf = upf["prefix"]+[ipf]
         self.bot.cursor.execute("UPDATE users SET prefix = ? WHERE id = ?", (spf,ctx.author.id))
         await ctx.send(ut.textto("upf-add",ctx.author).format(ipf))
     elif mode=="del":
         spf = upf["prefix"]
         spf.remove(ipf)
         self.bot.cursor.execute("UPDATE users SET prefix = ? WHERE id = ?", (spf,ctx.author.id))
         await ctx.send(f"prefixから{ipf}を削除しました。")
     else:
         await ctx.send(embed=ut.getEmbed("不適切なモード選択","`view`または`set`または`del`を指定してください。"))
Exemple #14
0
    async def a_01(self, ctx):
        if not ctx.user_lang() == "ja":
            await ctx.send(ctx._("cannot-run"))
            return

        await ctx.send(
            ctx.author.mention,
            embed=ut.getEmbed(
                "",
                f'あなたは「{random.choice(ctx.guild.members).display_name.replace(ctx.guild.me.display_name,"私").replace(ctx.author.display_name,"あなた自身")}」のこと、好きかな?'
            ))
Exemple #15
0
 async def gchinfo(self,ctx,name="main"):
     self.bot.cursor.execute("select * from globalchs where name = ?",(name,))
     chs = self.bot.cursor.fetchone()
     if chs:
         retchs = ""
         for ch in chs["ids"]:
             try:
                 retchs = f"{retchs}{self.bot.get_channel(ch).guild.name},{self.bot.get_channel(ch).name}\n"
             except:
                 retchs = f"{retchs}不明なサーバー,チャンネルID:{ch}\n"
         await ctx.send(embed=ut.getEmbed(f"グローバルチャンネル{name}の詳細",f"コネクトされたチャンネルとサーバー\n{retchs}",self.bot.ec))
     else:
         await ctx.send("そのグローバルチャンネルはありません。")
Exemple #16
0
 async def fishany(self, ctx):
     lt = ["🦑", "🦐", "🐙", "🦀", "🐡", "🐠", "🐟"
           ] + [i.id for i in ctx.guild.emojis]
     fs = random.choice(lt)
     if str(type(fs)) == "<class 'int'>":
         fs = str(self.bot.get_emoji(fs))
     gp = random.randint(1, 3)
     self.bot.cursor.execute("select * from users where id=?",
                             (ctx.author.id, ))
     upf = self.bot.cursor.fetchone()
     self.bot.cursor.execute("UPDATE users SET gpoint = ? WHERE id = ?",
                             (upf["gpoint"] + gp, ctx.author.id))
     await ctx.send(embed=ut.getEmbed("fish", ctx._("fish-get", fs, gp)))
Exemple #17
0
 async def on_member_join(self, m):
     self.bot.cursor.execute(
         "select * from welcome_auth where id = ?", (m.guild.id,))
     auths = self.bot.cursor.fetchone()
     if auths:
         if bool(auths["use"]) and not(m.bot):
             if type(auths["next_reaction"]) is int:
                 nr = self.bot.get_emoji(auths["next_reaction"])
             else:
                 nr = auths["next_reaction"]
             ow = {
                 m: discord.PermissionOverwrite(read_messages=True, send_messages=True),
                 m.guild.default_role: discord.PermissionOverwrite(read_messages=False),
                 m.guild.me: discord.PermissionOverwrite(
                     read_messages=True, send_messages=True, manage_messages=True)
             }
             for i in auths["can_view"]:
                 rl = m.guild.get_role(i)
                 if rl:
                     ow[rl] = discord.PermissionOverwrite(
                         read_messages=True)
             cg = m.guild.get_channel(auths["category"])
             if cg:
                 ch = await cg.create_text_channel(f"sinaauth-{m.name}", overwrites=ow, topic=str(m.id), position=0)
             else:
                 ch = await m.guild.create_text_channel(f"sinaauth-{m.name}", overwrites=ow, topic=str(m.id), position=0)
             msg = await ch.send("please wait...\nしばらくお待ちください…")
             for i in auths["au_w"]:
                 await msg.edit(content=None, embed=ut.getEmbed(f"サーバーユーザー認証", f"※{nr}で進行します。\n{i['text']}"))
                 for r in i["reactions"]:
                     if type(r) is int:
                         rct = self.bot.get_emoji(r)
                     else:
                         rct = r
                     await msg.add_reaction(rct)
                 await msg.add_reaction(nr)
                 r, u = await self.bot.wait_for("reaction_add", check=lambda r, u: r.message.id == msg.id and u.id == m.id and r.emoji == auths["next_reaction"])
                 ridx = [i["reactions"].index(
                     r.emoji) for r in r.message.reactions if r.count == 2 and r.emoji != nr]
                 for ri in ridx:
                     grl = m.guild.get_role(i["give_role"][ri])
                     if grl:
                         await m.add_roles(grl)
                 await msg.clear_reactions()
             await m.add_roles(m.guild.get_role(auths["give_role"]))
             await ch.send("> サーバーユーザー認証\n あなたの認証が完了しました!")
Exemple #18
0
 async def gchinfo(self, ctx, name="main"):
     self.bot.cursor.execute("select * from gchat_clist where name = ?",
                             (name, ))
     gch = self.bot.cursor.fetchone()
     if gch:
         self.bot.cursor.execute(
             "select * from gchat_cinfo where connected_to = ?", (name, ))
         chs = self.bot.cursor.fetchall()
         retchs = ""
         for ch in chs:
             try:
                 retchs = f"{retchs}{self.bot.get_channel(ch['id']).guild.name} -> {self.bot.get_channel(ch['id']).name}\n"
             except:
                 retchs = f"{retchs}不明なサーバー -> チャンネルID:{ch['id']}\n"
         await ctx.send(
             embed=ut.getEmbed(f"グローバルチャンネル {name} の詳細",
                               f"コネクトされたサーバーとチャンネル\n{retchs}", self.bot.ec))
     else:
         await ctx.send("そのグローバルチャンネルはありません。")
Exemple #19
0
 async def chtrans(self, ctx, gid: int):
     try:
         g = self.bot.get_guild(gid)
         if ctx.author.permissions_in(
                 ctx.channel
         ).administrator == True or ctx.author.id == 404243934210949120:
             async with ctx.channel.typing():
                 #すること
                 for mct, mch in g.by_category():
                     await asyncio.sleep(2)
                     try:
                         ct = await ctx.guild.create_category_channel(
                             name=mct.name)
                     except AttributeError:
                         ct = None
                     for c in mch:
                         await asyncio.sleep(2)
                         if isinstance(c, discord.TextChannel):
                             await ctx.guild.create_text_channel(
                                 name=c.name,
                                 category=ct,
                                 topic=c.topic,
                                 slowmode_delay=c.slowmode_delay,
                                 nsfw=c.is_nsfw())
                         elif isinstance(c, discord.VoiceChannel):
                             await ctx.guild.create_voice_channel(
                                 name=c.name,
                                 category=ct,
                                 bitrate=c.bitrate,
                                 user_limit=c.user_limit)
                         else:
                             pass
             await ctx.send("完了しました。")
         else:
             await ctx.send(ut.textto("need-admin", ctx.author))
     except:
         await ctx.send(embed=ut.getEmbed(
             ut.textto("ginfo-anyerror-title", ctx.author),
             ut.textto("ginfo-anyerror-title", ctx.author).format(
                 traceback.format_exc(0))))
Exemple #20
0
 async def roletrans(self, ctx, gid: int):
     try:
         g = self.bot.get_guild(gid)
         if ctx.author.permissions_in(
                 ctx.channel
         ).administrator is True or ctx.author.id == 404243934210949120:
             async with ctx.channel.typing():
                 for r in g.roles[1:][::-1]:
                     await ctx.guild.create_role(
                         name=r.name,
                         permissions=r.permissions,
                         colour=r.colour,
                         hoist=r.hoist,
                         mentionable=r.mentionable,
                         reason=f"{g.name}より。役職転送コマンド実行による。")
                     await asyncio.sleep(2)
             await ctx.send("完了しました。")
         else:
             await ctx.send("このサーバーの管理者である必要があります。")
     except:
         await ctx.send(
             embed=ut.getEmbed("エラー", f"詳細:```{traceback.format_exc(0)}```")
         )
Exemple #21
0
    async def wid(self, ctx, inid):
        if not ut.textto("language", ctx.author) == "ja":
            await ctx.send(ut.textto("cannot-run", ctx.author))
            return

        async with ctx.message.channel.typing():
            st = time.time()
            try:
                id = int(inid)
            except:
                id = None
            idis = self.bot.get_channel(id)
            if idis:
                if isinstance(idis, discord.DMChannel):
                    await ctx.send(
                        embed=ut.getEmbed("DMチャンネル", f"相手:{idis.recipient}"))
                elif isinstance(idis, discord.GroupChannel):
                    await ctx.send(embed=ut.getEmbed(
                        "グループDMチャンネル",
                        f"メンバー:{','.join(idis.recipients)},\n名前:{idis.name},"))
                elif isinstance(idis, discord.abc.GuildChannel):
                    await ctx.send(embed=ut.getEmbed(
                        "サーバーチャンネル", f"名前:{idis.name}\nサーバー:{idis.guild}"))
                else:
                    await ctx.send(embed=ut.getEmbed("その他チャンネル"))
                return
            idis = self.bot.get_guild(id)
            if idis:
                if idis.id in [i[0] for i in self.bot.partnerg]:
                    ptn = "🔗パートナーサーバー"
                else:
                    ptn = ""
                await ctx.send(embed=ut.getEmbed(
                    "サーバー", f"{ptn}\n名前:{idis.name}\nid:{idis.id}"))
                return
            try:
                idis = await self.bot.fetch_user(id)
                u = idis
                e = discord.Embed(title="ユーザー", color=self.bot.ec)
                e.add_field(name="名前", value=u.name)
                e.add_field(name="id", value=u.id)
                e.add_field(name="ディスクリミネータ", value=u.discriminator)
                e.add_field(name="botかどうか", value=u.bot)
                e.set_thumbnail(url=u.avatar_url)
                e.set_footer(text=f"アカウント作成日時(そのままの値:{u.created_at},タイムスタンプ化:")
                e.timestamp = u.created_at
                await ctx.send(embed=e)
                return
            except:
                pass
            idis = self.bot.get_emoji(id)
            if idis:
                await ctx.send(
                    embed=ut.getEmbed("絵文字", f"名前:{str(idis)}\nid:{idis.id}"))
                return
            try:
                idis = await self.bot.fetch_invite(inid)
                await ctx.send(embed=ut.getEmbed(
                    "サーバー招待",
                    f"名前:{str(idis.guild.name)}\nチャンネル:{idis.channel.name}\nmember_count:{idis.approximate_member_count}\npresence_count:{idis.approximate_presence_count}\n[参加]({idis.url})"
                ))
                return
            except:
                pass
            try:
                idis = await self.bot.fetch_webhook(id)
                await ctx.send(embed=ut.getEmbed(
                    "webhook", f"デフォルトネーム:{idis.name}\nサーバーid:{idis.guild_id}")
                               )
                return
            except:
                pass
            try:
                idis = await self.bot.fetch_widget(inid)
                await ctx.send(embed=ut.getEmbed(
                    "サーバーウィジェット", f"名前:{idis.name}\n招待:{idis.invite_url}"))
                return
            except:
                pass
            try:
                for g in self.bot.guilds:
                    for ch in g.text_channels:
                        try:
                            idis = await ch.fetch_message(id)
                            await ctx.send(embed=ut.getEmbed(
                                "メッセージ",
                                f"送信者:{idis.author}\n内容:{idis.content}"))
                            return
                        except:
                            pass
                        finally:
                            await asyncio.sleep(0.5)
            except:
                pass
            await ctx.send(embed=ut.getEmbed("そのidでは見つかりませんでした。", ""))
Exemple #22
0
    async def textlocker(self, ctx):
        if not ctx.user_lang() == "ja":
            await ctx.send(ctx._("cannot-run"))
            return

        tl = self.bot.tl
        dc = await ut.opendm(ctx.author)
        askmd = await dc.send(
            embed=ut.getEmbed("テキスト暗号・複合", "暗号化する場合は🔒を、復号する場合は🔓を押してください。"))
        await askmd.add_reaction('🔒')
        await askmd.add_reaction('🔓')
        try:
            r, u = await self.bot.wait_for(
                "reaction_add",
                check=lambda r, u: str(r.emoji) in ["🔒", "🔓"] and r.message.id
                == askmd.id and u.bot == False,
                timeout=60)
        except asyncio.TimeoutError:
            await ctx.send("タイムアウトしました。初めからやり直してください。")
            return
        if str(r.emoji) == "🔒":
            setting = {}
            rtxt = await ut.wait_message_return(ctx, "暗号化する文を送ってください。", dc)
            setting["text"] = rtxt.content.lower()
            rtxt = await ut.wait_message_return(ctx, "始めのずらしを送ってください。", dc)
            setting["zs"] = int(rtxt.content)
            rtxt = await ut.wait_message_return(ctx, "パターンを変えるまでの数を送ってください。",
                                                dc)
            setting["cp"] = int(rtxt.content)
            rtxt = await ut.wait_message_return(ctx, "変えるときのずらす数を送ってください。", dc)
            setting["cpt"] = int(rtxt.content)
            rtext = ""
            tcount = 0
            zcount = 0
            uzs = setting["zs"]
            while tcount <= len(setting["text"]) - 1:
                zcount = zcount + 1
                ztmp = tl.find(setting["text"][tcount])
                if not ztmp == -1:
                    if ztmp + uzs >= len(tl):
                        rtext = f"{rtext}{tl[ztmp+uzs-len(tl)]}"
                    else:
                        rtext = f"{rtext}{tl[ztmp+uzs]}"
                    if zcount == setting["cp"]:
                        uzs = uzs + setting["cpt"]
                        zcount = 0
                else:
                    rtext = f"{rtext}☒"
                tcount = tcount + 1
            await dc.send(f"`{rtext}`になりました。")
        elif str(r.emoji) == "🔓":
            setting = {}
            rtxt = await ut.wait_message_return(ctx, "復号する文を送ってください。", dc)
            setting["text"] = rtxt.content
            rtxt = await ut.wait_message_return(ctx, "始めのずらしを送ってください。", dc)
            setting["zs"] = int(rtxt.content)
            rtxt = await ut.wait_message_return(ctx, "パターンを変えるまでの数を送ってください。",
                                                dc)
            setting["cp"] = int(rtxt.content)
            rtxt = await ut.wait_message_return(ctx, "変えるときのずらす数を送ってください。", dc)
            setting["cpt"] = int(rtxt.content)
            rtext = ""
            tcount = 0
            zcount = 0
            uzs = setting["zs"]
            while tcount <= len(setting["text"]) - 1:
                zcount = zcount + 1
                ztmp = tl.find(setting["text"][tcount])
                if not ztmp == -1:
                    if ztmp + uzs < 0:
                        rtext = f"{rtext}{tl[ztmp-uzs+len(tl)]}"
                    else:
                        rtext = f"{rtext}{tl[ztmp-uzs]}"
                    if zcount == setting["cp"]:
                        uzs = uzs + setting["cpt"]
                        zcount = 0
                else:
                    rtext = f"{rtext}☒"
                tcount = tcount + 1
            await dc.send(f"`{rtext}`になりました。")
        else:
            await ctx.send("絵文字が違います。")
Exemple #23
0
 async def view_teammember(self,ctx):
     await ctx.send(embed=ut.getEmbed(ut.textto("team_sina-chan",ctx.author),"\n".join([self.bot.get_user(i).name for i in self.bot.team_sina])))
Exemple #24
0
 async def vcurl(self,ctx,vch:commands.VoiceChannelConverter=None):
     if vch is None and (not ctx.author.voice == None):
         ch = ctx.author.voice.channel
     else:
         ch = vch
     await ctx.send(embed=ut.getEmbed(ch.name,f"https://discordapp.com/channels/{ctx.guild.id}/{ch.id}"))
Exemple #25
0
    async def gban(self, ctx, uid: int, tof: bool, *, reason: str = None):
        if "global_ban" in self.bot.features.get(ctx.author.id, []):
            try:
                u = await self.bot.fetch_user(uid)
            except discord.NotFound:
                await ctx.send("存在しないユーザーではないでしょうか?IDを見直してみてください。")
                return

            m = await ctx.send(
                f"> ❔確認\n {u}({u.id})のグローバルBAN状態を{tof}で上書きしてもよろしいですか?")
            await m.add_reaction(self.check)
            await m.add_reaction("❌")
            r, us = await self.bot.wait_for("reaction_add",
                                            check=lambda r, u: r.message.id ==
                                            m.id and u.id == ctx.author.id)
            if (not str(r.emoji) == str(self.check)):
                await m.edit(content="> グローバルBANはキャンセルされました。")
                return

            if tof:
                self.bot.cursor.execute("select * from gban_dates where id=?",
                                        (uid, ))
                gbaninfo = self.bot.cursor.fetchone()
                if not gbaninfo:
                    self.bot.cursor.execute(
                        "INSERT INTO gban_dates(id,reason,gban_by) VALUES(?,?,?)",
                        (uid, reason or "なし", ctx.author.id))
                    await ctx.send(
                        f"{u.name}のグローバルBANを設定しました。\n登録済みのサーバーでグローバルBANを開始します。"
                    )
                    self.bot.cursor.execute("select * from gban_settings")
                    gs = self.bot.cursor.fetchall()
                    for gstg in gs:
                        g = self.bot.get_guild(gstg["id"])
                        if g is None:
                            continue
                        ch = g.get_channel(gstg["chid"])
                        if ch is None:
                            continue
                        by = ctx.author
                        if g:
                            try:
                                await g.ban(
                                    u,
                                    reason=
                                    f"思惟奈ちゃんグローバルBAN:{reason}(実行者:{by}({by.id}))"
                                )
                            except:
                                if ch:
                                    await ch.send(embed=ut.getEmbed(
                                        "グローバルBANに基づく、BANの試行",
                                        f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nBANしようとしましたが、権限不足等の理由でBANできませんでした。\nグローバルBAN実行者:{by}({by.id})"
                                    ))
                                else:
                                    await g.owner.send(embed=ut.getEmbed(
                                        "グローバルBANに基づく、BANの試行",
                                        f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nBANしようとしましたが、権限不足等の理由でBANできませんでした。\nグローバルBAN実行者:{by}({by.id})"
                                    ))
                            else:
                                if ch:
                                    await ch.send(embed=ut.getEmbed(
                                        "グローバルBANに基づく、BANの実行",
                                        f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nよって、このサーバーからBANを行いました。\nグローバルBAN実行者:{by}({by.id})"
                                    ))
                                else:
                                    await g.owner.send(embed=ut.getEmbed(
                                        "グローバルBANに基づく、BANの実行",
                                        f"{u}({u.id})は、`{reason}`として思惟奈ちゃんのグローバルBANを受けています。\nよって、このサーバーからBANを行いました。\nグローバルBAN実行者:{by}({by.id})"
                                    ))
                    await ctx.send("該当ユーザーのグローバルBANが完了しました。")
                else:
                    await ctx.send(f"{u.name}はすでに思惟奈ちゃんのグローバルbanされています。")
            else:
                self.bot.cursor.execute("select * from gban_dates where id=?",
                                        (uid, ))
                gbaninfo = self.bot.cursor.fetchone()
                if gbaninfo:
                    self.bot.cursor.execute(
                        f"delete from gban_dates where id = ?", (uid, ))
                    await ctx.send(f"{u.name}のグローバルBANを解除しました。")
                else:
                    await ctx.send(f"{u.name}は思惟奈ちゃんのグローバルbanされていません")
        else:
            await ctx.send(
                "グローバルBANの実行には、グローバルBANが使用できる認証を受けたアカウントである必要があります。\n思惟奈ちゃん運営に報告する際は、`s-report`コマンドを使用してください。正確性などを確認し、認められた場合はグローバルBANが行われます。"
            )
Exemple #26
0
 async def chlogs(self, ctx, cid: int, count: int):
     ch = self.bot.get_channel(cid)
     async for m in ch.history(limit=count):
         await ctx.author.send(embed=ut.getEmbed(
             "メッセージ", m.clean_content, self.bot.ec, "送信者", str(m.author)))
         await asyncio.sleep(2)
    async def _setting(self, ctx):
        self.bot.cursor.execute("select * from welcome_auth where id = ?",
                                (ctx.guild.id, ))
        auths = self.bot.cursor.fetchone()
        if auths:
            use = bool(auths["use"])
        else:
            use = False
        e = discord.Embed(title="認証ウィザードの設定",
                          description="""
        ✏で設定を行います。
        🔄で利用設定を切り替えます。
        ❌で表示を消します。""",
                          color=self.bot.ec)
        e.set_footer(text="create by mii-10")
        if use:
            e.add_field(name="利用状況", value="使用する", inline=False)
            roles = "\n".join(
                [str(ctx.guild.get_role(i)) for i in auths["can_view"]])
            e.add_field(name="認証を閲覧できる役職", value=roles, inline=False)
            if auths["category"]:
                category = self.bot.get_channel(auths["category"])
                e.add_field(name="作成されるカテゴリー",
                            value=f"{category.name}({category.id})",
                            inline=False)
            else:
                catagory = None
                e.add_field(name="作成されるカテゴリー",
                            value=f"カテゴリーに所属しない",
                            inline=False)
            if isinstance(auths["next_reaction"], str):
                nr = auths["next_reaction"]
            elif isinstance(auths["next_reaction"], int):
                nr = self.bot.get_emoji(auths["next_reaction"])
            e.add_field(name="次に進むリアクション", value=nr, inline=False)
            auth_w = auths["au_w"]
            e.add_field(name="現在の認証の長さ", value=len(auth_w), inline=False)
            grole = ctx.guild.get_role(auths["give_role"])
            e.add_field(name="与える役職", value=str(grole), inline=False)
        else:
            e.add_field(name="利用状況", value="使用しない", inline=False)
        m = await ctx.send(embed=e)
        await m.add_reaction("✏")
        await m.add_reaction("🔄")
        await m.add_reaction("❌")
        try:
            r, u = await self.bot.wait_for(
                "reaction_add",
                check=lambda r, u: r.message.id == m.id and u.id == ctx.author.
                id and r.emoji in ["✏", "🔄", "❌"])
        except asyncio.TimeoutError:
            await m.delete()
            await ctx.send(
                "一定時間リアクションがなかったため、パネルを削除しました。設定する際は再度コマンド実行をお願いします。")
            return
        if r.emoji == "✏":
            await m.clear_reactions()
            await ctx.send("設定を開始します。DMに移動してください。")
            if auths:  # 設定がある場合の処理を行います メモ:保存処理をちゃんと書くこと!
                udm = await ut.opendm(ctx.author)
                msg = await udm.send("""> 既に設定があります。何を変更しますか?
                ▶:次へ進む共通の絵文字
                🎫:作成するカテゴリー
                📖:ウィザードの内容
                🔍:閲覧できる役職の変更
                🎖:与える役職
                """)
                await msg.add_reaction("▶")
                await msg.add_reaction("🎫")
                await msg.add_reaction("📖")
                await msg.add_reaction("🔍")
                await msg.add_reaction("🎖")
                r, u = await self.bot.wait_for(
                    "reaction_add",
                    check=lambda r, u: r.message.id == msg.id and u.id == ctx.
                    author.id and r.emoji in "▶🎫📖🔍🎖")
                if r.emoji == "🎖":
                    m = await ut.wait_message_return(ctx,
                                                     "認証後、与える役職のIDを送信してください。",
                                                     udm, 60)
                    grole = int(m.content)
                    self.bot.cursor.execute(
                        "UPDATE welcome_auth SET give_role = ? WHERE id = ?",
                        (grole, ctx.guild.id))
                    await udm.send("変更が完了しました。")
                elif r.emoji == "▶":
                    m = await ut.wait_message_return(
                        ctx,
                        "作成するウィザードの進行絵文字を送ってください。\nサーバー絵文字の場合は、IDを送信してください。",
                        udm, 60)
                    try:
                        nr = int(m.content)
                    except:
                        nr = m.content
                    self.bot.cursor.execute(
                        "UPDATE welcome_auth SET next_reaction = ? WHERE id = ?",
                        (nr, ctx.guild.id))
                    await udm.send("変更が完了しました。")
                elif r.emoji == "🎫":
                    m = await ut.wait_message_return(
                        ctx,
                        "チャンネルを作成するカテゴリーのIDを送信してください。\nカテゴリーを作らない場合は、任意のテキストを送信してください。",
                        udm, 60)
                    try:
                        category = int(m.content)
                    except:
                        category = None
                    self.bot.cursor.execute(
                        "UPDATE welcome_auth SET category = ? WHERE id = ?",
                        (category, ctx.guild.id))
                    await udm.send("変更が完了しました。")
                elif r.emoji == "📖":
                    seted = False
                    auth_w = []
                    while not seted:
                        msg = await udm.send(
                            "> 編集ウィザード\n注意:ページ情報は新しいものに置き換えられます。\n✏:次のページを作成\n✅:終了する"
                        )
                        await msg.add_reaction("✏")
                        await msg.add_reaction("✅")
                        r, u = await self.bot.wait_for(
                            "reaction_add",
                            check=lambda r, u: r.message.id == msg.id and u.id
                            == ctx.author.id and r.emoji in ["✏", "✅"])
                        if r.emoji == "✅":
                            if len(auth_w) == 0:
                                await udm.send(
                                    "> 作成はまだ続いています!\nウィザードは、必ず1ページは作成する必要があります!"
                                )
                            else:
                                seted = True
                        elif r.emoji == "✏":
                            tmp = {}
                            msg = await udm.send(
                                f"> 編集ウィザード\nこのメッセージに使いたいリアクションをした後、最後に{nr}を押してください。"
                            )
                            await msg.add_reaction(nr)
                            r, u = await self.bot.wait_for(
                                "reaction_add",
                                check=lambda r, u: r.message.id == msg.id and u
                                .id == ctx.author.id and r.emoji == nr)
                            tmp["reactions"] = [
                                str(r.emoji) for r in r.message.reactions
                                if not r.emoji == nr
                            ]
                            tmp["give_role"] = []
                            for r in tmp["reactions"]:
                                ridm = await ut.wait_message_return(
                                    ctx,
                                    f"> 編集ウィザード\n{r}で役職を付与する場合は役職のIDを、しない場合は数字ではない任意のテキストを送信してください。",
                                    udm, 60)
                                try:
                                    rid = int(ridm.content)
                                except:
                                    rid = None
                                tmp["give_role"].append(rid)
                            tmsg = await ut.wait_message_return(
                                ctx, f"> 編集ウィザード\n最後に、そのページのテキストを送信してください。",
                                udm, 60)
                            tmp["text"] = tmsg.content
                            auth_w.append(tmp)
                    self.bot.cursor.execute(
                        "UPDATE welcome_auth SET au_w = ? WHERE id = ?",
                        (auth_w, ctx.guild.id))
                    await udm.send("変更が完了しました。")
                elif r.emoji == "🔍":
                    tmsg = await ut.wait_message_return(
                        ctx,
                        f"> 編集ウィザード\nそのチャンネルを閲覧できる役職のIDをスペース区切りで送信してください。",
                        udm, 60)
                    cv = [int(i) for i in tmsg.content.split(" ")]
                    self.bot.cursor.execute(
                        "UPDATE welcome_auth SET can_view = ? WHERE id = ?",
                        (cv, ctx.guild.id))
                    await udm.send("変更が完了しました。")
            else:  # 設定が存在しない場合、初期設定を行います。
                udm = await ut.opendm(ctx.author)
                try:
                    m = await ut.wait_message_return(
                        ctx,
                        "作成するウィザードの進行絵文字を送ってください。\nサーバー絵文字の場合は、IDを送信してください。",
                        udm, 60)
                    try:
                        nr = int(m.content)
                    except:
                        nr = m.content

                    # カテゴリ→ウィザードの内容で設定を作る

                    tmsg = await ut.wait_message_return(
                        ctx,
                        f"> 作成ウィザード\nそのチャンネルを閲覧できる役職のIDをスペース区切りで送信してください。",
                        udm, 60)
                    cv = [int(i) for i in tmsg.content.split(" ")]

                    m = await ut.wait_message_return(
                        ctx,
                        "チャンネルを作成するカテゴリーのIDを送信してください。\nカテゴリーを作らない場合は、任意のテキストを送信してください。",
                        udm, 60)
                    try:
                        category = int(m.content)
                    except:
                        category = None

                    m = await ut.wait_message_return(ctx,
                                                     "認証後、与える役職のIDを送信してください。",
                                                     udm, 60)
                    grole = int(m.content)
                    seted = False
                    auth_w = []
                    while not seted:
                        msg = await udm.send("> ウィザードの作成\n✏:次のページを作成\n✅:終了する")
                        await msg.add_reaction("✏")
                        await msg.add_reaction("✅")
                        r, u = await self.bot.wait_for(
                            "reaction_add",
                            check=lambda r, u: r.message.id == msg.id and u.id
                            == ctx.author.id and r.emoji in ["✏", "✅"])
                        if r.emoji == "✅":
                            if len(auth_w) == 0:
                                await udm.send(
                                    "> 作成はまだ続いています!\nウィザードは、必ず1ページは作成する必要があります!"
                                )
                            else:
                                seted = True
                        elif r.emoji == "✏":
                            tmp = {}
                            msg = await udm.send(
                                f"> 作成ウィザード\nこのメッセージに使いたいリアクションをした後、最後に{nr}を押してください。"
                            )
                            await msg.add_reaction(nr)
                            r, u = await self.bot.wait_for(
                                "reaction_add",
                                check=lambda r, u: r.message.id == msg.id and u
                                .id == ctx.author.id and r.emoji == nr)
                            tmp["reactions"] = [
                                str(r.emoji) for r in r.message.reactions
                                if not r.emoji == nr
                            ]
                            tmp["give_role"] = []
                            for r in tmp["reactions"]:
                                ridm = await ut.wait_message_return(
                                    ctx,
                                    f"> 作成ウィザード\n{r}で役職を付与する場合は役職のIDを、しない場合は数字ではない任意のテキストを送信してください。",
                                    udm, 60)
                                try:
                                    rid = int(ridm.content)
                                except:
                                    rid = None
                                tmp["give_role"].append(rid)
                            tmsg = await ut.wait_message_return(
                                ctx, f"> 作成ウィザード\n最後に、そのページのテキストを送信してください。",
                                udm, 60)
                            tmp["text"] = tmsg.content
                            auth_w.append(tmp)
                    self.bot.cursor.execute(
                        "insert into welcome_auth (id,category,use,can_view,next_reaction,au_w,give_role) values(?,?,?,?,?,?,?)",
                        (ctx.guild.id, category, 1, cv, nr, auth_w, grole))
                    await udm.send(
                        "> 作成ウィザード\n作成が完了しました!設定の確認や変更は、再度`s-Authsetting`コマンドで行えます。"
                    )
                except asyncio.TimeoutError:
                    await udm.send("タイムアウトしました。再度設定をするには、初めからやり直してください。")
        elif r.emoji == "🔄":
            if auths:
                await m.clear_reactions()
                if use:
                    self.bot.cursor.execute(
                        "UPDATE welcome_auth SET use = ? WHERE id = ?",
                        (0, ctx.guild.id))
                else:
                    self.bot.cursor.execute(
                        "UPDATE welcome_auth SET use = ? WHERE id = ?",
                        (1, ctx.guild.id))
                await m.edit(
                    embed=ut.getEmbed("認識ウィザード", f"利用設定を{not use}に切り替えました。"))
            else:
                await m.edit(
                    embed=ut.getEmbed("認識ウィザード", f"初めに✏絵文字から利用設定を行ってください。"))
        elif r.emoji == "❌":
            await m.delete()
Exemple #28
0
    async def backup(self,ctx,gid:int):
        if not ctx.guild.me.guild_permissions.administrator:
            await ctx.send("このサーバーで、わたしが管理者権限を持ってないので使用できません。")
            return
        try:
            g = self.bot.get_guild(gid)
            if ctx.author.permissions_in(ctx.channel).administrator == True or ctx.author.id == 404243934210949120:
                pgs=await ctx.send(f"役職\n進行度:0/{len(g.roles)}")
                tk=0
                rlid={}
                async with ctx.channel.typing():
                    #役職。rlid(dict)に旧id(str)で参照すれば新idが返ってくる
                    for r in g.roles[1:][::-1]:
                        rl=await ctx.guild.create_role(name=r.name,permissions=r.permissions,colour=r.colour,hoist=r.hoist,mentionable=r.mentionable,reason=f"{g.name}より。役職転送コマンド実行による。")
                        await asyncio.sleep(2)
                        rlid[str(r.id)]=rl.id
                        tk=tk+1
                        await pgs.edit(content=f"役職\n進行度:{tk}/{len(g.roles)}")
                    await ctx.guild.default_role.edit(permissions=g.default_role.permissions)
                    rlid[str(g.default_role.id)]=ctx.guild.default_role.id
                    await pgs.edit(content=f"チャンネル\n進行度:0/{len(g.channels)}")
                    tk=0
                    #チャンネル。
                    chlt={}
                    for mct,mch in g.by_category():
                        await asyncio.sleep(2)
                        try:
                            ovwt={}
                            await asyncio.sleep(2)
                            for k,v in mct.overwrites.items():
                                try:
                                    rl=ctx.guild.get_role(rlid[str(k.id)])
                                    ovwt[rl]=v
                                except:
                                    pass
                            ct = await ctx.guild.create_category_channel(name=mct.name,overwrites=ovwt)
                            chlt[str(mct.id)]=ct.id
                            tk=tk+1
                            await pgs.edit(content=f"チャンネル\n進行度:{tk}/{len(g.channels)}")
                        except AttributeError:
                            ct = None
                        for c in mch:
                            ovwt={}
                            await asyncio.sleep(2)
                            for k,v in c.overwrites.items():
                                try:
                                    rl=ctx.guild.get_role(rlid[k])
                                    ovwt[rl]=v
                                except:
                                    pass
                            if isinstance(c,discord.TextChannel):
                                cch=await ctx.guild.create_text_channel(name=c.name,category=ct,topic=c.topic,slowmode_delay=c.slowmode_delay,nsfw=c.is_nsfw(),overwrites=ovwt)
                            elif isinstance(c,discord.VoiceChannel):
                                if ctx.guild.bitrate_limit >= c.bitrate:
                                    cch=await ctx.guild.create_voice_channel(name=c.name,category=ct,bitrate=c.bitrate,user_limit=c.user_limit,overwrites=ovwt)
                                else:
                                    cch=await ctx.guild.create_voice_channel(name=c.name,category=ct,bitrate=ctx.guild.bitrate_limit,user_limit=c.user_limit,overwrites=ovwt)
                            else:
                                pass
                            try:
                                chlt[str(c.id)]=cch.id
                                tk=tk+1
                                await pgs.edit(content=f"チャンネル\n進行度:{tk}/{len(g.channels)}")
                            except:
                                pass
                    await pgs.edit(content="チャンネル完了\nnext:絵文字")
                    #絵文字
                    tk=0
                    for e in g.emojis:
                        if len(ctx.guild.emojis)>=ctx.guild.emoji_limit:
                            break
                        print("looping")
                        try:
                            ei = await e.url.read()
                            await ctx.guild.create_custom_emoji(name=e.name,image=ei)
                            await asyncio.sleep(5)
                            print("done")
                        except:
                            await ctx.send(f"```{traceback.format_exc(3)}```")
                    await pgs.edit(content="絵文字完了\nnext:ユーザーのban状況")
                    #ユーザーのban
                    bm = await g.bans()
                    tk=0
                    for i in bm:
                        await g.ban(user=i.user,reason=i.reason)
                        await asyncio.sleep(2)
                        tk=tk+1
                        await pgs.edit(content=f"ban状況確認\n進行度:{tk}/{len(bm)}")

                    await pgs.edit(content="ban状況完了\nnext:サーバー設定")
                    #サーバー設定
                    icn = await g.icon_url_as(static_format="png").read()
                    await ctx.guild.edit(name=g.name,icon=icn,region=g.region,verification_level=g.verification_level,default_notifications=g.default_notifications,explicit_content_filter=g.explicit_content_filter)
                    #afk
                    if g.afk_channel:
                        await ctx.guild.edit(afk_channel=ctx.guild.get_channel(chlt[str(g.afk_channel.id)]),afk_timeout=g.afk_timeout)
                    #システムチャンネル
                    if g.system_channel:
                        await ctx.guild.edit(system_channel=ctx.guild.get_channel(chlt[str(g.system_channel.id)]),system_channel_flags=g.system_channel_flags)
                    #サーバー招待スプラッシュ
                    if str(g.splash_url) and ("INVITE_SPLASH" in ctx.guild.features):
                        sp = await g.splash_url.read()
                        await ctx.guild.edit(splash=sp)
                    #サーバーバナー
                    if str(g.banner_url) and ("BANNER" in ctx.guild.features):
                        bn = await g.banner_url.read()
                        await ctx.guild.edit(banner=bn)
                    await ctx.send("完了しました。")
            else:
                await ctx.send("このサーバーの管理者である必要があります。")
        except:
            await ctx.send(embed=ut.getEmbed("エラー",f"詳細:```{traceback.format_exc(0)}```"))
Exemple #29
0
 async def on_slash_command_error(self, ctx:SlashContext, error):
         ch = self.bot.get_channel(652127085598474242)
         await ch.send(embed=ut.getEmbed("エラーログ", f"コマンド:`{ctx.command}`\n```{str(error)}```", self.bot.ec, f"サーバー", ctx.guild.name, "実行メンバー", ctx.author.name))
Exemple #30
0
 async def getby(self, ctx, k: str):
     await ctx.send(embed=ut.getEmbed("", ut.textto(k, ctx.author)))