Jump to content

Search the Community

Showing results for tags 'discord bot'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • News & Announcements
    • BlockForums Announcements
    • Denarius Announcements
    • Kronos Wallet Announcements
    • The Crypto News Feed
  • Cryptocurrency Discussions
    • Cryptocurrencies
    • Altcoin Announcements
    • General Discussion
    • Tutorials & Help
  • Denarius Discussions
    • General Discussion
    • Tutorials & Help
    • Marketing & PR
    • Development
    • Mining & Staking
    • Trading & Exchanges
    • Marketplace
  • Programming & Design
    • Development QA
    • Design QA
  • Gaming
    • Bot Downloads & Discussion
    • Gaming Discussion
  • Classifieds
    • Buy Sell and Trade
  • Other Discussions
    • Element 115
    • The Lounge
    • Hardware & IoT
    • Tutorials & Guides
    • Domains & Hosting

Product Groups

There are no results to display.

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


BTC Address

Found 1 result

  1. A basic example of a Discord.js bot that can autoupdate every 5 seconds based on an API using fetch. Install nodejs and some packages. Linux x64 or ARM, example below is 64-bit. wget https://nodejs.org/dist/v16.0.0/node-v16.0.0-linux-x64.tar.xz tar xvf node-v16.0.0-linux-x64.tar.xz cd node-v16.0.0-linux-x64/ sudo cp -R bin/* /usr/bin/ sudo cp -R lib/* /usr/lib/ npm install discord.js npm install node-fetch blockheight.js https://gist.github.com/buzzkillb/63a66f27ff65c6dd880a6c3eae740602 //npm install discord.js node-fetch //get blockheight from Chainz CryptoID and update Bots Name as Blockheight const Discord = require('discord.js'); const fetch = require('node-fetch'); const config = require("./config.json"); var chainzApi = "https://chainz.cryptoid.info/d/api.dws?q=getblockcount" const client = new Discord.Client(); client.on('ready', async () => { client.user.setActivity('denarius.io'); const GUILD_ID = client.guilds.cache.map(guild => guild.id); const guild = await client.guilds.fetch(GUILD_ID); console.log('Bot is connected...'); setInterval(async function(){ fetch(chainzApi) .then(function (response) { // Get a JSON object from the response // This is a weird quirk of Fetch return response.json(); }).then(function (data) { // Log the data to the console, block height console.log(data); var blockHeight = "Height: " + data guild.me.setNickname(blockHeight); }) }, 5000); }); client.login(config.BOT_TOKEN); config.json { "BOT_TOKEN": "DISCORDGENERATEDTOKENGOESHERE" } How to add the bot to a server and get your BOT_TOKEN Authorizing Discord User Visit https://discord.com/developers/applications and create 'New Application'. Set a bot name like BlockHead On the page that follows, set the account name and save. Then click Bot Create a Bot account and Save. Click 'Copy' on the Token; this is the API Key you use in the bot script Visit the OAuth2 tab. Under Scopes, select 'bot' The resulting URL is what you (or anyone) use to add your bot instance to a server.
×
×
  • Create New...