Skip to content

Instantly share code, notes, and snippets.

@DuckMasterAl
Created September 18, 2020 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DuckMasterAl/1e5477b95b19c8575e4eb2d136dcfcc0 to your computer and use it in GitHub Desktop.
Save DuckMasterAl/1e5477b95b19c8575e4eb2d136dcfcc0 to your computer and use it in GitHub Desktop.
[Turkish Edition] How to Use Allowed Mentions (I stole this from @TheMoksej)

Bahsetmeleri temizlemeye mi çalışıyorsunuz? İşte kullanmanız gereken birkaç örnek. Not: Kitaplık örneğinize baktığınızdan ve gerekli kitaplık sürümünün veya daha üstünün yüklü olduğundan emin olun, aksi takdirde çalışmaz.

Discord.py (v1.4.0 veya üstü gerektirir) Birden çok seçenek var:

  1. komutunuzun çıktısından sonra , allow_mentions = discord.AllowedMentions (roles = False, Everyone = False) ekleyin. (yalnızca bireysel mesajlar için çalışır)
  2. istemciye koyun (bunu yaparsanız, botunuzun gönderdiği tüm mesajlar varsayılan olarak kimseye ping atmaz) ╠ ** Örnek 1 ** Alt sınıfa sahipseniz:
class Bot(commands.AutoShardedBot):
    def __init__(self, **kwargs):
        super().__init__(
            allowed_mentions = discord.AllowedMentions(roles=False, users=False, everyone=False),
        )

╚ ** Örnek 2 ** Alt sınıflı değilse:

bot = commands.Bot (allow_mentions = discord.AllowedMentions (roles = False, users = False, herkes = False))

Örnek 1 şu adresten alınmıştır: https://github.com/TheMoksej/Dredd/blob/76ff9608af1bd5a09a89f523996d57103a83b471/bot.py#L107 Örnek 2 şu adresten alınmıştır: https://github.com/discordextremelist/bot/blob/915d203ca2b4ae4bbf9f55cb303c5dc5a4b17e8f/bot.py#L59

Discord.JS (v12.2.0 veya üstü gerektirir) Birden çok seçenek var:

  1. komutunuzun çıktısından sonra , {allowMentions: {parse: []}} ekleyin. (yalnızca bireysel mesajlar için çalışır)
  2. istemciye yerleştirin (bunu yaparsanız, botunuzun gönderdiği tüm mesajlar varsayılan olarak kimseye ping atmaz) ╚ ** Örnek **
const client = new Discord.Client ({
    allowMentions: {parse: []}
});

Örnek: https://github.com/discordextremelist/website/blob/5394fcd179d5fc75e0ef9fbb9e674186a13f620a/src/Util/Services/discord.ts#L30

Discord belgeleri: https://discord.com/developers/docs/resources/channel#allowed-mentions-object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment